GUI_* WS_* Function In Background,
CSV Upload
GUI_* and WS_* function modules do not work in background When scheduling a job in the background the appropriate statement to read in your file is OPEN DATASET, and the file must be on the file system that the SAP server can see. At anytime, a user can switch of the Personal Computers even though the job is still running in the background. Therefore GUI_* and WS_* function modules are not designed to work in that way, as they need to access your personal computer file. To choose the correct download method to used, you can check the value of SY-BATCH in your code, if it is 'X' use OPEN DATASET and if it is ' ' use WS_UPLOAD. *-- Open dataset for reading DATA:
OPEN DATASET dsn FOR INPUT IN TEXT MODE.
*-- Open dataset for writing DATA rec(80). OPEN DATASET dsn FOR OUTPUT IN TEXT MODE.
What is the difference when we use upload, ws_upload, gui_upload function modules? UPLOAD, WS_UPLOAD, GUI_UPLOAD, are used in BDC concepts.
ie., Batch Data Communication.
UPLOAD--- upload a file to the presentation server
(PC)
GUI_UPLOAD------- Replaces WS_UPLOAD. Upoad file from presentation server to the app server. From 4.7 SAP version it is replaced. How to Upload csv file to SAP? Common File Download Upload Questions: How you upload the data from text file to sap
internal table? From my knowledge its by upload or gui_upload.
You can upload data from presentation server to an internal table using gui_upload. Use gui_download to download from internal table to flat file. Use fm ALSM_EXCEL_TO_INTERNAL_TABLE to upload data frm excel. Use function module GUI_UPLOAD The FILETYPE refer to the type of file format you need: For e.g 'WK1' - Excel format , 'ASC' - Text Format etc. CALL FUNCTION 'GUI_UPLOAD' EXPORTING FILENAME = 'C:\test.csv' FILETYPE = 'ASC' TABLES DATA_TAB = itab EXCEPTIONS FILE_OPEN_ERROR = 1 FILE_READ_ERROR = 2 NO_BATCH = 3 GUI_REFUSE_FILETRANSFER = 4 INVALID_TYPE = 5 NO_AUTHORITY = 6 UNKNOWN_ERROR = 7 BAD_DATA_FORMAT = 8 HEADER_NOT_ALLOWED = 9 SEPARATOR_NOT_ALLOWED = 10 HEADER_TOO_LONG = 11 UNKNOWN_DP_ERROR = 12 ACCESS_DENIED = 13 DP_OUT_OF_MEMORY = 14 DISK_FULL = 15 DP_TIMEOUT = 16 OTHERS = 17. Other Upload Download Tips
Do you have a ABAP Question? More ABAP Functions Tips
ABAP Programming Tips
Best regards,
All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
|