Question:
Hi,
I would like to load master data from flat-files (CSV). It's easy but I would like to load under from changing file-names. Can you write me how I could change the name of the flat-file in the infopackage run-time ?
There is a possibilty to write an ABAP routine where I can write the name of the file but I don't know how I could do that... Please help !
Thanks in advance !
Answer:
the ABAP coding will depend on your particular requirements.. it is hard to say without any directions. If you can give some more elements maybe it will be possible to help you with some coding.
F.
Answer:
If your files are put into the directory with a .timestamp(YYYYMMDDHHMMSS) then you could use something like the following to get the latest file loaded. This code would go in your infopackage...
Good Luck.
DATA: BEGIN OF TABL OCCURS 0,
LINE(132),
END OF TABL.
DATA: FILENAME(45) TYPE C. " Listing Template
DATA: SYS_COMMAND(100) TYPE C. " Directory Listing Parameter
* BUILD FILENAME
FILENAME = '/inbound/material_master.*'.
TRANSLATE FILENAME TO LOWER CASE.
* BUILD SYSTEM COMMAND LS FOR DIRECTORY LISTING
SYS_COMMAND(7) = 'ls '.
SYS_COMMAND+7(45) = FILENAME.
* EXECUTE LS COMMAND
CALL 'SYSTEM' ID 'COMMAND' FIELD SYS_COMMAND
ID 'TAB' FIELD TABL-*SYS*.
SORT TABL.
* RETRIEVE MOST RECENT FILE
LOOP AT TABL.
ENDLOOP.
P_SUBRC = SY-SUBRC.
P_FILENAME = TABL-LINE.
Answer:
Hi guys ,
I solved the problem with your help !
Many thanks again,
Jules