Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem on 'SXPG_CALL_SYSTEM' function

Former Member
0 Likes
962

Hi,All

get a problem on 'SXPG_CALL_SYSTEM' function

the function could move file successfully if it ran online.

But it failed to move file if we submitted it running in background.

coding:

concatenate i_path lt_file-name into g_fromName.

* < 1 >* Call LHA Command

* create system command

     CMND =   'ZMOVE'"<-- system command name. Refer "SM69"

********************************************************

* Configuration                                        *

* operating system command : "cmd"                     *

* parameters for operating system command : "/c move"  *

********************************************************

* MOVE need parameter "<source file> _ <target file>"

   move g_fromName TO OUT_FILE.

   move p_path to in_file.

   CONCATENATE OUT_FILE IN_FILE INTO PARM SEPARATED BY SPACE.

*call system command

   CLEAR RTN_CH.

   CALL FUNCTION 'SXPG_CALL_SYSTEM'

        EXPORTING

             COMMANDNAME                = CMND

             ADDITIONAL_PARAMETERS      = PARM

*       IMPORTING

*            STATUS                     = RTN_CH

        TABLES

             EXEC_PROTOCOL              = OUT_DATA

        EXCEPTIONS

             NO_PERMISSION              = 01

             COMMAND_NOT_FOUND          = 02

             PARAMETERS_TOO_LONG        = 03

             SECURITY_RISK              = 04

             WRONG_CHECK_CALL_INTERFACE = 05

             PROGRAM_START_ERROR        = 06

             PROGRAM_TERMINATION_ERROR  = 07

             X_ERROR                    = 08

             PARAMETER_EXPECTED         = 09

             TOO_MANY_PARAMETERS        = 10

             ILLEGAL_COMMAND            = 11.


1 REPLY 1
Read only

arindam_m
Active Contributor
0 Likes
634

Hi,

I think you have to use SXPG_COMMAND_EXECUTE Function Module. Your one works for current host system and OS type. Check link for details :


http://help.sap.com/saphelp_40b/helpdata/EN/fa/0971fb543b11d1898e0000e8322d00/content.htm

Cheers,

Arindam