Thursday, January 7, 2010

Merge Fieldcat From Dictionary Structure

*** FOR OO ALV

 data : gt_fcat type lvc_t_fcat.

  call function 'LVC_FIELDCATALOG_MERGE'
    exporting
      i_structure_name       = 'YOUR_DICT_STRUCTURE'
      i_bypassing_buffer     = 'X'
    changing
      ct_fieldcat            = gt_fcat[]
    exceptions
      inconsistent_interface = 1
      program_error          = 2
      others                 = 3.
  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.

*** FOR ALV FUNCTION

  data : gt_fieldcat type slis_t_fieldcat_alv.


  call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    exporting
      i_structure_name = 'YOUR_DICT_STRUCTURE'
      i_bypassing_buffer     = 'X'
    changing
      ct_fieldcat      = gt_fieldcat.

--

No comments:

Post a Comment