on 02-08-2010 7:49 PM
Hi All.
My requirement for this PI Mapping has the following. A root node (E1IDPU1) has a document name and document number. This also has a child node (E1EDP02) that can occur 5 times and in it a qualifier and belnr that occurs once in each instance.
We need to map either the qualifier from the child to the target field if the qualifier is "071" in any of the instances or if it doesn't then take the document number from the root. Problem i have is how do get this number if the process is done once, checking all the fields.
I have the mapping complete with an IF-THEN-ELSE clause that checks the constants for these but it will only evaluate the qualifier fine taking the belnr, my ELSE doesn't take the document number in the event qualifier does not exist.
Do help, it will be appreciated.
Darren.
Use the below mapping logic:
Qualifier -->
--> equalS --> ifWithElse(Then --> Qualifier) --> Target
Constant(071) --> (Else --> DocumentNumber)
You have to take care of the following:
1) Since root node for Qualifier is repeating (i.e. qualifier will have multiple instances) you will have to raise the context of Qualifier node to a higher node (in mapping editor section --> Qualifier --> Right-click --> Context --> Raise it to higher level)
OR
2) make use of standard functions like RemoveContext/ CollapseContext etc (blogs available easily)
3) Since DocumentNumber is occuriung only once no need to play with its context.
Context change will ensure that all instances of Qualifier are checked.
Regards,
Abhishek.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Darren,
Could you please provide a sample input/output so that we can visualize it better?
Regards,
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 the response. Sample input is as follows. Root Node : E1IDPU1 -> DOCNAME : INV, DOCNUMMR : 90022 -> Child Node : E1EDP02 -> QUALF : "009", BELNR : 90022765, QUALF : "071", BELNR : BOECCYYMMDDAAA0000000, QUALF : "010", BELNR : 5300002439
To be evaluated as follows : In example there 3 instances of the Child Node. The Mapping must check if any of these child nodes has the QUALF "071" and if so take its respective BELNR. If none has the QUALF "071" then go and use the Root Nodes DOCNUMMR, whatever that may be.
Thank you I will try your suggestions for now and let you know. If this makes sense do provide more feedback.
Darren.
Hi Abhishek. Thanks for that. So far so good. Here's what i have.
IF (DOCNAME="INV) -> Then IF (QUALF="071) Then BELNR -> TargetField
ELSE (DOCNUMMR) -> TargetField
This works fine for the QUALF being 071 but the else condition is failing when there's no QUALF and the DOCNUMMR is needed to be passed.
Do i still need context changes on BELNR or DOCNUMMR in this case?
Hi Darren,
I believe you are only passing one value to the target node. That may explain why you are having the error:
You can try using this mapping:
QUALF ----> replaceString --> removeContext --> sortByKey:numerical ascending -----------------------------------> \
Constant:071 --> / / / \
Constant:71000000 --> / / \
BELNR ----> removeConext ------------------------------> / \
\
QUALF ----> replaceString --> removeContext --> sort:numerical ascending --> collapseContext --> equalsS: 71000000 --> ifThenElse --> TargetField
Constant:071 --> / / /
Constant:71000000 --> / /
/
DOCNUMMR --------------------------------------------------------------------------------------------------------> /
The replaceString with constant 71000000 is there to ensure that 071 gets the highest number when the sorting function is called.
Hope this helps,
Edited by: Mark Dihiansan on Feb 9, 2010 9:39 AM
This works fine for the QUALF being 071 but the else condition is failing when there's no QUALF and the DOCNUMMR is
needed to be passed.
What do you mean when you say QUALF is not passed? Does the node occur with blank input or does the node not occur at all?
If the QUALF node itself is not occuring then the mapping wont result into anything....something must be passed to the if part.....if the node is not occuring then make use of some logic (mapWithDefault function....QUALF >mapWithDefault> rest of logic remains same)....this will ensure that DOCNUMMR will be passed in case QUALF is not equal to 071 or even if QUALF does not exist.
Regards,
Abhishek.
This should be your mapping logic:
QUALF --> mapWithDefault -->
--> equalS --> ifWithElse(Then --> BELNR) --> Target
Constant(071) --> (Else --> DOCNUMMR)
You have to raise the context of QUALF and BELNR....do not change the context of DOCNUMMR.
Adding mapWithDefault also so that even if no QUALF node occurs in source structure, the mapping will get executed.
Regards,
Abhishek.
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.