In many occasion, data needs to be loaded to SAP BW through flat file.
But flat file load from local desktop is not possible through process chain(Process chain will failed to extract from Local desktop).
In order to resolve this issue, flat file needs to be uploaded to application server and then process chain can be triggered at its scheduled time.
Process chain will not fail if flat file is loaded from application server.
Program to load file to application server:
TYPE-POOLS : vrm.
DATA: param TYPE vrm_id,
values TYPE vrm_values,
value LIKE LINE OF values.
*Parameter Declaration
PARAMETERS: p_file TYPE localfile OBLIGATORY.
*File selection from local desktop
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
DATA: ifile TYPE filetable.
DATA: xfile LIKE LINE OF ifile.
DATA: rc TYPE i.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
initial_directory = 'C:\'
CHANGING
file_table = ifile
rc = rc.
READ TABLE ifile INTO xfile INDEX 1.
CHECK sy-subrc = 0.
p_file = xfile-filename.
*Local file upload to Application server
END-OF-SELECTION.
DATA: p_file_path LIKE sapb-sappfad.
p_file_path = p_file.
CALL FUNCTION 'ARCHIVFILE_CLIENT_TO_SERVER'
EXPORTING
path = p_file_path
targetpath = ‘abc.CSV'
* EXCEPTIONS
* ERROR_FILE = 1
* OTHERS = 2
.
While executing the above program, selection screen displayed to choose the file from local desktop as shown below:
Click on F4 option to choose the file from desktop.
Click on Execute.
In order to check the file is successfully loaded, please goto T-code AL11.
Docubel click the directory "DIR_SAPUSERS"
Now, we can able to see the flat file that has been loaded to application server.
Now this file can be used to load through process chain.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
5 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |