04-13-2010 10:04 AM
Hello guys,
I am going to enhance a ALV with some new fields.
I have done all the changes (enhance structure, fieldcatlog, filling values), but the fields don't appear on the ALV. And only after I change the layout settings and create a new settings, it appears.
I assume the new fields is hidden by the layout settings. But before my enhancements, there is also no layout settings. Why the original fields appear without the layout settings?
Thanks in advance.
04-14-2010 1:23 AM
There are a number of ways to create a fieldcat, you have to declare your new fields
( the fields which you want them to appear in your ALV grid ) in the code
depends on the way you are using to create your fieldcat:
for example:
form build_fieldcatalog.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
hope it will help you...
04-14-2010 12:30 AM
04-14-2010 3:44 AM
What do you mean for global display variant?
the ALV create method has the following parameter
call method alv_advicedata->set_table_for_first_display
exporting
is_layout = i_layout
it_toolbar_excluding = it_exclude[]
is_variant = i_variant
i_save = 'A'
i_default = 'X'
changing
it_outtab = me->alv_advicedata_tab[]
it_fieldcatalog = it_fieldcat[].
04-14-2010 9:42 AM
Hi William
you can add as much as you can cols to the Alv grid just copy and paste in the code :
it_fieldcatalog-fieldname = 'NAME'.
it_fieldcatalog-seltext = 'NAME OF THE STUDENT'.
it_fieldcatalog-coltext = 'NAME OF THE STUDENT'.
APPEND it_fieldcatalog TO it_fieldcat.
CLEAR it_fieldcatalog.
or you can try to remove the line:
is_variant = i_variant
04-14-2010 1:23 AM
There are a number of ways to create a fieldcat, you have to declare your new fields
( the fields which you want them to appear in your ALV grid ) in the code
depends on the way you are using to create your fieldcat:
for example:
form build_fieldcatalog.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
hope it will help you...
04-14-2010 5:31 AM
Hi william,
whenever you want to add new fields to the alv displayed table you have to add
new fields to the fieldcatalog there is nothing like it hide unless you explicitly define it to be.
if i want to add seatsmax and seatsocc in my table then i add this for the existing fieldcatelog
code.
fcat-fieldname = 'SEATSMAX'.
fcat-outputlen = 15.
fcat-ref_table = 'SFLIGHT'.
fcat-key_sel ='X'.
APPEND fcat TO t_fcat.
fcat-fieldname = 'SEATSOCC'.
fcat-outputlen = 15.
fcat-ref_table = 'SFLIGHT'.
fcat-key_sel ='X'.
APPEND fcat TO t_fcat.
the other way is to pass directly the structure to the parameter i_structure_name
of the method set_table_for_first_display.
i hope it helped you.
Regards and Best wishes.