cancel
Showing results for 
Search instead for 
Did you mean: 

File-Adapter: Variable substitution form payload XML-attribute

Former Member
0 Kudos

Hi experts,

is possible to use XML-attribute-content for variable substitution in file-Adapter?

extract from XML:

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

- <all>

- <transaction <b>file="filename"</b>>

- <table name="BPAADDRESS" options="insertIfUpdateFails">

- <record id="1">

<hkeycol name="BPAMAINHKEY">0010500345</hkeycol>

<hkeycol name="USAGE">Invoice</hkeycol>

.....

</transaction>

I want to get the value "filename" = attribute file of transaction.

Is this possible?

Thanks a lot,

Florian

Accepted Solutions (1)

Accepted Solutions (1)

justin_santhanam
Active Contributor
0 Kudos

Florian,

I'm not sure whether its possible in Variable substitution , but u can achieve the same using ASMA. Are u using any mapping in ur sceanrio?

raj.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Raj,

yes I tried with adapter specific attributes but I can not use this in a multi-message scenario (1:n) = message split.

In this scenario dynamic configuration is valid for <b>all message header</b> of the new messages. It is not possible to write different adapter specific attributes for each message (compare documentation)

<a href="http://help.sap.com/saphelp_nw70/helpdata/en/43/09b16006526e72e10000000a422035/frameset.htm">http://help.sap.com/saphelp_nw70/helpdata/en/43/09b16006526e72e10000000a422035/frameset.htm</a>

Any other idea?

Thanks a lot,

Florian

Former Member
0 Kudos

I have done this taking a field from the XML.

You have to map the location of the field within the XML...

Taken from:

http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/frameset.htm

Variable Substitution (Target Directory/File Name Scheme)

If you set the Enable indicator, you can enter variables for the Target Directory and File Name Scheme. Enter the names of the variables and references in the table.

&#9679; Enter each variable that you reference in the Target Directory and File Name Scheme fields without the surrounding percentage sign under Name of Variables in the table.

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

&#9675; If the variables are to refer to an attribute of the message header, add the prefix message: to the name of the variable under Reference. You can specify the following attributes of the message header:

sender_party, sender_service, receiver_party, receiver_service, interface_name, interface_namespace,

message_id (message ID with hyphens, for example 9fbe1ff1-9a0d-11d9-8665-cbf10a126331)

message_id_hex (message ID in hexadecimal format, for example 9fbe1ff19a0d11d98665cbf10a126331)

For example, if you want to specify the interface name from the message header in the target directory or in the file name scheme, enter message:interface_name as the reference.

If one of the message attributes contains characters that are not permitted in a file name, for example \, /, :, *, ?, ", <, >, |, then these characters are replaced by an underscore ("_").

&#9675; If the variable refers to an element in XML schema, add the prefix payload: to the information under Reference. The reference then comprises a pseudo path description in the form of a comma-separated list with the schema namea,na,nameb,nb,....

namea,nameb,... corresponds to the element name and na,nb,... corresponds to the occurrence of the element name at the respective level in the document.

The description begins at the root of the document and ends at the respective element.

To reference the element that is in bold in the example, the following expression is used: payload:root,1,e1,1,e2,2

The parser searches for the first occurrence of the root element at the first level. It then searches for the first occurrence of e1 at the second level and for the second occurrence of e2 at the third level. The content of the last element (“Example Value”) is set as the value for a specified variable.

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

<root>

<dummy>

<e1>

<e2>Data_1</e2>

<f/>

<g attr="abc">text</g>

<e2>Data_2</e2>

</e1>

</dummy>

<e1>

<e2>illegal/value</e2>

<f/>

<g attr="abc">text</g>

<e2 attr="fghij">Example Value</e2>

</e1>

</root>

&#9679; To disable the check the adapter performs for the element data, set the Disable Security Checks indicator.

Otherwise, the adapter checks whether the element data contains characters that could lead to security risks in the file system environment. The check includes the characters “/“, “\“, and “..“.