cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic file names in Proxy to FTP scenario

0 Kudos

Hello Community.

I have a proxy to file scenario with two receivers.

Receiver channels use file content conversion.

For the first receiver the file name has to be the value of a payload field in the source structure but this value can't be written into the target file, if I map it to the target structure, either XML validation or content conversion fails depending on where in the target structure I add the new field. So I can't use variable substitution to solve this.

For the other receiver, the file name has a complex structure with the organization name and the date formatted in "dd-MM-YY---HH:mm:ss".

For example: ORG-dd-MM-YY---HH-mm-ss.csv.

Processing parameter "File Construction Mode" lets me add the time stamp to the file name but not with the right format.

It would be great if any of you can help a little, I'm in a pinch now with these file names.

Thank you very much.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182412
Active Contributor
0 Kudos

Hi Juan,

You can create UDF using DynamicConfiguration as mention in below blog for both files.

Combining three different aspects of PI in one shot - Process Integration - SCN Wiki

Regards,

Praveen.

0 Kudos

Thank you very much Praveen.

It was exactly what I needed.

Answers (2)

Answers (2)

RaghuVamseedhar
Active Contributor
0 Kudos

Juan,

Please try this approach,

Add same receiver interface twice in Interface Determination.

Create two OM / MM.

UDF (Each mapping will have slightly different UDF).


public String udf_Dynamic(String var1, Container container) throws StreamTransformationException {

Map mapParameters = (Map) container.getInputHeader().getAll();

mapParameters.put(DynamicConfigurationKey.create("http://sap.com/xi/XI/Dynamic", StreamTransformationConstants.DYNAMIC_CONFIGURATION), "");

DynamicConfiguration conf = (DynamicConfiguration) mapParameters.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

//Use input var1 for First UDF and for Second UDF use Date format

DateFormat dateFormat = new SimpleDateFormat("dd-MM-yy--HH-mm-ss");

conf.put(key, ("NewDynamicName_" + dateFormat.format(new Date())) + ".csv");

return var1;

}

FYI.

You can reuse OM/MM with Parameterized Mapping Programs.

Link1, Link2.

engswee
Active Contributor
0 Kudos

Hi Juan

Do both receiver channels belong to the same receiver business system/component? In other words, are there two receivers in the Receiver Determination step (or Receiver tab in ICO)?

Rgds

Eng Swee

0 Kudos

Hi.

They belong to different receiver system/components, but that was not the issue.

I already solved with the dynamic configuration approach.

Thanks you very much.