cancel
Showing results for 
Search instead for 
Did you mean: 

External commands on Heterogenous environments

JPReyes
Active Contributor
0 Kudos

Hi All,

Got a small problem... Running a heterogeneous environment where the CI is AIX-64 and the application server is Linux RH5-32,

Basically I'm trying to run a job that calls external commands to drop a file in Linux... external command ZCD which is the "cd" command to call a directory is failing in Linux, I have configured the command in SM69 for both AIX and Linux, for AIX works fine but for Linux fails... saying...

UNIX command 'ZCD /usr/sap/sid/out/' failed - RC

funny enough i could not see any errors on dev_cp or dev_xpg

Also checked transaction FILE and looks fine...

directory been called by external command is mounted and i can call it from OS without issues.

Any advice welcome.

Regards

Juan

Accepted Solutions (1)

Accepted Solutions (1)

markus_doehr2
Active Contributor
0 Kudos

Anything in the syslog (SM21)?

Markus

JPReyes
Active Contributor
0 Kudos

Systemerror when executing external command ZCD on <host>

Thats all... not very helpful

Regards

Juan

markus_doehr2
Active Contributor
0 Kudos

indeed...

what returncodes do you get? anything in the developertraces?

Markus

JPReyes
Active Contributor
0 Kudos

Also get

Communication error, CPIC return code 020, SAP return code 456

in SM21

where 456 is 456,,Timeout during conn. setup

but this work fine in my AIX DI and in the CI

I'm starting to think that is something to do with the syntax group in FILE or with the sapxbg program in the kernel.. or maybe the Z program itself but i just tried to debug and is taking Linux and the OPSYSTEM so that should be ok...

Cracking my head.

regards

Juan

markus_doehr2
Active Contributor
0 Kudos

Can you execute a different command?

Markus

JPReyes
Active Contributor
0 Kudos

yeah... i can run ZDF which run df -k

Regards

Juan

markus_doehr2
Active Contributor
0 Kudos

Strange...

I could imagine a problem: the "cd" command is executed in a new shell, that shell is closed after it and thus it will not return.

If you do something like

#!/bin/bash
cd <directory>
touch test

and execute that, does that work?

What shell do you use on Linux?

Markus

JPReyes
Active Contributor
0 Kudos

Out of office now... I'll try that in the morining

JPReyes
Active Contributor
0 Kudos

This is the error on the trace...

M Wed Oct 1 10:04:16 2008

M ***LOG R49=> ThReceive, CPIC-Error (020456) [thxxhead.c 6904]

M ***LOG R5A=> ThReceive, CPIC-Error (62760924) [thxxhead.c 6909]

M ***LOG R64=> ThReceive, CPIC-Error ( CMSEND(SAP)) [thxxhead.c 6914]

A RFC 3222 CONVID 62760924

A * CMRC=20 DATA=1 STATUS=1 SAPRC=456 ThSAPCMRCV

A RFC> ABAP Programm: SAPLSXPT (Transaction: SE38)

A RFC> User: REYESJP (Client: 800)

A RFC> Destination: %_TCPIP_%2 (handle: 4, , {48E3317D-2F95-2A5F-E100-00000A000

3A0})

A RFC> Called function module: SAPXPG_START_XPG

A *** ERROR => RFC ======> CPIC-CALL: 'ThSAPCMRCV' : cmRc=20 thRc=456

Timeout during connection setup (check that partner exists)

[abrfcio.c 7849]

A *** ERROR => RFC Error RFCIO_ERROR_SYSERROR in abrfcpic.c : 3224

CPIC-CALL: 'ThSAPCMRCV' : cmRc=20 thRc=456

Timeout during connection setup (check that partner exists)

[abrfcio.c 7849]

A *** ERROR => RFC Error RFCIO_ERROR_MESSAGE in abrfcio.c : 1644

[abrfcio.c 7849]

I tested and i can touch a file on that directory... as per above message it seems like a connection problem... i just updated sapxpg with the latest release and it doesn't make any difference.

Juan

JPReyes
Active Contributor
0 Kudos

Note 188772 - External program does not work

1. Use the C shell as the login shell of the gateway user.

How can i check and change the sap gateway login user shell?

Regards

Juan

markus_doehr2
Active Contributor
0 Kudos

The gateway runs usually under adm - you can check with

grep <sid>adm /etc/passwd

or

echo $SHELL

as that user.

Which shell is used shouldn´t make a difference.

Markus

JPReyes
Active Contributor
0 Kudos

Seems like a gateway error,

This is found on dev_rd

Wed Oct 1 14:24:01 2008

      • ERROR => R3ISearchPartner: timeout, partner LU: ><host><, TP: >sapxpg< [gwr3cpic.c 6016]

      • ERROR => R3ISearchPartner: HOST: <host.fqdn>, conv ID: 79594240 [gwr3cpic.c 6029]

Any thoughts?

regards

Juan

JPReyes
Active Contributor
0 Kudos

After going through a lot of notes... i managed to isolate the problem...

basically sapxpg is not executing 1 particular external command which is "cd" so basically i downloaded all the sapxpg versions i could and test them but i get the following error at SM49

Command executed: cd : :

Target host: <linux_host>

Can't exec external program (No such file or directory)

External program terminated with exit code 1

All the problems posted before are gone...

I can call other external commands in the same linux box without any problems and i can call the "cd" command from AIX,

Any thoughts?

regards

Juan

markus_doehr2
Active Contributor
0 Kudos

"cd" is a shell builtin, most other commands are "real" commands (cp, mv etc.)

This is really weird..

can you try to execute another builtin - just as a test - such as "pwd", does that issue the same error?

Markus

JPReyes
Active Contributor
0 Kudos

Just created ZPWD in sm69 and executed in sm49 without issues....

works fine...

pretty weird alright!

Regards

Juan

JPReyes
Active Contributor
0 Kudos

Checking again dev_cp... and find this at initialization...

Trace file of control program (trace level 3)

< Function: BtcTrcInit> Function: main SAPXPG 640

2008-10-01--09-23-38 : Before BtcXpgDetach

> Function: BtcXpgDetach Can't detach from process group (already leader)

< Function: BtcXpgDetach Accept RFC connection from R/3 system

2008-10-01--09-23-38 : Before RfcAccept

2008-10-01--09-23-38 : RfcAccept returned OK

security check switched OFF

Install RFC call SAPXPG_START_XPG

Install RFC call SAPXPG_START_XPG_LONG

Install RFC call SAPXPG_END_XPG

Wait for RFC call SAPXPG_START_XPG or SAPXPG_START_XPG_LONG

2008-10-01--09-23-38 : Before first call of RFCDispatch

2008-10-01--09-23-38 : After first call of RFCDispatch

2008-10-01--09-23-38 : Before call of RfcClose (sequencing error)

2008-10-01--09-23-38 : After call of RfcClose (sequencing error)

Its weird... but wonder why the other commands work and "cd" doesn't

JPReyes
Active Contributor
0 Kudos

This is the most weird thing ever....!!

i found the problem... now i need to find a way to resolve this.

Basically in theres no "cd" command in /bin or /sbin or /usr/bin in Linux while the "cd" command is on the /bin in AIX.

Thats why all other external programs run in Linux becuase they are in the /bin directory (which is the logic thing).

Anyone knows where the "cd" command is located in LINUX RH5?

Regards

Juan

PS: if its built in bash, how can we call the command from the external command in Linux?

Former Member
0 Kudos

you can find the cd file using 'find / -name "cd" -print"

cheers,

-Sunil

JPReyes
Active Contributor
0 Kudos

It doen't exist... its not found.

This means cd is built-in the bash... so how can we call the "cd" command from SAP?....

Regards

Juan

Former Member
0 Kudos

can you try with chdir command.

cheers,

-Sunil

Former Member
0 Kudos

Hello,

maybe you can use a workaround:

Do not call external command cd first, and external command othercmd afterwards, but create an external command, e.g. in a Unix shell script, that will do both in one call.

Reminds me of a common problem in Unix scripting: When you try to create a shell script that will do a cd only, it will work; but the effect will be gone as soon as the script has ended...

regards

JPReyes
Active Contributor
0 Kudos

can you try with chdir command

Nope...same thing

Do not call external command cd first, and external command othercmd afterwards, but create an external command, e.g. in a Unix shell script, that will do both in one call.

sounds good.... can you expand on this?...

Former Member
0 Kudos

Hello,

I suppose you don't just want to cd ; most probably you want to do something in the new directory. (Why else would you cd ?) So let's assume you want to execute othercmd there.

Create a Unix file, for a start with these two lines only:

cd <newdir>

othercmd

Make sure it does what you need, by calling it from Unix.

Then, in SAP, create an external command for it, in SM69.

Or after reading your initial question again, if othercmd just means delete a file , you may even do without cd ; just call rm with absolute pathname.

hope this helps

JPReyes
Active Contributor
0 Kudos

My problem is that this external command is called by several import/export jobs and it works fine in AIX... is there anyway at all to make plain "cd" work?

Regards

Juan

JPReyes
Active Contributor
0 Kudos

find the solution.... I just touch "cd" under /bin to create an empty file and gave it 777 that was enough to fix the problem...

A simple thing that did my head for 2 weeks and i still can't find the logic behind it.

I might use this to create a Blog

Thanks for all the inputs

Regards

Juan

Former Member
0 Kudos

Hello Juan,

I am still trying to understand what you are trying to do. What exactly do you need cd command for? And what makes you think it is working for AIX? Is it just because there is no error message? Or what are you doing after having executed cd ?

I have neither AIX nor Linux RH at hand, but I tried with HPUX and SuSE Linux. I got errors with SuSE, no errors with HPUX.

Then, in HPUX, I executed, in SM48, zcd first, and zpwd afterwards.

pwd command still gave the old directory, /usr/sap/<SID>/DVEBMGS<nr>/work. And I am by no means surprised.

What is surprising, imho, is that you wrote it works, at least for AIX.

So could you please explain a bit more?

And I cannot imagine that an empty file named cd will make cd command work...

Or what am I missing here?

regards

JPReyes
Active Contributor
0 Kudos

Basically when I called ZCD from AIX it return without errors and if i called ZCD from Linux it gave me following error;

Command executed: cd : :

Target host: testsap1

Can't exec external program (No such file or directory)

External program terminated with exit code 1

After lots of checking (including reviewing SAPXPG upside down) found that in AIX "cd" command existed as a physical file in /bin, while in Linux was missing. so after trying lots of different things I touched "cd" into /bin in Linux to create an empty file and the error disappeared.

Conclusion: SAP when using externall commands verify that a "cd" physical file exist (even if its empty) in /bin (or somewhere inside $PATH) before proceding. Why??? I have no clue.

Regards

Juan

Former Member
0 Kudos

Hello,

basically, in SuSE Linux I got the same error message as you did in RH.

But what I still don't understand: Is zcd command working from SM48?

It seems you managed to get rid of error messages. But does this mean a changing of working directory did happen?

What is the effect of an external command zcd ??

My hypothesis:

No effect that could be recognized afterwards. You might as well leave cd command away.

Correct me if I am wrong!

regards

JPReyes
Active Contributor
0 Kudos

Is zcd command working from SM48?

Yes, now its working...

But does this mean a changing of working directory did happen?

and the change directory happened... i even tested it with an extract job that use the external command.

What is the effect of an external command zcd ??

It's used to call a specific directory before uploading/downloading files to the OS by background jobs.

My hypothesis:

No effect that could be recognized afterwards. You might as well leave cd command away.

Correct me if I am wrong!

This solve the issue... so, wrong...

regards

Juan

Former Member
0 Kudos

Hello Juan,

thanks for confirming;

I will have to do more tests, when I have got the time, or the need.

So far I only tried zcd and zpwd in a dialogue session, with the results I mentioned above. From what you wrote I gather that it will be possible for background jobs, even in Linux. Good to know.

regards

Answers (0)