on 04-11-2012 9:36 AM
Hi,
I have a File to File scenario with no mapping involved. A file from a single source has to be sent to one of the 4 receiver locations based on the source file name. How do i achieve this using Variable Substitution or any other method ?
I do not prefer to create 4 receiver communication channels for receiving the data, since it will be complicated when i need to add more receivers.
Your help would be appreciated !
Hi,
When you have no mapping involved, then Variable Substitution is a good choice. It will let you achieve your goal with a single receiver communication channel, as you require. See a nice example of Variable Substitution configuration here: http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=272171407
Let me know if you had further detailed questions.
Hope this helps,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks for the replies.
I am currently doing the below configs,
Target Directory : Interface/XI/%DIR%
File Name Scheme : SampleFile_%Filename%.txt
In Variable Substitution,
Variable Name Reference
Filename IN,AU,UK,DE
DIR DBA,SAR,EKY,QUR
Please tell me if i am doing something wrong, i don't use IR objects in my scenario since i don't have any mapping.
Hi,
Your config of Variable Substitution doesn't seem correct. You do not provide the list of possible values as the Reference, but rather something similar to an XPath expression that defines from which field of the XML payload the respective value should be taken. See "Defining Variables for Elements in the XML Schema of the Payload" here: http://help.sap.com/saphelp_nwpi71/helpdata/en/44/6a316af5a23672e10000000a114a6b/content.htm
It gives more details about how to build those expressions.
Hope this helps,
Greg
I'm a bit confused on my particular scenario. I do not see, how i can read a particular file name and send that to the appropriate directory.
For example, i get a file called Name1.txt and it has to be sent to DIR1 and if i get a file called Name2.txt, it has to be sent to DIR2. how do i achieve this and what should be the correct entries in my communication channel.
OK, a little more explanation, here it goes The Variable Substitution enables using particular fields of message payload, or some message "general" attributes, to create the target file name. So you define a variable, that will be supplied with a value automatically during message processing (based on the expression defined) and you use this variable in the file name scheme or directory name.
I guess what you also need to understand is, that you can only assign a value that appears somewhere in the message payload. For instance, if you want to put one of the values: IN,AU,UK,DE, into the file name, this value has to be present in the payload. Now for some example payload:
<root>
<child>
<field1>UK</field1>
...
</child>
</root>
Your expressions looks like that: payload:root,1,child,1,field1,1. At runtime, PI will examine the target XML message payload, searching for a value root/child/filed1, take that value and place it in the file name, as you defined: SampleFile_%Filename%.txt.
Hope this helps,
Greg
Hi,
I have one more suggestion, in this case (file to file pass through scenario where no mapping is involved) u can also opt for adapter module (a few lines code will help u)
chk my wiki:
this wiki shows how to set file name dynamically but u can also use the same for setting the directory (re adjust this code)
Thanks
Amit Srivastava
Message was edited by: Amit Srivastava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
You can achieve this using the run OS script after message processing e.g dump in just a single folder and then let the OS script move the files to its respective directory based on the filename.
Hope this helps,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mark,
This is also a solution to consider, but I would recommend it only if respective values are not available in the payload, for the following reasons:
Regards,
Greg
Hello Grzegorz,
Yup, true, what you said is correct. My suggestion was based on the statement made by Sherin earlier
"I do not see, how i can read a particular file name and send that to the appropriate directory." So, I just assumed that he is not passing the filename as a field in the payload.
As always, thanks for your inputs
Regards,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.