09-30-2008 1:03 PM
HI,
im using method: set_table_for_first_display to show my tabel entries in ALV.
call method go_grid2->set_table_for_first_display
exporting
i_structure_name = 'ZSTRUC1'
is_layout = gs_layout
changing
it_outtab = gt_table
exceptions
others = 4.
How can i edit the fieldcat ? I would like to get rid of some fields in the ALV ?
09-30-2008 1:08 PM
Hi,
Try like this.....
data : lv_tab_name type dd02l-tabname.
field-symbols: <lwa_fcat> type lvc_s_fcat.
clear :lv_tab_name.
lv_tab_name = '/RAD/NOT_LINKED_TRACKINGINFO'.
refresh : gt_fcat[].
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = lv_tab_name
changing
ct_fieldcat = gt_fcat[]
exceptions
inconsistent_interface = 1
program_error = 2
others = 3.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
loop at gt_fcat assigning <lwa_fcat>.
case <lwa_fcat>-fieldname.
when 'CLAIM_NUMBER'.
<lwa_fcat>-no_out = 'X'.
endcase.
endloop.
call method gcc_grid_tr->set_table_for_first_display
exporting
* i_structure_name = c_s_dmhdr
is_variant = gs_variant
i_save = 'A'
is_layout = gs_layout
* it_toolbar_excluding = gt_excl_fun[]
changing
it_outtab = gt_not_linked_trackinginfo[]
it_fieldcatalog = gt_fcat[] "field catalog
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Hope it will helps
09-30-2008 1:08 PM
Hi,
Try like this.....
data : lv_tab_name type dd02l-tabname.
field-symbols: <lwa_fcat> type lvc_s_fcat.
clear :lv_tab_name.
lv_tab_name = '/RAD/NOT_LINKED_TRACKINGINFO'.
refresh : gt_fcat[].
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = lv_tab_name
changing
ct_fieldcat = gt_fcat[]
exceptions
inconsistent_interface = 1
program_error = 2
others = 3.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
loop at gt_fcat assigning <lwa_fcat>.
case <lwa_fcat>-fieldname.
when 'CLAIM_NUMBER'.
<lwa_fcat>-no_out = 'X'.
endcase.
endloop.
call method gcc_grid_tr->set_table_for_first_display
exporting
* i_structure_name = c_s_dmhdr
is_variant = gs_variant
i_save = 'A'
is_layout = gs_layout
* it_toolbar_excluding = gt_excl_fun[]
changing
it_outtab = gt_not_linked_trackinginfo[]
it_fieldcatalog = gt_fcat[] "field catalog
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Hope it will helps
09-30-2008 1:09 PM
09-30-2008 1:09 PM
Hello,
Instead of use the structure importing parameter from the method you need to define the field catalog manually and then pass it to the attribute fieldcat from the method.
Take a look on this: [ALV easy reference|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907]There are three ways to define the field catalog (automatically, semi-automatically and manually).
Regards.