on 11-03-2011 9:53 AM
Hi Experts,
I want to create a scenario in which I want to have N number of target files based on some condition.
Suppose I have following Source structure .
<ns0:MT_Employee_Src xmlns:ns0="urn://FileToFile_ERD">
<Details>
<EmpId>1</EmpId>
<Name>Rabi</Name>
<Designation>ABAP</Designation>
</Details>
<EmpId>4</EmpId>
<Name>Satya</Name>
<Designation>ABAP</Designation>
</Details>
</ns0:MT_Employee_Src>
My requirement is I want to have 2 different target files based on EmpId.
And this should be dynamic that means N number of EmpId in my source will create N number of files.
Can anyone help me to solve this?
Any kind of suggestion will be appreciated.
Thanks
Rabi
hi,
Follow those steps
1) in the message Mapping go to Signature T..Outbounded.
2)later go back to main tab . you shoud create a mapping like this:
3)<EmpId>--> change the context to MT_Employee_Src. to do that press right button on the field and go to context menu option.
map this field to the proper header target structure E.X: MT_Employee_Tgt
4) doing this you will create as many target files as <EmpId> you receive.
5) map the rest of the fields
Let me know.
Rgds
RP-.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
Thanks for your replies.
This is solved now.
You people are really great.
Thanks
Rabi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
As my requirement was to create N files dynamically based on some condition so I first used 1:N multimapping without BPM.
Then I followed RP's steps.
Follow those steps
1) in the message Mapping go to Signature T..Outbounded.
2)later go back to main tab . you shoud create a mapping like this:
3)<EmpId>--> change the context to MT_Employee_Src. to do that press right button on the field and go to context menu option.
map this field to the proper header target structure E.X: MT_Employee_Tgt
4) doing this you will create as many target files as <EmpId> you receive.
5) map the rest of the fields
This is great.And this helped me a lot and finally gave solution.
I want to share one thing that I faced.
when you are doing 1:N multi-mapping then you have to change the occurrence of target .
Then your source and target structure will be changed .If you are taking the source schema from mapping then remove the extra tags those got generated due to multi mapping such as
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
- <ns0:Message1>
</ns0:Message1>
</ns0:Messages>
And then use the file and it will work fine.
Thanks
Rabi
content deleted... not the good post.... oups
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rabi,
Create the target structure such as you populate a seperate message payload for each detail of source. You can do it using
Multimapping by changing occurrence of target message to 0..unbounded.
Then use variable substitution for file naming. using
variable value as payload: MT_Target,1,Details,1,EmpId,1
Regards
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Priyanka,
I tried as you said .
But in the UDF it is showing error can't resolve the symbol under "conf".
Again I could not understand how to do configuration.
That means as I am creating files based on EmpId,so how many communication channels,Receiver determination,Interface determination I need to do.?
Any suggestions will be appreciated.
Thanks
Rabi
Hi.
You need one channel , basically if I understood you need multiples files based on XML source , so this requeriment can be solved by UDF to create dynamic files names.
Also in you CC you need to activate Advance Options Adapter Specific Message Attributes - File Name.
About UDF try this
try {
String sFileName ="";
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
sFileName = valueName[0] +".txt";
conf.put(key, fileName);
result.addValue(valueName[0]);
}
catch(Exception e)
{
return "";
}
Regards.
Lucho
Hi Rabi,
Use multimapping, change the occurrence of target message to 0..unbounded and map the target message like
empid>removecontext>sort>splitByvalueChange> UDF-->targetmessage
and write a UDF for creating filename for each empId....try with below logic for UDF. Else you can go for variable substitution as well.
String filename ="";
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
filename = var1[0]+".txt";
conf.put(key, fileName);
result.addValue(var1[0]);
And the execution type of UDF will be AllValues of Context.
Regards,
Priyanka
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please check the Blog Multi Mapping Without a BPM. That should address your requirement.
Regards,
Bhavesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
9 | |
9 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.