‎2010 Aug 16 6:22 PM
Can you please help me to know the difference between moving a file using FM "SXPG_COMMAND_EXECUTE" and moving file using "open data set - transfer file- close data set" mechanism?
‎2010 Aug 17 8:08 AM
Through 'SXPG_COMMAND_EXECUTE' u can execute a External command (ie.. UNIX /Windows/OS/400) In ABAP programming..
for Conversion Of Aplication server File/Move the file from one directory to Other...
The Command must be present in SM69.
Using this function module'SXPG_COMMAND_EXECUTE' , you can check the authorization of a user to execute a particular external command and run the command:
With the arguments specified in ADDITIONAL_PARAMETERS
On the target host system defined by OPERATINGSYSTEM and TARGETSYSTEM
If an SAP profile parameter is inserted in the portion of the command stored in the database, then the value of this parameter is substituted into the command. If an SAP application server is active on the target system (TARGETSYSTEM), then the profile parameter values are read from the profile that is active on that system. No parameter substitution is made in ADDITIONAL_PARAMETERS.
After substitution, the command is checked for the presence of "dangerous" characters such as the semicolon ( ; ) on UNIX systems.
If an additional "security function module" is specified in the command definition, this function module is also called in the course of processingebenfalls. This function module can prevent execution of the command.
If the authorization checks complete successfully, the command is run on the target host system.
Through Open Data Set u can read and write the file in the same directory...
Thnaks,
SD
Moderator message: copy/paste without credit, points removed, please do not repeat!
http://www.google.de/search?hl=de&q=%22youcanchecktheauthorizationofauserto+execute%22&meta=&aq=f&aqi=&aql=&oq=&gs_rfai=
http://www.google.de/search?hl=de&q=%22Aftersubstitution%2Cthecommandischeckedforthepresence%22&meta=&aq=f&aqi=&aql=&oq=&gs_rfai=
Edited by: Thomas Zloch on Aug 17, 2010 12:47 PM
‎2010 Aug 17 8:24 AM
Hi sanjit , thanks for the reply..
Sory to extend my question..
Is it like 1st we had to write the file on to the application server using by " open data set- close data set mechanism" and
next ifwe had to move the file in the application server from one location to other, we use "sxpg_command_execute" FM ??
‎2010 Aug 17 8:27 AM
ur obsolutely right..
May i know whts ur exact requiremet .is .. so that i can help u further
Moderator message: please do not use SMS speak.
Edited by: Thomas Zloch on Aug 17, 2010 12:50 PM
‎2010 Aug 17 11:39 AM
Hi sanjit, thanks for the reply.
My requirement is to copy to the target folder . For that I am using FILE_GET_NAME to retrive the target file name and then sending that along with source file path to "sxpg_command_execute" .
But I am getting target file path same as the source from FILE_GET_NAME. Also "SXPG_COMMAND_EXECUTE" is giving that path is not found. Also I dont have access to the folder .
‎2010 Aug 23 9:23 AM
Hi..
First Chek in the destination server that Path is present or not Through AL11.
Have u Created a Command In SM69.. for moving the file purpose..
when u calling the Function Module
u have to pass the Parameters like
COMMANDNAME = Command which u have created
ADDITIONAL_PARAMETERS= the file name
OPERATINGSYSTEM =UNIX
TARGETSYSTEM = Target system of for which u want to move the file
DESTINATION = RFC destination
Thanks,
SD
‎2010 Aug 17 8:32 AM
You can also use the FM SXPG_COMMAND_EXECUTE to execute commands that transfers your file in some sort of queues or ( eg AIS ) which then moves it to the destination path which could be another R/3 sytem , or third party systems