Skip to Content

How to populate a value from source node if a condition in child node is true in mapping

Hi,

I have my source idoc as below, where E1WPA01 is the parent node and you have many E1WXX01 child nodes in it.

Now if a condition for the fields in the E1WXX01 is true then we have to populate a field from E1WPA01 in target structure and if the condition fails we have to populate a blank value. I am able to populate the field from E1WPA01 if the condition is true but when I try to populate the blank value the mapping fails(using else condition)

In the above FLDGRP,FLDNAME and FLDVAL are from child node E1WXX01 and ARTIKELNR is from E1WPA01. Now can you please help me to populate the blank value if the condition fails?

Thanks

source idoc.JPG (81.6 kB)
mapping.JPG (42.7 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Jul 29, 2016 at 01:28 AM

    Hi Richa!

    At first sight I can suppose that you have wrong contexts count in your If and Then queues.

    In If condition you have context change after each element in queue but in Then condition with UseOneAsMany you have all elements for E1WPA01 segment in one context.

    So you can use "IfThenElse" finction with constant value in "Else" condition, but try putting "SplitByValue" finction after "UseOneAsMany".

    Regards, Evgeniy.


    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 28, 2016 at 06:04 PM

    Richa,


    if the condition is true but when I try to populate the blank value the mapping fails(using else condition)

    What error you get when you have else condition ? is it failing in the udf which is present after ifthen if yes then can you please let us know what exactly this udf is doing.

    Br,

    Manoj

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Manoj,

      The udf which is present after if then condition is used to just remove suppress values.

      Here in my case for each E1WPA01 only one condition from E1WXX01 segment will be true. So, if the condition is true then it populates the ARTIKELNR from E1WPA01 correctly. But if is fails it has to populate the blank value, so when I am giving constant in else condition, it is checking all the other E1WXX01 segments and populating suppress values.

      My sap system is down right now. I will give the queue how the values are coming as soon as it is up.

      Thanks

  • Posted on Jul 28, 2016 at 06:29 PM

    Hi Richa,

    In order to populate a blank value for the else you would need to switch the boolean usage to if/then/else instead of if/then. In that case you would set a blank value constant for the else condition.

    Regards,

    Ryan Crosby

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 29, 2016 at 10:41 AM

    Hi,

    I could solve this with using Not condition(i.e to populate blank value) in if and actual mapping in else part.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.