‎2015 Aug 07 4:23 PM
Hi Experts,
My Requirement is created one folder in that folders created 5 more folder, 4 folders related to Module wise folders and one more folder is for Archiving purpose up to this done folders.Every day files are placed by client or users each and every folder,so at the end of the day i have to move or archiving files from 4 folders into 1 archive folder background.Please suggest me how to do.i have to develop abap code or by using file archiving concept.
1 folder---->\DIR_XXX\MAINFOLDER\MM\XXXXX.csv
2 Floder---->\DIR_XXX\MAINFOLDER\SD\XXXXXX.csv
|
|
5 Floder---->\DIR_XXX\MAINFOLDER\ARCHIVE
‎2015 Aug 07 5:53 PM
In case you wish to create in the application server then you can try this code
DATA: l_com TYPE rlgrap-filename,
directory LIKE BTCH0000-TEXT80.
directory = 'DIR_MAIN\MAIN_FOLDER\SD_DIR'.
CALL FUNCTION 'PFL_CHECK_DIRECTORY'
EXPORTING
directory = directory
EXCEPTIONS
pfl_dir_not_exist = 1.
IF sy-subrc = 1.
CONCATENATE 'cmd /c mkdir' directory INTO l_com SEPARATED BY space.
CALL 'SYSTEM' ID 'COMMAND' FIELD l_com.
ENDIF.
A folder is created in Windows SAP Server c:\usr\sap\YAS\DVEBMGS00\work\DIR_MAIN\MAIN_FOLDER\SD_DIR
‎2015 Aug 07 5:41 PM
Hi Venu,
Where do you wanted to create folders?
On the application server or user system
‎2015 Aug 07 5:53 PM
In case you wish to create in the application server then you can try this code
DATA: l_com TYPE rlgrap-filename,
directory LIKE BTCH0000-TEXT80.
directory = 'DIR_MAIN\MAIN_FOLDER\SD_DIR'.
CALL FUNCTION 'PFL_CHECK_DIRECTORY'
EXPORTING
directory = directory
EXCEPTIONS
pfl_dir_not_exist = 1.
IF sy-subrc = 1.
CONCATENATE 'cmd /c mkdir' directory INTO l_com SEPARATED BY space.
CALL 'SYSTEM' ID 'COMMAND' FIELD l_com.
ENDIF.
A folder is created in Windows SAP Server c:\usr\sap\YAS\DVEBMGS00\work\DIR_MAIN\MAIN_FOLDER\SD_DIR
‎2015 Aug 08 8:29 AM
Hi Abdul,
yes folders are created by basiss that was linked to AL11 means Application server,now question is we specified one folder for Archiving(this is also linked to Application server) means old files or Already processed files,those files we need to move to Archiving folder.So end of the day this process will be done by background.So How can i do this.
‎2015 Aug 08 8:21 PM
Hi You need to create a custom utility program with usage of FM 'SXPG_CALL_SYSTEM' to call unix command MV for the same.
Related Transaction code is : SM69
Thanks!
Anil Sahni
‎2015 Aug 10 11:04 AM
Hi Anil,
Yes by using possible to run External commands.operating system is Windows can you suggest how to move file from 1folder to another and how to create OS Command in SM69.i tried OS Command like Move command with Parameters for Operating System Command.can you suugest how to do and not only one file 4floders files move to one Archive folder every end of the day..
‎2015 Aug 10 6:33 PM
Hi,
Give a custom command name like : ZMV
Assign External command: MV
Select additional parameters allowed.
You need to assign op.system as well.
Before calling SXPG_CALL_SYSTEM.
CONCATENATE lv_source " Source Path
lv_destination " Destination Path
INTO lv_parameters SEPARATED BY space.
Then Pass lv_parameters to FM SXPG_CALL_SYSTEM as in additional_parameters with Command.
something like below..
CALL FUNCTION 'SXPG_CALL_SYSTEM'
EXPORTING
commandname = 'ZMV'
additional_parameters = lv_parameters
Thanks!
Anil Sahni