function 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

Read Also
Simple Program that Create Internal Table Dynamically

ABAP Books
ABAP Certification, BAPI, Java, Web Programming, Smart Forms, Sapscripts Reference Books

More ABAP Tips

Main Index
SAP ERP Modules, Basis, ABAP and Other IMG Stuff

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG. 
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk. 
 The content on this site may not be reproduced or redistributed without the express written permission of 
www.erpgreat.com or the content authors.