SAP ABAP4 Learning --- Upload and Download (1)

xiaoxiao2021-03-06  99

* & ------------------------------------------------ --------------------- ** & report ZTEST_LIUGANG_913 ** & ** & ------------------ -------------------------------------------------- - ** & ** & ** & ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------- *

Report ZTEST_LIUGANG_913.

Data: Begin of Itab Occurs 0, A (6), B (6), END OF ITAB.

Data: FileName (160), FilePath (128), Test Like Rlgrap-filename.

Data: Begin of Itab2 Occurs 0, A (60), End of Itab2.

ITAB-a = '123'.itab-b =' 456'.Append itab.itab-a = 'abc'.itab-b =' Def'.Append iTAB.

Loop at itab. Write: / ITAB-A, ITAB-B.ENDLOOP.

Parameters: AA Like Itab-a.

INITIALIZATION.

Start-of-selection.set pf-status '1000'. AT user-command. Case Sy-Ucomm. When 'down'. Perform Download_Save Using 's' 'Save File'. If Strlen (FilePath)> 0. Perform Start_save ................................................... .. Endcase. * & ---------------------------------------------- ----------------------- ** & form Download_Save * & -------------------- ------------------------------------------------------------------- * * Save files to your local * -------------------------------------------------------------------------------------------------------------------------------------- -------------------------- ** -> p1 text * <- p2 text * ---------- -------------------------------------------------- -------- * Form Download_SAVE Using Open_TYPE OPEN_TXT. CALL FUNCTION 'WS_FILENAME_GET' Exporting Def_FileName = filepath mask = ', *. CSV . 'MODE = OPEN_TYPE TITLE = OPEN_TXT IMPORTING FILENAME = FILEPATH EXCEPTIONS INV_WINSYS = 1 NO_BATCH = 2 SELECTION_CANCEL = 3 SELECTION_ERROR = 4 OTHERS = 5. IF SY-SUBRC <> 0. MESSAGE E001 (ZTEST_LIUGANG). ENDIF.

Download_Save * & ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------- ** & form start_save * & ------------------ -------------------------------------------------- - ** Text * --------------------------------------------- ------------------------- ** -> p1 text * <- p2 text * ----------- -------------------------------------------------- -------- * Form Start_save. Data: Temp (30). Loop at Itab. Concatenate Itab-a ITAB-B ITAB2-A Separated By ','. Append itab2. Endloop.call function 'ws_download 'Exporting filename = filepath filetype =' ASC 'tables data_tab = itab2.endform. "START_SAVE * & ----------------------------- ---------------------------------------- ** & form start_upload * & --- -------------------------------------------------- ---------------- ** Text * ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ---------------------------- ------------ ** -> p1 text * <- p2 text * ------------------------ --------------------------------- ------------ * Form Start_upload.

Clear itab2. Clear itab. Clear itab [].

Call function 'ws_upload' exporting filename = filepath filetype = 'ASC' TABLES DATA_TAB = ITAB2.

Loop at itab2. Split itab2-a at ',' Into itab-a itab-b. Append itab. Endloop.

LOOP At Itab. Write: / ITAB-A, ITAB-B.

Endloop.

"START_UPLOAD

转载请注明原文地址:https://www.9cbs.com/read-105160.html

New Post(0)