09-11-2008 9:17 AM
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
09-11-2008 9:19 AM
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.
09-11-2008 9:19 AM
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.
09-11-2008 9:41 AM
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
09-11-2008 9:45 AM
Hi,
wa_fieldcat-COL_POS = your desired column position here.
Regards
Marcin
09-11-2008 9:46 AM
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
09-11-2008 9:32 AM
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