Application Development and Automation 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: 
Read only

External System command is not working

Former Member
0 Likes
2,751

Hi Experts,

I have a requirement to copy some files (K&R ) from one directory to another directory on my application server. For that I made one external operating systems command through Tcode sm69.

I took operating system as "DOS" and put the operating system command

"copy d:\usr\sap\e70-trans\data\r900425.e70 d:\usr\sap\trans\test"

and left the "Parameters for operating system command" blank. I executed it by FM SXPG_COMMAND_EXECUTE., it gives me an error message

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

WaitForSingleObject failedwith %d (No such device or address)

the above DOS command is working fine when i am running it directly from dos prompt.

I didn't give any RFC in above FM. and changed the operating system to DOS by default it comes as Windows NT, gave the command name. Remaining things were defaulted.

My application server is on Windows Server 2003.

Can you please let me know what I am missing?

Thanks

Yogesh Gupta

6 REPLIES 6
Read only

MarcinPciak
Active Contributor
0 Likes
1,697

Frankly I have never tried your way to copy the file from PC to App.Server. One catching eye thing here is:

copy d:\usr\sap\e70-trans\data\r900425.e70 d:\usr\sap\trans\test

I guess there is no such directory d:\usr\sap\... as this is UNIX right? Try changing the second argument to meet unix convention and leave the first using DOS. Not sure if that works.

Nevetherless if you want to just put some files on App.Sever you can use t-code CG3Z and CG3Y for uploading and downloading files respectively.

Hope this helps

Regards

Marcin

Read only

Former Member
0 Likes
1,697

Hi Yogesh,

What is the OS of your current SAP system, are you sure it's 'DOS'? Check the OS from menu system->status.

If the OS is correct, have you tried to execute the command from SM69? Is it correctly done?

Regards,

Lim...

Read only

Former Member
0 Likes
1,697

Hi,

Since you ave tried it from command prompt, simplest would be create a batch file & include your copy command in that & in SM69 define a new command say ZCOPY, give operating system command as batch file name along with full path. Test the above via SM49. If it works then just use:

CALL FUNCTION 'SXPG_COMMAND_EXECUTE'

EXPORTING

commandname = 'zcopy'

  • additional_parameters = w_additional_parameters

status = statusline

TABLES

exec_protocol = t_copy

EXCEPTIONS

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

OTHERS = 15

I hope this helps,

Regards

Raju Chitale

Edited by: Raju Chitale on Apr 15, 2009 8:16 AM

Edited by: Raju Chitale on Apr 15, 2009 8:18 AM

Read only

0 Likes
1,697

Hi,

It almost soved my issue but during this i came up with one more issue

when i try to copy in this way from one direcory to another directory (both the directory are on the same server) it works fine. but when i try to do the same when these directories are on different servers, it gives following error

D:\usr\sap\E70\DVEBMGS08\work>copy d:\usr\sap\trans\test\r900425.e70
tc-demo1\sapmnt\trans\test Logon failure: unknown user name or bad password. 0 file(s) copied. External program terminated with exit code 1

But when i use the same command directly from the one sever it works fine without asking any user name and password, could you please tell me how can i add userid and password in the batch file.

As of now my batch file content is as following

copy d:\usr\sap\trans\test\r900425.e70
tc-demo1\sapmnt\trans\test

Thanks

YG

Read only

0 Likes
1,697

Hi Yogesh,

How did u solve the problem, in my case I am not using PGP file instead of batch file. I am getting the same error you were getting previously when I execute it with sm69

Read only

Former Member
0 Likes
1,697

Need to pass the user id and password in BAT file