09-16-2005 10:34 AM
Hi All,
I have to execute an unix command in abap.
the unix command look like this :
'ksh /usr/local/bin/scripts/PUTtransfer /DEXIA/Send/sending.0000789529.000'
abap look like this :
concatenate 'ksh /usr/local/bin/scripts/PUTtransfer /' outfile+1 into
import-command.
call 'SYSTEM' id 'COMMAND' field import-command
id 'TAB' field tab-sys.
leave program.
but sy-subrc = '1-' after...
I have read some article on SM69 but don't know how to use it ...
Message was edited by: STEPHAN KAMINSKI
Subject changed ...
09-16-2005 11:26 AM
09-16-2005 10:47 AM
09-16-2005 11:00 AM
Hi,
For example :
when 'UNIX'.
concatenate 'cd' cd_path ';' cmd into cmd
separated by space.
CALL 'SYSTEM' ID 'COMMAND' FIELD CMD
ID 'TAB' FIELD RESULT-SYS.
CALL FUNCTION 'AUTHORITY_CHECK_TCODE'
EXPORTING
TCODE = 'SM69'
EXCEPTIONS
OK = 0
NOT_OK = 2
OTHERS = 3.
AUTHRC = SY-SUBRC.
regards
Aveek
09-16-2005 11:14 AM
Define your parameters in SM69 and then use FM SXPG_COMMAND_EXECUTE for executing those commands.
08-24-2007 4:38 AM
I use code in abap in below
concatenate 'cd' cd_path ';' cmd into cmd
separated by space.
CALL 'SYSTEM' ID 'COMMAND' FIELD CMD
ID 'TAB' FIELD RESULT-SYS.
It can't execute.
Is any problem with it?
09-16-2005 10:48 AM
Absolutely, you should used SM69 to manage system calls.
But, it is possible to do what you intend to do. Are you sure you have sufficient authorizations to perform that call ?
Try this code to check that you are OK to call system commands:
TYPE-POOLS SABC.
CALL FUNCTION 'AUTHORITY_CHECK_C_FUNCTION'
EXPORTING PROGRAM = ...
ACTIVITY = ...
FUNCTION = ...
EXCEPTIONS NO_AUTHORITY = 1
ACTIVITY_UNKNOWN = 2.
09-16-2005 11:15 AM
Guillaume,
I have tried it but it seems that I do have all right!
:s
Imagine I use SM69...how should I enhence my program ?
09-16-2005 11:20 AM
I have used now the fm SXPG_COMMAND_EXECUTE
return code is 0 but table returnd filled with this :
39 ./KeyUpdate[26]: LogFile: cannot create
42 ./KeyUpdate[27]: pascalFile: cannot create
39 ./KeyUpdate[28]: LogFile: cannot create
39 ./KeyUpdate[32]: LogFile: cannot create
72 /usr/local/bin/scripts/PUTtransfer[37]: checktransferlist: cannot create
72 /usr/local/bin/scripts/PUTtransfer[38]: checktransferlist: cannot create
56 /usr/local/bin/scripts/KeyUpdate: LogFile: cannot create
59 /usr/local/bin/scripts/KeyUpdate: pascalFile: cannot create
52 /usr/local/bin/scripts/KeyUpdate: openssl: not found
56 /usr/local/bin/scripts/KeyUpdate: LogFile: cannot create
36 sh: checktransferlist: cannot create
36 sh: checktransferlist: cannot create
56 /usr/local/bin/scripts/KeyUpdate: LogFile: cannot create
59 /usr/local/bin/scripts/KeyUpdate: pascalFile: cannot create
52 /usr/local/bin/scripts/KeyUpdate: openssl: not found
56 /usr/local/bin/scripts/KeyUpdate: LogFile: cannot create
36 sh: checktransferlist: cannot create
36 sh: checktransferlist: cannot create
56 /usr/local/bin/scripts/KeyUpdate: LogFile: cannot create
59 /usr/local/bin/scripts/KeyUpdate: pascalFile: cannot create
52 /usr/local/bin/scripts/KeyUpdate: openssl: not found
56 /usr/local/bin/scripts/KeyUpdate: LogFile: cannot create
36 sh: checktransferlist: cannot create
36 sh: checktransferlist: cannot create
56 /usr/local/bin/scripts/KeyUpdate: LogFile: cannot create
59 /usr/local/bin/scripts/KeyUpdate: pascalFile: cannot create
52 /usr/local/bin/scripts/KeyUpdate: openssl: not found
56 /usr/local/bin/scripts/KeyUpdate: LogFile: cannot create
36 sh: checktransferlist: cannot create
36 sh: checktransferlist: cannot create
56 /usr/local/bin/scripts/KeyUpdate: LogFile: cannot create
59 /usr/local/bin/scripts/KeyUpdate: pascalFile: cannot create
52 /usr/local/bin/scripts/KeyUpdate: openssl: not found
56 /usr/local/bin/scripts/KeyUpdate: LogFile: cannot create
36 sh: checktransferlist: cannot create
36 sh: checktransferlist: cannot create
107/etc/mail/sendmail.cf: line 77: fileclass: cannot open /etc/mail/local-host-names: World writable directory
105/etc/mail/sendmail.cf: line 472: fileclass: cannot
By readin that I'm wondering, is there any specific user that is used to execute unix command ????
09-16-2005 11:26 AM
09-16-2005 11:30 AM
Hi,
Make sure that the Unix user that runs your SAP system has enough rights.
Eddy
10-13-2005 9:29 AM
+----
|Hi,
|
|Make sure that the Unix user that runs your SAP system |has enough rights.
|
|Eddy
+----
Hi Eddy, How would you do that ?
09-16-2005 12:36 PM
Dear All,
Thanks for your help...
Finally I use SXPG_COMMAND_EXECUTE and give some additional parameters to the fm...
This FM retrieves me a table which I think is the log of the execution ????
First to answer get the reward
regards,
09-16-2005 12:47 PM
Well, as far as I can remember, you get the echo of the server in this table...
09-19-2005 6:22 PM
If you are looking for something quick and easy, the following FM can also be used. Output is returned from the command in the std_lines internal table. This technique is suggested by SAP in OSS Note 9391 "Calling external programs".
call function 'RFC_REMOTE_PIPE'
destination 'SERVER_EXEC'
exporting
command = command
read = 'X'
tables
pipedata = std_lines
exceptions
communication_failure = 1
system_failure = 2.
10-13-2005 9:12 AM
Usually what is the name of the user that runs the SAP System...
I have used chmod 777 * on the file in order to get the right but nothing changes!
Can any one gives me more information on the user that runs the SAP System and the one that is used to execute unix command...