Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Alv list display

Former Member
0 Kudos
76

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
48

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

2 REPLIES 2

Former Member
0 Kudos
49

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

0 Kudos
48

It is so simple thank you very much Dhruv.