cancel
Showing results for 
Search instead for 
Did you mean: 

IDOC Mapping with field determination

0 Kudos

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.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member200962
Active Contributor
0 Kudos

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.

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Darren,

Could you please provide a sample input/output so that we can visualize it better?

Regards,

0 Kudos

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.

former_member200962
Active Contributor
0 Kudos

The above mentioned logic will work...just instead of Qualifier, map BELNR (again context needs to be handled) to the Then of IfWithElse function.

Regards,

Abhishek.

0 Kudos

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?

markangelo_dihiansan
Active Contributor
0 Kudos

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

0 Kudos

Hi Mark. Will give this a bash and let you know how it goes.

Thanks.

Darren.

0 Kudos

Hi Mark. I am sending you a mail with a screenshot of what i have done. The value being passed is the DOCNUMMR only. Let me know what alternatives may be attempted.

Darren.

former_member200962
Active Contributor
0 Kudos
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.

0 Kudos

Hi Abhishek. I meant to say if any of the repeating QUALF's didnt contain String 071 then it would not pass the DOCNUMMR field.

Sorry about that. Let me know if this is okay, i will give your solution another try as well as Mark's.

Thanks again.

Darren.

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Darren,

Have you tried to do the mapping exactly as what I have posted? If not please do, it seems you have added additional nodes to it.

Hope this helps,

0 Kudos

Hi Mark. I have adjusted to exactly as your requirements and still get the result for DOCNUMMR only.

Does this also need context changes on the field values themselves?

Thanks mate.

former_member200962
Active Contributor
0 Kudos

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.