2007 Mar 20 8:59 PM
Friends,
Please see the code below. gt_alv_data2 is my internal table with 10 fields and i need to display only 3 fields. How do I set the other fields not to be displayed on the output. Thanks in advance.
DATA ls_fieldcat TYPE slis_fieldcat_alv.
DATA: lt_fcat TYPE slis_t_fieldcat_alv,"Field catalog.
ls_fcat_grid TYPE lvc_s_fcat.
get the fld cat from FM
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-cprog
i_inclname = sy-cprog
i_internal_tabname = 'GT_ALV_DATA2'
CHANGING
ct_fieldcat = lt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
LOOP AT lt_fcat INTO ls_fieldcat.
ls_fieldcat-tabname = 'GT_ALV_DATA'.
CASE ls_fieldcat-fieldname.
WHEN 'SEL'. " 0
ls_fieldcat-seltext_s = ls_fieldcat-seltext_m =
ls_fieldcat-seltext_l = ls_fieldcat-reptext_ddic
= space.
ls_fieldcat-edit = c_true.
ls_fieldcat-checkbox = c_true.
ls_fieldcat-outputlen = 1.
WHEN 'FIELD1'.
ls_fieldcat-seltext_s = ls_fieldcat-seltext_m =
ls_fieldcat-seltext_l = ls_fieldcat-reptext_ddic
= 'XXXXX#'.
ls_fieldcat-emphasize = c_true.
WHEN 'FIELD2'.
ls_fieldcat-seltext_s = ls_fieldcat-seltext_m =
ls_fieldcat-seltext_l = ls_fieldcat-reptext_ddic
= 'XXXXX#'.
ls_fieldcat-emphasize = c_true.
FIELD 3.
FIELD 4.
AND SO ON.....
WHEN 'ROW'. " coloring
ls_fieldcat-seltext_s = ls_fieldcat-seltext_m =
ls_fieldcat-seltext_l = ls_fieldcat-reptext_ddic
= 'ROW'.
ENDCASE.
MODIFY lt_fcat FROM ls_fieldcat.
ENDLOOP.
LOOP AT lt_fcat INTO ls_fieldcat.
MOVE-CORRESPONDING ls_fieldcat TO ls_fcat_grid.
ls_fcat_grid-seltext = ls_fcat_grid-scrtext_l =
ls_fcat_grid-scrtext_m = ls_fcat_grid-scrtext_s =
ls_fieldcat-seltext_m.
ls_fcat_grid-key = c_true.
APPEND ls_fcat_grid TO p_lt_fcat_grid.
ENDLOOP.
2007 Mar 20 9:37 PM
where you are building your filed catalog
ls_filed_catalog-no_out = 'X'.
for the fileds you don not wish to see.
reward if helpful
2007 Mar 20 9:37 PM
where you are building your filed catalog
ls_filed_catalog-no_out = 'X'.
for the fileds you don not wish to see.
reward if helpful
2007 Mar 20 10:36 PM