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: 

Linux - Execute external Command (SM69, SXPG_COMMAND_EXECUTE)

Private_Member_19084
Active Contributor
0 Kudos

Hi experts,

I've defined in SM69 a external command for our Linux-Host.

This command I execute with Function Module SXPG_COMMAND_EXECUTE.

However, I always get the exception 2 - Command not found.

The test in Sm69 works fine.

We are also having HP-UX Hosts and on this the command works fine.

Also other commands works fine on Linux-Host.

The command is: ls -l (so command = ls, command parameter = -l)

Does anyone know the reason for this?

Kind regards

1 ACCEPTED SOLUTION

FredericGirod
Active Contributor
0 Kudos

Hi,

did you try to execute the FM thru the SE37 trans. ?   if yes did you check the Case Sensistive checkbox ?

Linux (and Unix) are case sensistive

regards

Fred

10 REPLIES 10

FredericGirod
Active Contributor
0 Kudos

Hi,

did you try to execute the FM thru the SE37 trans. ?   if yes did you check the Case Sensistive checkbox ?

Linux (and Unix) are case sensistive

regards

Fred

0 Kudos

Hello Fred,

yes, I tried it also in SE37 - same result.
Case sensitive was set.

Kind regards

0 Kudos

Hi Christian,

could you try to use a program instead of a command ?   I means, "ls" is a part of the kernel, try to execute a program in a directory like ifconfig ..  /usr/sbin/ifconfig 

regards

Fred

0 Kudos

Hi Fred,

but you know, if I try it in SM69, it works well.

I've now changed ls -l to ls and this also works in SM69 and also SE37.

But I need ls -l.

Kind regards

0 Kudos

Do you have notice SAP put a "?" after the parameter of the command "ls" ?   <-- it's for additional parameters of the directory location

you could create a script "ZLS"  doing a ls -l  ..

0 Kudos

Hello Fred,

what do you mean with the "?"?
Could you please explain it again?

I've now also created an OSS ticket, because I already found note 1555353 which describes a similar problem.
But I couldn't solve it.

Kind regards

0 Kudos

try to put in the parameter :   "-l ?"   instead of "-l" 

0 Kudos

I've now changed ls -l to ls -l ?.

So the command paramter looks like this now in SM69: -l ?

But this doesn't work.


Kind regards

0 Kudos

Do you really need it ?

could you use kernel function ?  or you really need the SM69 ?

looks how to use the kernel function of OS command : abap - report to execute os-commands - Code Gallery - SCN Wiki

regards

Fred

0 Kudos

The note did solve the problem, I made an error by implementing the note.