cancel
Showing results for 
Search instead for 
Did you mean: 

File adpater - ftp - Receiver scenario

Former Member
0 Kudos

Hello,

I have a scenario as follows.

Sender ---> RFC

Receiver -


> File (ftp)

<b><u>Based on the the value of an element in the data structure coming from RFC, I need to change file name in the file adapater.</u></b>

Now my question is how would I do (change file name) based on value an element in the sender RFC structure.

I am thinking while mapping we can some how make it happen through global variables. But I am not sure how?

I appreciate your help.

Thank you,

Balaji

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

Check out thus michal's blog....blog represents creating file with same name as input file name.

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

So rather than reading nput file name you can just assign value from RFC structure..

Nilesh

Former Member
0 Kudos

Nilesh,

Thank you for the information. I already looked at the blog and the blog is for file to file scenario.

In my scenario I am using RFC sender and File receiver. While RFC sender has the file name, I am not mapping file name to a attribute. I can use UDF to create FileName as part of Dynamic configuration in the SOAP header. However I need to map UDF to a attribute in the receiving structure inorder to complete mapping. Since I do not have a attribute to complete mapping how would I do this?

Thank you,

Balaji

Answers (2)

Answers (2)

Former Member
0 Kudos

Hey

u don't need to do anything in mapping,simply use Variable substitution and define the FileName.

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

Thanx

Aamir

Message was edited by:

Aamir Suhail

Former Member
0 Kudos

Thank you for the information. The variable subtitution is good as long as you have file name coming from header or XML structure. In my scenario I already tried with file name coming from XML structure. While doing this I ran into situation that file name is also written to file. The following is the XML sructure. I am not sure what File content conversion parameters (on Receiving file adpater) I need to use to have FileName not written to file. I do not want to write file name as content of the file.

<ns1:MT_Info_File xmlns:ns1="urn:http://freemanco.com/xi/info_list">

<TYPE>

<FileItem>

<FileName>DD11022007</FileName>

</FileItem>

</TYPE>

<DATA>

<LineItem> <LineEntry>234567891234567890123456789012345678901234567890</LineEntry>

</LineItem>

<LineItem>

<LineEntry>95473523647586969587265245437586979798376524253586</LineEntry>

</LineItem>

<DATA>

<LineItem></ns1:MT_Info_File>

In case if I have to write to header using UDF to store FileName as part of Dyanmic configuration in the SOAP header, I need to map UDF to an attribute. If I approach in this route the file name becomes part of message.

I am not sure how to resolve this issue.

Thank you,

Balaji

Former Member
0 Kudos

You can also Variable Substitution option in the File Adapter. Please find the below information which is also available in help.sap.com. Check out the second part of the information which explains how to read it from the payload.

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>