cancel
Showing results for 
Search instead for 
Did you mean: 

External command is not working in File Receiver Adapter

jegathees_waran
Active Participant
0 Kudos

Hi,

I have tried to copy the file which is mentioned in my File Adapter (Receiver) to 3 different folders thru OS command. The purpose is to save time. I have created one CC for Source(File) and one CC for target(File). After the target file is created, I want to copy this file in 3 folders. For this I have written one batch file in my system.

File Name: copy1.bat

@ECHO OFF

COPY %1 C:\TEST1\arch_t1

COPY %1 C:\TEST2\arch_t2

COPY %1 C:\TEST3\arch_t3

DEL %1

The command which I entered in the Receiver CC (File Adatper is)

-


Run Operating System Command After Message Processing

Command Line: C:\FILES\copy1.bat %F %f

Timeout(secs): 60

Terminate Program After Timeout - Check box is selected.

-


But, this external command is not working. (because the target files are not created in those directories C:\TEST1, C:\TEST2, C:\TEST3)

I did this scenario by refering the Michael'w weblog:

/people/michal.krawczyk2/blog/2007/02/08/xipi-command-line-sample-functions

In this blog, he has also given how to troubleshoot external command. I tried this also. It is not working.

I use Windows XP OS. XI 3.0 SP 18.

Friends, Could you kindly tell why this external command is not working? What could be the problem?

Thanks in advance.

Kind Regards,

Jeg P.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi, Jeg

Please check this note first.

Note 841704 - XI File & JDBC Adapter: Operating system command

http://service.sap.com/sap/support/notes/841704

And if the above note doesn't solve your problem, could you try this one?

Change backslash to forward in the command line like the following.

C:/FILES/copy1.bat %F %f

Best Regards.

Sejoon

Answers (5)

Answers (5)

jegathees_waran
Active Participant
0 Kudos

Hi Chilla

From the links you have given, I understand one point, OS command runs only in which system the adapter engine runs. But, how do we test & confirm this .. ? Assume that we have SAP 6.40 Kernel XI Server in some system X. How do I test my OS command (Simple Copy command) .. ? If you have any experience in OS command at File adapter level, kindly help me.

Kind Regards,

Jeg P.

jegathees_waran
Active Participant
0 Kudos

Hi Sejoon,

In XI Server, where do we test this Java Program? Either in mapping (or) Visual admin .. or where ? If you help me, I will solve this problem. (Simple Step By Step Procedure to run this program)

Thank you.

Kind Regards,

Jeg P

Former Member
0 Kudos

Hi,

How about this code:

@ECHO OFF

COPY %1 C:<b>
</b>TEST1<b>
</b>arch_t1

COPY %1 C:<b>
</b>TEST2<b>
</b>arch_t2

COPY %1 C:<b>
</b>TEST3<b>
</b>arch_t3

DEL %1

Please also check access settings to this catalogues, maybe adapter engine cannot write there.

Regards,

Wojciech

Former Member
0 Kudos

HI,

Try to see the below links

/people/michal.krawczyk2/blog/2005/08/17/xi-operation-system-command--error-catching

Regards

Chilla

jegathees_waran
Active Participant
0 Kudos

Dear Sejoon,

I have gone through the below said note and tried to change the command as you given. But, still my OS command is not executed. I am not able to find where the problem is. Because, SXMB_MONI does not show any error. In CC monitoring, it does not show any error. But, the OS command is not working i.e files are not copied.

Any help Sejoon.

Thanking you.

Kind Regards,

Jeg P.

Former Member
0 Kudos

Hi, Jeg.

As the note says, please check the java Runtime.exec behavior

with the proper user.

-


If in doubt, check if the command can be successfully run through

the Java Runtime.exec(...) API. Also note that the command is run

as user "<sid>adm" (Unix) / "SAPService<SID>" (Windows).

-


So, Could you check the following(very dirty one!) Java in your

XI server and check if it works? For simulating %F, create a test

file C:\FILES\test.txt whatever the content is.

-


import java.util.*;

import java.io.*;

public class ExecJava {

public static void main(String args[]) {

try {

Runtime rt = Runtime.getRuntime();

Process proc = rt.exec("C:/FILES/copy1.bat C:
FILES
test.txt");

} catch (Exception e) {

e.printStackTrace();

}

}

}

-


Good Luck.

Sejoon