Вот несколько примеров:
Создаете и заполянете fieldcatalog
Code:
* structure for new LVC (ALV grid container) field catalog
DATA: ls_lvc_fieldcat TYPE lvc_s_fcat,
gt_lvc_fieldcatalog TYPE TABLE OF lvc_s_fcat,
* internal table for old (standard) ALV field catalog
* (without header line - exactly as in function
* 'REUSE_ALV_FIELDCATALOG_MERGE')
lt_alv_fieldcatalog TYPE slis_t_fieldcat_alv.
FIELD-SYMBOLS: <ls_alv_fieldcat> TYPE slis_fieldcat_alv.
IF NOT sy-subrc IS INITIAL.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
REFRESH gt_lvc_fieldcatalog.
*** map old fieldcatalog fields on new:
LOOP AT lt_alv_fieldcatalog ASSIGNING <ls_alv_fieldcat>.
CLEAR ls_lvc_fieldcat.
MOVE-CORRESPONDING <ls_alv_fieldcat> TO ls_lvc_fieldcat.
* specific fieldnames caused by length restriction for basis objects
ls_lvc_fieldcat-ref_field = <ls_alv_fieldcat>-ref_fieldname.
ls_lvc_fieldcat-ref_table = <ls_alv_fieldcat>-ref_tabname.
ls_lvc_fieldcat-roundfield = <ls_alv_fieldcat>-roundfieldname.
ls_lvc_fieldcat-decmlfield = <ls_alv_fieldcat>-decimalsfieldname.
ls_lvc_fieldcat-decimals_o = <ls_alv_fieldcat>-decimals_out.
ls_lvc_fieldcat-dd_outlen = <ls_alv_fieldcat>-ddic_outputlen.
* for fields without reference to the Data Dictionary
IF ls_lvc_fieldcat-ref_table IS INITIAL.
ls_lvc_fieldcat-coltext = ls_lvc_fieldcat-fieldname.
ENDIF.
APPEND ls_lvc_fieldcat TO gt_lvc_fieldcatalog.
ENDLOOP.
2) На основе созданного FieldCatalog создете динамическую таблицу.
Code:
DATA: lr_table TYPE REF TO data.
FIELD-SYMBOLS: <ls_lvc_outtab> TYPE ANY,
<l_field> TYPE ANY,
<gt_lvc_outtab> TYPE TABLE.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.