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: 

Hiding fields in ALV report

Former Member
0 Kudos

Hi,

I have a requirement where in 2 fields are added to an existing ALV report.

Now, when the report is executed, the 2 newly added fields should not be displayed (It should be Hided).

On selecting certain variant, the 2 fields should be displayed.

Is there a way this 2 fields can be handled?

Note :This report doesn't have a layout parameter in the selection screen.

Regards,

Rajesh

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

You can do some thing like this..

By Default you can make them in Hidden mode using NO_OUT option of the fieldcatalog.

fieldcat-no_out = 'X'. "this hides the field from Display

When ever you want you can get them using the Change Layout option.

5 REPLIES 5

former_member188685
Active Contributor
0 Kudos

You can do some thing like this..

By Default you can make them in Hidden mode using NO_OUT option of the fieldcatalog.

fieldcat-no_out = 'X'. "this hides the field from Display

When ever you want you can get them using the Change Layout option.

0 Kudos

Thank you Vijay for the reply.

I tried the code and it works.

I had another question, when selecting the hidden field from the layout, it displays as the last field whereas in the program, the code for populating the field catalog for this field is in between other fields (I mean this should not be displayed as the last field in the alv report).

Is there a way where we can handle this?

Regards,

Rajesh

0 Kudos

Hi,

wa_fieldcat-COL_POS = your desired column position here.

Regards

Marcin

0 Kudos

You can also change the postion of the Field when you are displaying. you can just move them up. Just select the column what ever you want and click the button which is next to Find button which is Selected Row(s) up to one postion

MarcinPciak
Active Contributor
0 Kudos

Hi,

Try to do this:


data: it_fieldcat type lvc_t_fcat,
        wa_fieldcat type lvc_s_fcat,
        hidden_flag type c.

"here you create fieldcatalog and do your processing
...
"now when certain condition is meet change state of fields
if condition = 'X'.
  hidden_flag = 'X'
else.
  hidden_flag = space.
endif.

"now change fieldcat 
Loop at it_fieldcat into wa_fieldcat.
case wa_fieldcat-FIELDNAME.
  when 'first field to be hidden' or 'second field to be hidden'.
          wa_fieldcat-NO_OUT = hidden_flag.
endcase.
modify it_fieldcat from wa_fieldcat.
endloop.

Now, depending of the condition the fields will be in turn displayed/hidden

Regards

Marcin