on 06-21-2018 8:37 AM
Hello Team,
We are integrating S4H on Prem and C4C System using CPI.
There has been an upgrade in an interface from C4C end and so certain fields are added and require to be mapped.
I have tried many steps but it isn't working and CPI's mapping simulation is pretty basic.
Can you guys suggest me a solution on this. Tried many workarounds. Still didnt get the desired result. My requirement is this:
Based on FIeld 1's value. I want to map to different targets.
If Field1 is lets say A. Field 2 should be mapped to ParentA_2
if Field1 is B. FIeld2 should be mapped to ParentA_3.
Since the context of Field2 and ParentA_2/3 are different. I want Field2 to map ParentA_2/3 atleast once.
Eg. Field1's queue
C
D
A
F
B
For the third n fifth occurrence I want Field 2 to be mapped to ParentA_2 and ParentA_3.
Attaching sample input and output file.
Any assistance would be greatly helpful.
Regards,
Abraham.
input-copy.txt
Hi Morten,
I removed all the mappings and used only graphical mapping to connect PartyRoleCode to SalesMan to check my theory.
Turns out only first value in the queue is getting assigned. After the first value in the queue getting assigned to SalesMan it doesn't get called again to assign second value to Salesman.
Regards,
Abraham.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abraham
I'm not entirely sure about the cardinalities of your elements (but describing mappings precisely in a human-readable format is very hard!).
If you could post an example input document and its corresponding output document, that would help a lot. But please keep them as small as you can!
Generally speaking, you should probably consider which mapping tool you choose to solve this. Using XSLT, this is not a hard problem at all. But if you don't know XSLT, it does have quite a learning curve.
I recently wrote a blog post about Cloud Integration's mapping tools. That will give you an overview of what you have available, and when to use each tool.
Regards,
Morten
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Morten,
Thanks for the suggestion and I did look into your blog before posting my question. As we are nearing deadline. I'm obliged to complete soon. Hence the rush.
As you suggested I have updated my question with attachments which provides more clarity.
As always, appreciate the help from community.
Regards,
Abraham.
Right, okay. This you can actually achieve fairly easily in message mapping. I would do it in a custom function. Here's my code:
import com.sap.it.api.mapping.*
def void filterRoles(String[] partyRoleCode, String[] partyInternalId, String[] roleToFind, Output output, MappingContext context) {
def index = Arrays.asList(partyRoleCode).indexOf(roleToFind[0])
if (index == -1) {
// That role is not in the input document. If that's an error, raise an exception. If not, maybe add a default value.
} else {
output.addValue(partyInternalId[index])
}
}
Map as follows:
And the same for SalesSupervisor, but with the constant updated, of course.
Note that the PartyRoleCode and PartyInternalID fields have the SalesArrangement context.
The code assumes that every PartnerFunctions element always contains both a PartyRoleCode element and a PartyInternalID element. If not, the logic breaks down.
Regards,
Morten
Yeah sorry. CPI user auto logged in.
It seems that this is getting executed only once for the first occurrence of PartyRoleCode. Does it have to do with their context being different .
And whenever ZE comes as like second or third in the queue. It only takes the first value and assigns Sales Man as a negative value .
Any way I can execute this mapping n times if partyrolecode value exists.?
Regards,
Abraham.
Hi Morten,
I removed all the mappings and used only graphical mapping to connect PartyRoleCode to SalesMan to check my theory.
Turns out only first value in the queue is getting assigned. After the first value in the queue getting assigned to SalesMan it doesn't get called again to assign second value to Salesman.
Regards,
Abraham.
User | Count |
---|---|
76 | |
10 | |
8 | |
6 | |
6 | |
5 | |
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.