使用 CG3Y 下载,可以改成下载txt到本地.
FORM CREATE_TESTFILE. DATA: L_BUFFER(65535), L_OFF LIKE SY-TABIX, L_LEN LIKE SY-TABIX, L_SUM LIKE SY-TABIX. FIELD-SYMBOLS: <L_SYM>. OPEN DATASET DSN FOR APPENDING IN TEXT MODE ENCODING DEFAULT. IF SY-SUBRC <> 0. MESSAGE S619 WITH DSN. EXIT. ENDIF. CLEAR: L_BUFFER, L_OFF. LOOP AT DYNPRO_FIELDS. L_LEN = DYNPRO_FIELDS-LENGTH. L_SUM = L_LEN + L_OFF. IF L_SUM > 65535 OR L_LEN = 0. MESSAGE A604 WITH 'CREATE_TESTFILE' L_SUM. ENDIF. ASSIGN L_BUFFER+L_OFF(L_LEN) TO <L_SYM>. <L_SYM> = DYNPRO_FIELDS-FIELDVALUE. ADD DYNPRO_FIELDS-LENGTH TO L_OFF. ENDLOOP. TRANSFER L_BUFFER TO DSN LENGTH L_OFF. CLOSE DATASET DSN. ENDFORM. "CREATE_TESTFILE