Application Development 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: 

unix user for SAP

Former Member
0 Kudos

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 ...

1 ACCEPTED SOLUTION

guillaume-hrc
Active Contributor
0 Kudos

Or, that the user in Unix has very few rights...

14 REPLIES 14

Former Member
0 Kudos

Any helps?

0 Kudos

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

0 Kudos

Define your parameters in SM69 and then use FM SXPG_COMMAND_EXECUTE for executing those commands.

0 Kudos

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?

guillaume-hrc
Active Contributor
0 Kudos

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.

0 Kudos

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 ?

Former Member
0 Kudos

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 ????

guillaume-hrc
Active Contributor
0 Kudos

Or, that the user in Unix has very few rights...

0 Kudos

Hi,

Make sure that the Unix user that runs your SAP system has enough rights.

Eddy

0 Kudos

+----


|Hi,

|

|Make sure that the Unix user that runs your SAP system |has enough rights.

|

|Eddy

+----


Hi Eddy, How would you do that ?

Former Member
0 Kudos

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,

guillaume-hrc
Active Contributor
0 Kudos

Well, as far as I can remember, you get the echo of the server in this table...

Former Member
0 Kudos

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.

0 Kudos

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...