cancel
Showing results for 
Search instead for 
Did you mean: 

file name in file adapter

milan_10
Participant
0 Kudos

Hello Guys,

I need to get a message from RFC, map it in a way that I wouldn't need to do any file conversions in file adapter and send it to FTP. How could I set the file name in this case?

PS: the file name cannot be included in payload, while I don't want to do any conversations of that payload...

Many thanks for your answers,

Milan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Milan,

Is your query related to sending the file name from the source xml document to the reciever file adapter. If so this can be achieved.

Pls. do the following.

1. in the mapping program that you are using populate the filename coming from the source into the target in any of the fileds.

2.Sender adapters can write adapter-specific attributes to the message header; these can then be evaluated at configuration time

3. To change the adapter-specific attributes of the message header by using message mappings, you access the required classes of the mapping API by using a mapping runtime constant.

To access the classes DynamicConfiguration and DynamicConfigurationKey by using the mapping runtime constant DYNAMIC_CONFIGURATION, use the method getTransformationParameters() of the container object.

Create an simple user defined function in the mapping and use the following code.

Imports: com.sap.aii.mapping.api.*;

Parameter: String filename

Paramter: String filename;

filename = fileName + ".DAT";

DynamicConfiguration conf = (DynamicConfiguration) container

.getTransformationParameters()

.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

conf.put(key, filename);

return filename;

You donot need to hard code the value of the filename in the file adapter for your interface.

In SXMB_MONI, when you see the pipeline services you would see that the value of the filename is populated in the message payload.

Thanks

Indranil

milan_10
Participant
0 Kudos

Hi Indranil,

I'm exaclty on the same way, but the problem I'm trying to solve is:

I have this line in dynamic configuration:

<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="file">testfile.txt</SAP:Record>

so I try to set the file name in file adapter as variable and latter in variable substitution set the value of this variable to this value in dynamic conf...???

Thanks,

Milan

Answers (5)

Answers (5)

Former Member
0 Kudos

You don't need to assign any variable for this. When the call adapter will be called it will access the message related attributes from the SOAP message header.

Only in the adapter for your scenario you need to check the 2 properties that is there under Adapter - Specific message properties. these are:

1. Set Adapter - specific message properties.

2. Filename.

3. Directory (Incase you want to make this dynamic too ).

The filename generated using this UDF will help the adapter to inherit the filename into the adapter settings.

milan_10
Participant
0 Kudos

Could I set/save the file name in message header and then use message variable in file adapter???

Former Member
0 Kudos

Hi,

for dynamic File name see below links

/people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i - Dynamic File Name Part 1

/people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii - Dynamic File Name Part 2

https://media.sdn.sap.com/javadocs/NW04/SPS15/pi/com/sap/aii/mapping/api/DynamicConfiguration.html

Regards

Chilla

milan_10
Participant
0 Kudos

Hi,

I cannot set the file name with the standart way like add counter and so on.... Think in a way that I get a file name in incomming message from SAP, but because of mapping I lost this info there. So I will need to store this file name between inbound and outbound adapter processing somewhere...???

Milan

Former Member
0 Kudos

Hi,

You can dynamically set the file name from the source XML. Pls see:

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

In addition, if the filename is to be derived and does not exist in the source XML, then you can also use user-defined function to dynamically set the file name. Pls see the blog which uses HTTP as an example, but you can apply it to the file/ftp adpater:

/people/william.li/blog/2006/04/18/dynamic-configuration-of-some-communication-channel-parameters-using-message-mapping

Regards,

Bill

prabhu_s2
Active Contributor
0 Kudos

in the file adapter u can give a file name and no file conversion. this will store the message in the xml format

prabhu_s2
Active Contributor
0 Kudos

check this blog on rfc-file scenario:

/people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit

Former Member
0 Kudos

Hi,

The filename can be set in the Comm Chan configuration. You can have a set file name and append a counter or a datetime stamp or msgid to the file name.

Regards,

Bill