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: 

How to control the visibility of column in ALV

Former Member
0 Kudos
396

Hi,Expert,

I'm using class CL_GUI_ALV_GRID to dispaly informations,but I want to hide

some columns using code,how could I achieve that?

Thanks a lot

1 ACCEPTED SOLUTION

Former Member
0 Kudos
117

Hi Ray,

Try searching the ABAP-General forum - there is lots of information in there about how to hide columns in ALV's.

Gareth.

4 REPLIES 4

Former Member
0 Kudos
118

Hi Ray,

Try searching the ABAP-General forum - there is lots of information in there about how to hide columns in ALV's.

Gareth.

0 Kudos
117

There's also plenty of ALV samples in the UI Programming & OO forums - plus SAP's sample programs that typically are called names like BALV and SALV - I find "BCALV_TEST_GRID" is always a good one to start with as it demos more ffeatures... you could also search for "no_out" and "Field catalog".

Jonathan

former_member1345686
Active Participant
0 Kudos
117

Hi Ray,

Herewith a portion of sample code to hide the columns.

DATA : wa_fieldcat_alv TYPE LINE OF lvc_t_fcat ,

it_fieldcat_alv TYPE lvc_t_fcat .

  • Create ALV Field Catalog utk Header

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

i_structure_name = 'ZP119H'

CHANGING

ct_fieldcat = it_fieldcat_alv[].

LOOP AT it_fieldcat_alv[] INTO wa_fieldcat_alv.

CASE wa_fieldcat_alv-fieldname .

WHEN 'HIDE1'.

wa_fieldcat_alv-no_out = 'X'.

WHEN 'HIDE2'.

wa_fieldcat_alv-no_out = 'X'.

WHEN 'HIDE3'.

wa_fieldcat_alv-no_out = 'X'.

ENDCASE.

MODIFY it_fieldcat_alv FROM wa_fieldcat_alv.

ENDLOOP.

Rgds,

TS WINEDYA

Former Member
0 Kudos
117

Hi,all

Thank you very much.