cancel
Showing results for 
Search instead for 
Did you mean: 

How to read a file name and send it a particular reciever

Former Member
0 Kudos

Hi,

I have a scenario, where i am receiving a a file and based on the file name i have to decide who is the receiver and send it to that particular receiver.I do not have to do any mapping.

can someone suggest me how can I achieve this.

Thanks in advance.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

>>where i am receiving a a file and based on the file name i have to decide who is the receiver

If the filename is coming within the payload itself(to which i doubt)you can simply give condition in conditional receiver determination(no message mapping required) and branch off the messages.

But if you are not getting the filename within the payload,then you need to get filename via UDF and use this UDF to branch off message in conditional receiver determination(message mapping required),you might need to use extended receiver determination in this case.

Thanx

Aamir

Former Member
0 Kudos

Use Extended Receiver Determination. Create second mapping in between source and Receiver message. In that mapping get the fileName and pass it to the receiver or call that receiver.

Thanks

Farooq

Former Member
0 Kudos

Hi ,

Mine is a bypass scenario so how can i achieve it without Message mapping. Moreover i cannot read the contents of the file too. Only on the basis of filename , i have to route it to the specific Business service. Kindly explain in details.

Thanks in advance.

Former Member
0 Kudos

Without Mapping it is very difficult to route the message based on the name of the File. As I know you cannot apply this logic directly in the Receiver

Determination Conditions.

Better solution is to use Enhance Receiver Determination. [|]

In the second screen shot of the above blog, you can take any dummy MT and at the target select MT Receiver (describe in the blog). Then create the UDF and get the File Name. Based on that File name map the Receiver Business Service (using FixedValues or ValueMapping or Lookup)

Thanks

Farooq.

Former Member
0 Kudos

Hi ,

I am not receiving the filename in payload.

Shabarish_Nair
Active Contributor
0 Kudos

you will have to do a generic mapping.

Create a java mapping. One node will ahve all the file content and the second will have the file name.

use the dynamic configuration to get the file name into that node.

The in RD u can build your logic to route the message.

Former Member
0 Kudos

>>>I am not receiving the filename in payload.

Even though you can read the file name from Adapter Specific Message Attributes using Dynamic Configuration (as suggested by Sbrish).

It is not required to read the payload. Just create the UDF (without any input) and write the code:

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

String ourSourceFileName = conf.get(key);

return  ourSourceFileName;

Now you have file name...and based on that you can route the message.

Refer this Blog : https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2664

Thanks

Farooq.

Former Member
0 Kudos

Hi ,

I cannot read the file contents . Please tell me without reading the file contents how can i bypass the file to a particular receiver.

Thanks in advance

Former Member
0 Kudos

>>I have a scenario, where i am receiving a a file and based on the file name i have to decide who is the receiver and send it to that particular receiver

In this case you need to read the FileName

>>cannot read the file contents

If you need only file Name then no need to read its contents.

Thanks

Farooq.

Shabarish_Nair
Active Contributor
0 Kudos

use adapter specific properties and in the mapping you will get the file name. Based on that you can build the logic to route it to the req. receiver.

Ref: - you will find how to get the file name in the mapping

Former Member
0 Kudos

HI This may help you.Let me know if not.