cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member190293
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Hi Evgeniy,

I used split by value after use one as many and now I am able to see the values in display queue of my target structure but when I test it I cannot see the values in the field at run time. My mapping is below:

Thanks

former_member190293
Active Contributor
0 Kudos

Hi Richa!

Please provide your target message structure.

Regards, Evgeniy.

Former Member
0 Kudos

Hi Evgeniy,

My target structure is below. My field for this mapping "AssociationGrpId" is under Data_1.

    

when I test it in test tab the field is populating with only blank values but not the required value when the condition is true.How ever in display queue I can see the values.

my target structure after testing in test tab.

Thanks,

Richa.

former_member190293
Active Contributor
0 Kudos

Hi Richa!

It looks like you have incorrect sequence of elements in your output queues for Data_1 and AssociationGrpId.

As I can see from your mapping you must have Data_1 output queue without context changes and AssociationGrpId output queue with context change after each item.

Please check if your element's indexes in both queues are equal: first element of Data_1 queue - element from first context of AssociationGrpId queue, second element - value from second context and so on.

Regards, Evgeniy.

Former Member
0 Kudos

Hi Evigeniy,

My Data_1 output queue:

As you said it does nt have any context changes.

My AssociateGrpId display queue:

It has context changes as you can see above. Now what should I do?

I have mapping for other fields and it was working fine..but for this field it is behaving strangely.

Thanks for your help in advance,

Richa

former_member190293
Active Contributor
0 Kudos

Hi Richa!

It's hard to suggest further without seeing your mapping in a whole. I would try to set "Keep SUPPRESS values" in IfWithoutElse function in your E1WPA01 to Data_1 mapping if it's not set and see what happens.

Regards, Evgeniy.

Former Member
0 Kudos

Hi Evgeniy,

I am thinking of writing UDF for this instead of graphical mapping and see how it works.

Will let you know after I test it.

Thanks,

Richa.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

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

Ryan-Crosby
Active Contributor
0 Kudos

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

manoj_khavatkopp
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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