cancel
Showing results for 
Search instead for 
Did you mean: 

How determine Value based on file pickup location/folder

Former Member
0 Kudos

Hi All,

I have an interface which is used for 2 different 3rd parties. The file formats, idoc etc are same for both the 3rd parties so using just the same interface. It is an File to IDOC interface. The only diff is that the incoming files are located in diff folders based on the 3rd party.

Requirement is that based on the file location we should be able populate a data filed in IDOC to help differentitate from where has the data come.

So if file is picked from folder A, then edidc-mescod = 'A'

else if the file is picked from folder 'B', then edidc-mescod = 'B'

Though I am using a single Message mapping but I am using 2 separate comm-channels for the 2 parties A,B involved. Appreciate if you could let me know if its possble to populate the IDOC field based on the file pickup location.

Regards

Shirin

Accepted Solutions (1)

Accepted Solutions (1)

santhosh_kumarv
Active Contributor
0 Kudos

Hi,

1. In the Sender File Communication Channel check the option Set Adapter-Specific Message Attribute and check the option Directory.

2. Use this UDF.

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

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

String Directory = conf.get(key);

if (Dirrectory.equals("A"))
return "A";
else
return "B";

Test it only by posting the file and not in the Test tab.

Thanks

SaNv...

Answers (3)

Answers (3)

Former Member
0 Kudos
Former Member
0 Kudos

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

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

String fileDir = conf.get(key);

if (fileDir.equals("A")){

return "A";

else

return "B"

//write if else as per your requirement

Map output of this UDF to edidc - mescod

Former Member
0 Kudos

Hi,

I tried using the UDF you had provided, but it returns the value 'null'.

To put it into perspective,

when I click create UDF, I selected the radio-button 'Cache'. Removed the input argument 'a' and then inserted your code. Activated fine but it returned the value 'null' when used in real-time file transfer..

Any ideas where I might have done it wrong.

Many thanks

Shirin

Former Member
0 Kudos

Make sure that you have selected Adapter Specific Message Attributes - File Directory in file sender adapter

Former Member
0 Kudos

Thankyou Mugdha and Santosh.

Its working fine now.

Many thanks for your help. Really appreciated.

Regards

Shirin

Former Member
0 Kudos

Hey

write a UDF using dynamic configuration and either use Sender_party(if thats unique) or Sender_service(if thats unique).

http://help.sap.com/saphelp_nw04/helpdata/en/b3/9a2aeb24dc4ab6b1855c99157529e4/content.htm

Thanx

Aamir

Former Member
0 Kudos

Hi,

Thanks for the reply. Do you have a sample UDF for this requirement. I unfortunately do not have any Java skills.

Appreciate if you could help.

Many thanks

Shirin