03-24-2008 5:31 AM
Hi Friends,
I'm using REUSE_ALV_FIELDCATALOG_MERGE to get the field catalog and looping on field_cat to customize the names of columns in report ...
Now I want to hide some of the columns depending on some input parameter.. How do i do it?
Here's is what im doing rite now...
How do i hide column dealercode??
loop at it_fieldcat into wa_fieldcat.
if wa_fieldcat-fieldname = 'UPLOAD_DATE'.
move 'Upload Date' to wa_fieldcat-seltext_l.
move 'Up Date' to wa_fieldcat-seltext_m.
move 'UpDate' to wa_fieldcat-seltext_s.
elseif wa_fieldcat-fieldname = 'TRANSACTIONID'.
move 'Trans.Id' to wa_fieldcat-seltext_l.
move 'TranId' to wa_fieldcat-seltext_m.
move 'Tr.Id' to wa_fieldcat-seltext_s.
elseif wa_fieldcat-fieldname = 'DEALERCODE'.
move 'DealerCode' to wa_fieldcat-seltext_l.
move 'Dlr CC' to wa_fieldcat-seltext_m.
move 'Dlr.CC' to wa_fieldcat-seltext_s.
elseif wa_fieldcat-fieldname = 'DEALERNAME'.
move 'Dealer Name' to wa_fieldcat-seltext_l.
move 'Dlr Name' to wa_fieldcat-seltext_m.
move 'Dealr' to wa_fieldcat-seltext_s.
endif.
endloop.
Pls suggest me solution..
Regards,
Amey
03-24-2008 5:52 AM
Hi,
if u use a work area u need to use modfiy it_fieldcat from wa_fieldcat.
TYPE-POOLS:slis.
field-symbols:<wa_fcat> type slis_fieldcat_alv.
DATA:it_fieldcat TYPE slis_t_fieldcat_alv.
LOOP AT it_fieldcat ASSIGNING <wa_fcat>.
IF <wa_fcat>-fieldname = 'FIELD1'."ur field
<wa_fcat>-no_out = 'X'."for hiding a column(here u dont need to have modify)
ENDIF.
ENDLOOP.
rgds,
bharat.
03-24-2008 5:35 AM
loop at it_fieldcat into wa_fieldcat.
if wa_fieldcat-fieldname = 'UPLOAD_DATE'.
move 'Upload Date' to wa_fieldcat-seltext_l.
move 'Up Date' to wa_fieldcat-seltext_m.
move 'UpDate' to wa_fieldcat-seltext_s.
elseif wa_fieldcat-fieldname = 'TRANSACTIONID'.
move 'Trans.Id' to wa_fieldcat-seltext_l.
move 'TranId' to wa_fieldcat-seltext_m.
move 'Tr.Id' to wa_fieldcat-seltext_s.
elseif wa_fieldcat-fieldname = 'DEALERCODE'.
move 'DealerCode' to wa_fieldcat-seltext_l.
move 'Dlr CC' to wa_fieldcat-seltext_m.
move 'Dlr.CC' to wa_fieldcat-seltext_s.
if {write the condition here}
clear wa_fieldcat.
endif.
elseif wa_fieldcat-fieldname = 'DEALERNAME'.
move 'Dealer Name' to wa_fieldcat-seltext_l.
move 'Dlr Name' to wa_fieldcat-seltext_m.
move 'Dealr' to wa_fieldcat-seltext_s.
endif.
MODIFY it_fieldcat from wa_fieldcat..
endloop.
Pls reward if useful
Thanks Arjun
03-24-2008 5:44 AM
Ok Arjun, i got it...
I'll try it and revert in case of any difficulty...
Thank you for prompt response...
regards,
Amey
03-24-2008 5:46 AM
Hi,
If you want to display a Data Dictionary table without displaying all possible columns initially (using field NO_OUT of the field catalog).
Pass NO_OUT = 'X' for those columns which are to be hidden based on your condition.
NO_OUT
If you set this field, you hide the relevant column in the list. Nevertheless, the column is available in the field selection and can be interactively selected by the user as a display field. The ALV displays the contents of hidden fields on the detail screen for a row in the grid control.
TECH
If this field is set, the relevant field is not displayed on the list and cannot be shown
interactively. The field is only known in the field catalog. (For example, it must not be
specified as a sorting criterion).
And i would suggest you to use the FM LVC_FIELDCATALOG_MERGE for generating your Field catalog.
Hope this helps.
Thanks
Balaji
03-24-2008 5:52 AM
Hi,
if u use a work area u need to use modfiy it_fieldcat from wa_fieldcat.
TYPE-POOLS:slis.
field-symbols:<wa_fcat> type slis_fieldcat_alv.
DATA:it_fieldcat TYPE slis_t_fieldcat_alv.
LOOP AT it_fieldcat ASSIGNING <wa_fcat>.
IF <wa_fcat>-fieldname = 'FIELD1'."ur field
<wa_fcat>-no_out = 'X'."for hiding a column(here u dont need to have modify)
ENDIF.
ENDLOOP.
rgds,
bharat.