cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic file name using FTP adapter

Former Member
0 Kudos

I was trying the dynamic filename scenario taking help from Michal's blog https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2664. [original link is broken] [original link is broken] [original link is broken] [original link is broken]

If I check the 'adapter specific properties' in both sender and receiver file adapter,then in output I am getting the output filename as same as input filename without using the UDF.

When I used the UDF in mapping,it had absolutely no effect. I am not clear what is the use of the UDF. please let me know where to use the UDF and how to use it.

Thanks

Smith

Accepted Solutions (1)

Accepted Solutions (1)

former_member335553
Active Contributor
0 Kudos

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.You can get dynamic filename in UDF in msg mapping....just in ID in comm channel select adapter specific attributes -> filename.....then whatever dynamic name you will create in UDF will be the target filename.....

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

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

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.

Former Member
0 Kudos

So my understanding from Anu's answer is:

1. If u want to keep the output filename same as input filename, no need to use the UDF. only the 'adapter specific parameters' in both sender n receiver file adapter will do that.

2. If u want to generate an output file taking some input from the payload,then u hav to use the UDF.There u hav to populate the name.

Correct me if I am wrong.

Former Member
0 Kudos

Hi -

<i>>>>1. If u want to keep the output filename same as input filename, no need to use the UDF. only the 'adapter specific parameters' in both sender n receiver file adapter will do that.</i>

Correct. Absolutely no need for UDF for this simple case.

<i>>>>2. If u want to generate an output file taking some input from the payload,then u hav to use the UDF.There u hav to populate the name.</i>

Pretty much.... if you set an attribute from the sender side, for example, you can use a UDF and access the particular attribute sent and use it in the mapping. In another example, where no attributes are sent from the sender, you can still actually set a particular attribute, say a filename derived from the payload, using a UDF, and enable the receiver attribute to use it. That's where the UDFs come in - either to get or set particular adapter specific message attributes.

Regards,

Jin

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

The use of the UDF already explined by michal in his blog itself,

to get the sender file name to the receiver side, first you need to take the file name from sender side to the payload and that will get to reciever side .

You would have to map this UDF from left side root node to target root node.

and in receiver side select the Filename under Adapter specific attributes.

Regards

Chilla

Former Member
0 Kudos

Hi Smith,

Have you tested your mapping in the 'Test' Tab in Graphical mapping? Does it work there?

Regards,

Amitabha