Friday, November 23, 2007

sap abap function module for REUSE_ALV_FIELDCATALOG_MERGE

An example :-

Please note that structure ZSTOCK is a custom table and iline looks as follow :-

data: iline type table of zstock with header line.
data: gt_fieldcat type slis_t_fieldcat_alv.

perform setup-fieldcatalog using gt_fieldcat[].

form setup-fieldcatalog using _fieldcat type slis_t_fieldcat_alv.
data: ls_fieldcat type slis_fieldcat_alv.

call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_internal_tabname = 'ILINE'
i_structure_name = 'ZSTOCK'
changing
ct_fieldcat = _fieldcat.

loop at _fieldcat into ls_fieldcat.
case ls_fieldcat-fieldname.
when 'DEPT'.
ls_fieldcat-no_out = 'X'.
when 'DESCR'.
ls_fieldcat-no_out = 'X'.
when 'GOOD_PRD'.
ls_fieldcat-do_sum = 'X'.
endcase.

modify _fieldcat from ls_fieldcat.
endloop.

endform. " FIELDCATALOG

No comments:

Blog Archive