cancel
Showing results for 
Search instead for 
Did you mean: 

Help with mapping of iflow

sinaei
Contributor
0 Kudos

Dear All,

Hope you fine,

I have a qustion about the logic of mapping for a field. My data is like below:I have more than one Item, and More than one E1EDP26 in each Item.

I want to say if Qualf = 003 exist in the Item, write BETRG value of that in the target(here 9.36), otherwise write 0.

Can anyone help me how can I write it?

The important thing is that, I want if not exist replace 0 as target,

Thanks a lot

Sin

Accepted Solutions (1)

Accepted Solutions (1)

ambrish_mishra
Active Contributor
0 Kudos

Hi

You need to look at 2 conditions.

The condition with which you are creating the line item E1EDP01 and the condition needed to creation of E1EDP26 with qualifiers. Both have to work in conjunction and with context handling.

E1EDP26 are not multiple here since each will have a different qualifier.

Once you understand this, mapping will get easy.

Ambrish

sinaei
Contributor
0 Kudos

Hi Ambrish,

Thanks for your reply,

I know these conditions, exactly my E1EDP26 is not multiple, is just single, based on the qualifier, but my problem is I can not say If is not exist, put "0.00" as value.

With createIf I can handle it easily, but I need to set it as Zero if the related qualifier does not exist. So I can not use Exist or CreateIf.

Do you have any idea that can help me?

Regards

Sin

ambrish_mishra
Active Contributor
0 Kudos

Hi Sin,

As it seems, you have 2 fields ItemValue and NetItemValue in play.

You don't need any condition for ItemValue since it has to be created any ways...

In the other field, you need a condition if E1EDP26-Qualf EQ 003, then populate corresponding BETRG else populate 0.0.

Hope it works

Ambrish

sinaei
Contributor
0 Kudos

Hi Ambrish,

Exactly, I have followed this, But my problem is that, it just check the first E1EDP26!

This is my problem, that is not give me the correct BETRG,

Also I have tried in this way, It should be something like this, but again gives me the wrong output!

Regards

Sin

ambrish_mishra
Active Contributor
0 Kudos

Context of Qualf and BETRG is E1EDP01 ?

I think I can guess whats happening... In case the QUALF does not exists for 003, the false condition populates multiple 0.0s ? Can you check the queues.

Ambrish

sinaei
Contributor
0 Kudos

yes, Both the contexts are E1EDP01, As I understand, It checks just the first E1EDP01 for all E1EDP26 fields and if the qualf is not 003 put 0.0 unless put the value of that. But it should put for first Item 97.5,  instead of 0.0

Thanks a lot

I would be appreciate if you can suggest me any soloution

Sin

former_member186851
Active Contributor
0 Kudos

Hello Sin,

Whats wrong here.

First QUALF is 004 so 0.0 is passed.

Second is 003 so the actual value is passed.

Third again not equal 003 so 0,0 passed.

It is as per requirement right

ambrish_mishra
Active Contributor
0 Kudos

I am not sure if E1EDP26s come as sorted from ECC. Do they ?

Can you show me the Display Queue for if ?

sinaei
Contributor
0 Kudos

Hi again,

No this is not what I need. I have many E1EDP01 fields that in each of them there are many E1EDP26 fields.

each E1EDP01 is known as a item. so my requirement is to check all the E1EDP26 fields of one item, to see if there is one of them that has the qualifier 003.if yes, put the BETRG value of that field in my ItemNetValue. if no should be written 0.0.

for example here we have a field with qualifier 003, so the ItemNetValue for the first item should be 97.5

the other two Items field are related to another E1EDP01 fields that each of them has its own itemNetValue.

This is what I need.

Regards

Sin

sinaei
Contributor
0 Kudos

No they are not come as sorted.

Sorry, due to problems now I can not access to ECC to show you the value of idoc. as soon as it get accessible I will paste here. but they are not sorted.

ambrish_mishra
Active Contributor
0 Kudos

Show me the Display Queue for your If statement please.

former_member194786
Active Contributor
0 Kudos

Hi Sin,

This should be easily achievable using a udf. Get all values of an item as input, in a loop go through all QUALF values to see if any one of them is 003, take the BETRG of that occurrence or else return 0.

Regards,

Sanjeev

sinaei
Contributor
0 Kudos

Hi Ambrish, How can I display queue of my If statement? in webUi?

sinaei
Contributor
0 Kudos

Hi Sanjeev,

Thanks,

It sloved my problem. I Used this UDF


def void ItemNetValue(String[] QUALF,String[] BETRG , Output out){

int ItemCount=0;

     for( int i=0; i< QUALF.length; i++) {

         if (QUALF[i].equals("003")) {

             out.addValue(BETRG[i])

            ItemCount++;

            break;

         }

     }

if (ItemCount ==0){

   out.addValue("0.0");

    }

  }

}

Regards

Sin

former_member194786
Active Contributor
0 Kudos

Hi Sin,

Glad to know it helped.

Regards,

Sanjeev

Answers (4)

Answers (4)

sinaei
Contributor
0 Kudos

If I do it in this way, is always give me BETRG of the first E1EDP26, not the one who has 003 as QUALF.

Do you have any idea?

Thanks

former_member186851
Active Contributor
0 Kudos

Remove that exists and Map with default and change the root context.

sinaei
Contributor
0 Kudos

Thanks Raghuraman

I do like below and the Context level of QUALF and BETRG is one level high, E1EDP01.

but again is not working ....

You mean this?

Reagards

former_member186851
Active Contributor
0 Kudos

Hello Sin,

Try removecontexts and then spilit by value before the output.

And post ur complete XML with all E1EDP01 and 26 segments.

sinaei
Contributor
0 Kudos

Hi Raghuraman

this is my mapping as you suugested

and this is my Result

This is My XML file with E1EDP01 and 26 values

<E1EDP01>

<POSEX>00254</POSEX>

<E1EDP26>

<QUALF>003</QUALF>

<BETRG>164.80</BETRG>

</E1EDP26>

<E1EDP26>

<QUALF>010</QUALF>

<BETRG>265.20</BETRG>

</E1EDP26>

<E1EDP26>

<QUALF>011</QUALF>

<BETRG>164.80</BETRG>

</E1EDP26>

<E1EDP26>

<QUALF>012</QUALF>

<BETRG>85.75</BETRG>

</E1EDP26>

</E1EDP01>

<E1EDP01>

<POSEX>00209</POSEX>

<E1EDP26>

<QUALF>010</QUALF>

<BETRG>26.52</BETRG>

</E1EDP26>

<E1EDP26>

<QUALF>012</QUALF>

<BETRG>7.90-</BETRG>

</E1EDP26>

<E1EDP26>

<QUALF>001</QUALF>

<BETRG>6.63</BETRG>

</E1EDP26>

<E1EDP26>

<QUALF>002</QUALF>

<BETRG>26.52</BETRG>

</E1EDP26>

</E1EDP01>

<E1EDP01>

<POSEX>000030</POSEX>

<E1EDP26>

<QUALF>003</QUALF>

<BETRG>57.12</BETRG>

</E1EDP26>

<E1EDP26>

<QUALF>010</QUALF>

<BETRG>90.00</BETRG>

</E1EDP26>

<E1EDP26>

<QUALF>011</QUALF>

<BETRG>57.12</BETRG>

</E1EDP26>

</E1EDP26>

</E1EDP01>

<E1EDP01>

<POSEX>00245</POSEX>

<E1EDP26>

<QUALF>003</QUALF>

<BETRG>45.27</BETRG>

</E1EDP26>

<E1EDP26>

<QUALF>010</QUALF>

<BETRG>86.22</BETRG>

</E1EDP26>

<E1EDP26>

<QUALF>011</QUALF>

<BETRG>45.27</BETRG>

</E1EDP26>

<E1EDP26>

<QUALF>012</QUALF>

<BETRG>37.32</BETRG>

</E1EDP26>

<E1EDP26>

<QUALF>014</QUALF>

<BETRG>45.27</BETRG>

</E1EDP26>

<E1EDP26>

<QUALF>001</QUALF>

<BETRG>9.58</BETRG>

</E1EDP26>

<E1EDP26>

<QUALF>002</QUALF>

<BETRG>86.22</BETRG>

</E1EDP26>

</E1EDP01>

<E1EDP01>

<POSEX>00233</POSEX>

<E1EDP26>

<QUALF>003</QUALF>

<BETRG>14.80</BETRG>

</E1EDP26>

<E1EDP26>

<QUALF>010</QUALF>

<BETRG>26.66</BETRG>

</E1EDP26>

<E1EDP26>

<QUALF>011</QUALF>

<BETRG>14.80</BETRG>

</E1EDP26>

<E1EDP26>

<QUALF>002</QUALF>

<BETRG>26.66</BETRG>

</E1EDP26>

</E1EDP01>

Regards

sinaei
Contributor
0 Kudos

Thanks for your replies

Yes, This is my Logic. I have a Custom BO, that has this Logic

node Item [0,n] {

     ....

     node NetValue {

            [Label("Item Net Value")] element ItemNetValue_NETWR : Amount;

      }

}

and this is My IDOC


As you can see I have more than E1EDP01 field that has mapped to my Item Node.


inside each E1EDP01 field I have more than one E1EDP26 fields.


We have used a logic like this for NetValue field


and ItemNetValue

the problem was that, if QUALF =003 was not exist, it did not create the field at all, But we want to put 0 if there was no Qualf = 003 inside the E1EDP01 field.


Can you help me about this?

Regards

Sin

former_member186851
Active Contributor
0 Kudos

Hello Sin,

For the net value map E1EDP01

E1EDP01--------------->NetValue

For the ITemNetvalue use the logic I mentioned earlier.

sinaei
Contributor
0 Kudos

Hi Raghuraman,

But Is not working

This is the simulation Result. I have three E1EDP01, means I have three items. so I mapped also E1EDP01 to NetValue

Is just check the first E1EDP26 and see the QUALF is not equal to 003, put 0.00

and also is not create the field for other items, if you look at the second Item, I dont have the NetValue field.

Should I check something else?

Regards

sinaei
Contributor
0 Kudos

I forgot to say something,

I do not think this is relevant, but my logic in target side is like below.

So I map NetValue with a constant like "1". and I want this for ItemNetValue_NETWR field.

Regards

Sin

former_member186851
Active Contributor
0 Kudos

Sin,

Logic is a bit confusing.

Can you elaborate more.

bhavesh_kantilal
Active Contributor
0 Kudos

Can you show a display queue of this with the runtime data where it does not work? This will help understand this better! 

former_member186851
Active Contributor
0 Kudos

Hello Sin,

Try the below logic

Qualf

          ----------------Equals-------------------------------IF

003

                                                                                    ---------------------------------------------Target

                                      Betrg-------------------   Then

                                     Constant------------------Else

                                         [0]

If its not working let us know we may need to add Remove contexts.

sinaei
Contributor
0 Kudos

Hi Raghuraman,

No it is not working, it just check the first E1EDP26, not all of them.

This is my mapping

and I used also Remove Context as below,

But is not giving me the answer.

You mena this?

Regards

Sin

Harish
Active Contributor
0 Kudos

Hi Sin,

You need to change the context of input fields Qualf, BETRG to one context above. Then the logic should work.

regards,

Harish

sinaei
Contributor
0 Kudos

Hi Harish,

I have done this also, but is not working. is always just check the first one! or put the BETRG value of the first E1EDP26 (not the one who has the QUALF 003)

Do you have any other idea?

Regards

Sin