on 07-10-2013 11:02 AM
I often have the challenge to deal with context differences in mappings if something has to repeat in the target that was on a higher level in the source. So far I have been able to solve most of it using use-one-as-many and latest since PI 7.1 and 7.3 I have been so happy to use mapping variables since this approach is much simpler, but now I have a new challenge that would normally push me to use a stylesheet mapping instead, but I really would like to find out if it is possible to do this with the graphical mapping:
My source looks somwthing like this (marked the interesting part with red😞
<Style>
<Header>
<Flags>
<Flag>
<Code/>
<Reason/>
</Flag>
<Flag>
<Code/>
<Reason/>
</Flag>
<Flag>
<Code/>
<Reason/>
</Flag>
</Flags>
</Header>
<Details>
<Detail>
<BarCode/>
</Detail>
<Detail>
<BarCode/>
</Detail>
</Details>
</Style>
My target should then look like this (again marked the interesting part with red😞
<Skus>
<Sku>
<BarCode/>
<Flags>
<Flag>
<Code/>
<Reason/>
</Flag>
<Flag>
<Code/>
<Reason/>
</Flag>
<Flag>
<Code/>
<Reason/>
</Flag>
</Flags>
</Sku>
<Sku>
<BarCode/>
<Flags>
<Flag>
<Code/>
<Reason/>
</Flag>
<Flag>
<Code/>
<Reason/>
</Flag>
<Flag>
<Code/>
<Reason/>
</Flag>
</Flags>
</Sku>
</Skus>
As you can see, this time I need a whole structure to repeat at a lower level.
For each 'Sku' the whole flags part has to repeat because the target application does not have a header level, only Sku level.
Has anyone come across something like this and did you manage to solve it using a graphical mapping ?
We are currently on PI 7.3 (dual stack) and there are quite a lot of new features since our 7.0.
Best regards Soren
Hi Soren,
The requirement below seems more about how to link the Flag to the Detail. Is Flag-> Code and Detail-> Barcode same ?
More than the technical solution, I think the question should be how is header and detail related. Once you provide that input, technical solution can follow
Ambrish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ambrish,
Yes I know it is a bit unclear.
The message is a product (style) with belonging details (sku variations).
For the product there are header fields that apply to all the product skus and then there are a number of skus (detail) with information that applies to the individual skus (in real life more than in the example).
One of the header informations is a list of flags for the style, and this list contains pairs of a flag code and the belonging reason text. Problem is that it is not fixed, there could be 2, 3, 10 whatever flags (0..unbound). But in the receiving system they do not operate with the term 'product' as we do, they only have skus. So I need to replicate the list of flags down at sku level (corresponding to my source 'detail' level) and repeat it for each sku.
It is not to complicated with stylesheet but I was currious if graphical mapping can also do this.
For single values I either use use-one-as-many or a mapping variable. But for a whole structure I am a bit lost 😉
Soren
Hi Soren,
This can be simply achieved with the useOneAsMany function, check more about it here:
http://help.sap.com/saphelp_nw04/helpdata/en/ef/df564b6aa24fc9ab0d685460747de5/content.htm
http://wiki.sdn.sap.com/wiki/display/XI/Explain+node+functions
Regards,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Grzegorz,
Thanks for the fast reply.
I know the use-one-as-many but I do not think it can do this specific mapping or if, at least, I do not know how to.
Maybe I was not specific enough but in the normal cases you are mapping single values from the header to be repeated in the lower level, that's fine. But here I have a repeating section (0..onbound) containing pairs of fields. The whole section of repeating pairs should be copied for each and every Sku that is also (0..unbound).
How do you use use-one-as-many with a first argument node that itself is
a repeting (0..unbound) node ?
Sounds more like a use-many-as-many...
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
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.