cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to execute external command

former_member201800
Participant
0 Kudos

Hi Experts,

I am not able to execute customer external command from SM49 in Solman system, but i am able to execute the same command from OS level.

Also, I am able to execute the standard command(e.g. env) from sap.

I have given full permission to the customized scripts.

It is giving the below error:

can't exec external program (2) external program terminated with exit code 1.

Please suggest.

Regards,

Shyam Kumar

Accepted Solutions (1)

Accepted Solutions (1)

Sriram2009
Active Contributor
0 Kudos

Hi Shyam.

1.  Refer the SCN thread with same issue  - Re: Error while Execute External Operating Syst... | SCN

2. Refer the SCN wiki link for reference Creation of External Commands with the help of UNIX Coding in SAP - ABAP Development - SCN Wiki

BR

SS

former_member201800
Participant
0 Kudos

Thanks for the reply..

I checked the permission and it is 777.

Also, i am able to execute the program from OS level.

This program transfer the cofile and datafile to other system. I am getting error, when trying to execute from SAP.

Regards,

Shyam

former_member227283
Active Contributor
0 Kudos

Hi Shyam,

Can you check the WP log as well as SM21 log which will give some hint for the issue which you are getting and share the same on forum.

Regards,

Anil Bhandary

Sriram2009
Active Contributor
0 Kudos

Hi Shyam.

In which user id you are trying to execute the program? I thing you have to use the SAP SIDADM user id and then check the permission same as other Co and data files.

BR

SS

former_member201800
Participant
0 Kudos

Hi Anil,

I am not getting any log in SM21. Also, there is no abap dump.

I have checked SU53 also, but there is no authorization issue.

Issue is happening, when i am trying to execute this from SAP level.

It is working fine from OS and moving the file correctly.

Regards,

Shyam

former_member201800
Participant
0 Kudos

Hi SS,

From OS level, i am executing the script by sidadm only. It is successfully running from OS level.

But from SAP, when i am executing this by DDIC user as well as from my user id then i am getting the error.

Regards,

Shyam

former_member227283
Active Contributor
0 Kudos

Hi Shyam,

Kindly provide more detail like.

Location of script on OS level and what is a configuration you have defined in SM49

Also would suggest you to enable trace by using SAP note: 1612730

Regards,

Anil Bhandary

Sriram2009
Active Contributor
0 Kudos

Hi Shyam.

Could you share the screen shot of you Z command and also scripts for coping the file from one to another system?

BR

SS

former_member201800
Participant
0 Kudos

Hi SS,

I have made on simple command, but this is also not executable from SAP.

This command gives the o/p from OS level.

also, dev_xpg log is not generating in work dir.

Regards,

Shyam

Sriram2009
Active Contributor
0 Kudos

Hi Shyam.

1.  In first you have to define the OS command only not all the full string. " cat"

2. Define the parameters " /etc/redhat-release > /usr/sap/dm1/dvebmgs01/work/version.log

Refer the sample screen shot

BR

SS

former_member201800
Participant
0 Kudos

Hi SS,

Now, the command is working. But, below script is still not working.

Its working fine from OS.

Please suggest.


Regards,

Shyam

former_member227283
Active Contributor
0 Kudos

Hi Shyam,

Keep the /usr/sap/trans/scripts/<your script.sh>  in field Operating system command

in Field Parameter for operating system command keep the value as <your TR number> for e.g. what you have hide 900***

Regards,

Anil Bhandary

former_member201800
Participant
0 Kudos

Hi Anil,

I am creating the command in the same way, you are saying.

I have kept the script in Operating system command and passing TR no(Variable) in additional parameters. But its not working.

Regards,

Shyam

former_member227283
Active Contributor
0 Kudos

Hi Shyam,

Can you let us know how you are running the command on OS level ?

Do you go to specific location to run the command ?

Share an example of OS level command with output as an screenshot including the location from where you are running the command.

Regards,

Anil Bhandary

former_member201800
Participant
0 Kudos

Hi Anil,

From OS level, i am executing the command from work dir and its working fine.

For script, it is also working fine from any dir.

But, issue is coming when trying to execute the scripts from SAP level(SM49/SM69) only.

Regards,

Shyam Kumar

kaus19d
Active Contributor
0 Kudos

Could we know that you are passing the TR no for what purpose? generally TR related can be checked in the TRANS.LOG file, understanding that we are on the same page.

Thanks,

Kaushik

former_member227283
Active Contributor
0 Kudos

Dear Shyam,

      no_permission                 = 1

    command_not_found             = 2

    parameters_too_long           = 3

    security_risk                 = 4

    wrong_check_call_interface    = 5

    program_start_error           = 6

    program_termination_error     = 7

    x_error                       = 8

    parameter_expected            = 9

    too_many_parameters           = 10

    illegal_command               = 11

    wrong_asynchronous_parameters = 12

    cant_enq_tbtco_entry          = 13

    jobcount_generation_error     = 14

Above are the description for each exit code.

Earlier you were getting exit code 2 which mean command not found.

Which you have resolve by rectifying the input.

Now you are getting error as exit code 8.

Can you tell us what exactly is 900***.SID. It is not a cofile or data file name as it shuold start with K or D.

Regards,

Anil Bhandary

former_member201800
Participant
0 Kudos

Hi Kaushik,

I am copying the cofiles and data files from Dev system to QA system(SCP) through scripts.

From OS level, i am able to copy the file by executing the command.

But, when i am trying to execute the external command through SAP, it is giving error.

Regards,

Shyam

former_member201800
Participant
0 Kudos

Hi Anil,

If we will put K or D then 900***.ID will become cofile or data file. This is the parameter, which we pass for moving the cofile and data file of particular TR.

Can you tell me what is x_error, which is related to the error i am getting.

Regards,

Shyam

Sriram2009
Active Contributor
0 Kudos

Hi Shyam.

I think you have to check the command parameters(String). Kindly check with Unix administrator they can tell use right way. In our environment we don't have any Unix servers.

BR

SS

kaus19d
Active Contributor
0 Kudos

can we get here your script? In general for transports correspondance RFCs are created when we do configure in STMS, so please do check whether the correspondance RFCs are there or not & the TRANSPORT path/routes is still defined properly, just wanted to make sure from my side.

We can inform if any issue in the script. For example if you are looking to add a TR into the TR Buffer, the command would be like, tp addtobuffer <TR> <Target SID> client=<target client> pf=<the transport domain controller or with path for that>

Thanks,

Kaushik

former_member227283
Active Contributor
0 Kudos

Dear Shyam,

X_ERROR mean Command has terminated with unknown error.

What I understood is, you are manually passing K900***.ID or D900**.ID on OS level like

On OS level you run command as

For Cofile

/usr/sap/trans/scripts/<your script.sh>  K900**.ID

For datafile

/usr/sap/trans/scripts/<your script.sh> D900**.ID


If my above understanding is right then the screenshot which you have shared does not have K or D before 900** in SM49 that is what the problem of failing External command in SAP


Regards,

Anil Bhandary

Answers (1)

Answers (1)

former_member201800
Participant
0 Kudos

Hi Anil,

We dont need to give the different parameter for cofiles and data files.

We execute the script as : abc.sh 9000****.SID

It move the cofiles and data files in target system.

I am not getting the reason for this issue.

Regards,

Shyam

former_member227283
Active Contributor
0 Kudos

Hi Shyam,

Enable the trace for external command as per the SAP note shared earlier and reproduce the issue to get some detail logs for the issue.

Regards,

Anil Bhandary

former_member201800
Participant
0 Kudos

There is no trace generating... i have tried few times..

Former Member