cancel
Showing results for 
Search instead for 
Did you mean: 

File to Proxy: reading filename from sender and map with target field

shabbir_mohmad
Participant
0 Kudos

Hi All,

I have following udf for getting file-name from sender, but how to map and what is the input field I have to give.

As udf expects input, what is the input field I have to pass.

I have taken field (random input) mapped one input field as below and used udf shown in below picture.  Please suggest if it is correct.

UDF is:

---------------------------------------------------

Accepted Solutions (1)

Accepted Solutions (1)

shabbir_mohmad
Participant
0 Kudos

Hi All,

I just have doubt here that what input I have to pass to function.

I only need filename on target side.

shall I map:

constant --> function  ---> target like below:

former_member184720
Active Contributor
0 Kudos

Yes.. you can.

Don't forget to enable the adapter specific attributes for filename in the sender channel

Former Member
0 Kudos

Hello,

If u just want to read filename and pass it to one of the fields in ur proxy then u don't need to pass any input to ur UDF.

So ur UDF will be:

String filename    = "";

DynamicConfiguration conf1 = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create( "http:/"+"/sap.com/xi/XI/System/File","FileName");

filename = conf1.get(key1);
return filename;

Mapping:

UDF -> Target Field

Thanks

Amit Srivastava

Answers (1)

Answers (1)

former_member184720
Active Contributor
0 Kudos

Hi SP - I dont think it works. you are not getting the file name in the above method.

Use the below UDF and pass any input or map it with constant.

String filename    = "";

DynamicConfiguration conf1 = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create( "http:/"+"/sap.com/xi/XI/System/File","FileName");

filename = conf1.get(key1);
conf1.put(key1,filename);
return filename;

Source : http://scn.sap.com/thread/3156237

shabbir_mohmad
Participant
0 Kudos

Thanks Hareesh.

I will try mapping constant as input and will let you know.

former_member184720
Active Contributor
0 Kudos

just FYI.. you can even remove the argument that way no need to pass any constant