cancel
Showing results for 
Search instead for 
Did you mean: 

Capturing Outbound Interface (In UDF)

Former Member
0 Kudos

Hi,

I have designed a Outbound Interface:

<?xml version="1.0" encoding="UTF-8"?>

<MT_DMS_FINAL>

<Record>

<Row>

<FirstName/>

</Row>

</Record>

</MT_DMS_FINAL>

Now i write a Adapter Module to get the File name when the Sender File Adapter picks up the file iot reads the filename with the help of the Adapter Module and adds a element name called Filename to the outbound interface when i see it in the SXMB_MONI.

<MT_DMS_FINAL>

<Record>

<Row>

<FirstName/>

</Row>

</Record>

<FileName>test.xml</FileName> // This element has to be captured

</MT_DMS_FINAL>

Now how to get the element to be used in the Mapping (UDF) i mean .kindly help how to capture the entire xml and write the code to get the "FileName" element in specific,.

Advice

regards

Srini

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Check with this

/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14

Regards

Seshagiri

former_member194786
Active Contributor
0 Kudos

Hi Venkateswarlu,

For capturing the file name, Adapter Modules are not required. You can directly access it in the mapping using the UDF in the Message mapping using Dynamic Configuration. Use the following UDF. Map it directly to the output field in which you want the filename.

Code:

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

String ourSourceFileName = conf.get(key);

return ourSourceFileName;

You can follow this blog:

/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14

Regards,

Sanjeev.

Former Member
0 Kudos

This UDF will get the file name and assigns it to target element:

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

String ourSourceFileName = conf.get(key);

return ourSourceFileName;

...as I said before, there is no need to write an adapter module..

Edited by: Peter Jarunek on Jun 3, 2008 12:31 PM

Former Member
0 Kudos

Hi Peter ,

Thanks for the answer.

The above UDF which you have given is wriiten when we have checked the box

Adapter Specific Message Attributes

1) Set Adapter Specific Message attributes

2) FileName

So when we check this and use below UDF i get the file name.

My curiosity was to know that when i use the Adapter Module and get the filename in the Payload , how to capture that.

Can you tell below UDF is applicable for (ASMA) or (Adapter Module)

regards

Srini

Former Member
0 Kudos

exactly

I don't know what ASMA is..

If you develop such an adapter module, which will add a filename to the payload, you don't need this UDF then. information about filename will be already in the inbound payload..

But forget any adapter module for this. Use just this simple UDF

Peter

Edited by: Peter Jarunek on Jun 3, 2008 12:41 PM

former_member194786
Active Contributor
0 Kudos

Hi Venkateswarlu,

You dont need to select the check box and as well as write UDF to have same file name as sender side. For that only selecting the check box will do.

Actually if you just select the check box and, you will get the same file name of the output as the input file name. However if you use the UDF also you can access the file name using a global container. Now you can modify it and accordingly set the target filename as per the requirment.

My curiosity was to know that when i use the Adapter Module and get the filename in the Payload , how to capture that.

If you have already captured the name using the Adapter Module you can directly map it to the Target field.

Regards,

Sanjeev.

Former Member
0 Kudos

ASMA is Adapter Specific Message Attributes.