标签:
在最后一行加个断点,执行看<FS_DTAB>的值。在选择屏幕输多少,内表生成多少列。
DATA: DY_TABLE TYPE REF TO DATA, DY_WA TYPE REF TO DATA, IT_STR TYPE LVC_T_FCAT, WA_STR TYPE LVC_S_FCAT. FIELD-SYMBOLS: <FS_DTAB> TYPE STANDARD TABLE, <FS_DWA> TYPE ANY, <FS_VALUE> TYPE ANY. DATA LV_SEQ TYPE I VALUE 1. DATA LV_SEQ_C TYPE C LENGTH 2. PARAMETERS: P_LINE TYPE I DEFAULT 8. DO P_LINE TIMES. LV_SEQ_C = LV_SEQ. CONCATENATE ‘C‘ LV_SEQ_C INTO WA_STR-FIELDNAME. WA_STR-COL_POS = LV_SEQ. WA_STR-INTTYPE = ‘CHAR‘. WA_STR-INTLEN = 1. APPEND WA_STR TO IT_STR. CLEAR WA_STR. LV_SEQ = LV_SEQ + 1. ENDDO. CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE EXPORTING IT_FIELDCATALOG = IT_STR IMPORTING EP_TABLE = DY_TABLE. ASSIGN DY_TABLE->* TO <FS_DTAB>. CREATE DATA DY_WA LIKE LINE OF <FS_DTAB>. ASSIGN DY_WA->* TO <FS_DWA>.
标签:
原文地址:http://www.cnblogs.com/fieldcatalog/p/5435636.html