cancel
Showing results for 
Search instead for 
Did you mean: 

File name from an attribute of an element of the payload

Former Member
0 Kudos

Dear Experts,

Could you suggest the syntax for specifying the file name from a variable in the file receiver communication channel? I need to grab the file name from an ATTRIBUTE of an element of the payload.

Thanks a lot.

Example: Need to pass the attribute "descReceipt" of the element "promotionEvent" to the variable in the following payload:

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

<promotionExport>

<promotionEvent eventIdentifier="30" status="A" descReceipt="FILE1">

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Not sure about the Variable substitution syntax to refer the payload.

But you can use Dynamic Configuration in Mapping and can override the file name with the value coming in the attribute.

Thanks

Farooq.

Former Member
0 Kudos

The limitation I have on this is that I can use only an attribute of the element. I can not use any element!

I know the syntax for reading the element, but not the attribute.

Thank you.

Former Member
0 Kudos

Check this:

http://help.sap.com/saphelp_nw70/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm

The variables can refer to attributes of the message header or elements of the message payload.

So not sure if you can access the attribute.

Thanks,

Beena.

Former Member
0 Kudos

Just create a your source data type as per the elements and attributes.

Pass the attribute value as a input for a UDF. Use this value while overriding the file name.

Thanks

farooq.

Shabarish_Nair
Active Contributor
0 Kudos

are you trying to do it via variable substitution?

Note that you cannot use attributes.

The alternative solution is to use the dynamic configuration.

Former Member
0 Kudos

Thank you all for the posting. What I really meant is that I need to get the variable name from an attribute of the element of the payload at the target side. So the file adapter needs to read it from the attribute.

I can nolt use the elements themselves as they carry other values.

Any idea?

Thank you.

Former Member
0 Kudos

I am again mentioning the same thing. In Variable substitution you cannot refer to the attribute of the element.

So only option remains either you write AM or use Dynamic Configuration and pass the attribute value as a input.

Thanks

Farooq.

Former Member
0 Kudos

The scenario is IDOC to FILE. I need to get the value of the receiving partner.

The message header has the node "DynamicConfiguration". Please see the xml below. I need to grab the key RCVPRN (0000002104) from this and pass as the file name in the receiver file adapter.

How do I setup my receiver file adapter for this? I tried changing the values for the variable, and also enabling the adapter specific message attributes. No solution yet.

<SAP:DynamicConfiguration xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">

<SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="RCVPOR">LXDCLNT250</SAP:Record>

<SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="SNDPRT">LS</SAP:Record>

<SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="RCVPRN">0000002104</SAP:Record>

<SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="SNDPOR">SAPLCD</SAP:Record>

<SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="SNDPRN">LCDCLNT220</SAP:Record>

<SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="CIMTYP" />

<SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="IDOCTYP">WPDBBY01</SAP:Record>

<SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="MESTYP">WPDBBY</SAP:Record>

<SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="RCVPRT">KU</SAP:Record>

</SAP:DynamicConfiguration>

Former Member
0 Kudos

Thank you all for your help. Finally solved with the following code in the UDF that writes to the DynamicConfiguration.

Code:

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

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

conf.put(FileName, a);

return "";