Skip to Content
avatar image
Former Member

Urgent mapping issue - Idoc to file

Hi,

I have the following XML from the IDOC (input message)

- <E1WPA04 SEGMENT="1">

<KONDART>ZKA2</KONDART>

.

.

- <E1WPA05 SEGMENT="1">

<KONDSATZ>5</KONDSATZ>

</E1WPA05>

</E1WPA04>

- <E1WPA04 SEGMENT="1">

<KONDART>VKP0</KONDART>

.

.

- <E1WPA05 SEGMENT="1">

<KONDWERT>19</KONDWERT>

<CURRENCY>INR</CURRENCY>

</E1WPA05>

</E1WPA04>

In the output I have only one filed called Retail Price which will be filled with E1WPA05->KONDWERT if E1WPA04->KONDART is "VKP0".

Now E1WPA04->KONDART can come multiple times (as in the xml shown above) and for each E1WPA04 there will be one E1WPA05. E1WPA05->KONDWERT is an amount (absolute value) and E1WPA05->KONDSATZ is in percentage. Depending upon E1WPA04->KONDART, we can either have abosulte value (KONDWERT) or percent (KONDSATZ) but not both.

For the about xml, the QUEUE for E1WPA04->KONDART looks like :

SUPPRESS

[ZKA2]

[ZKA2]

[VKP0]

[VKP0]

the QUEUE for E1WPA05->KONDWERT looks like:

SUPPRESS

SUPPRESS

[19]

[19]

Please help how can this mapping be done? Its really urgent.

Thanks a ton in advance,

Yash

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Dec 26, 2007 at 10:55 AM

    HI,

    I think this should work ....the saupress is coming means it will supress the target node and only it will pas the value 19 which there for that.."VKP0" condition and generate the target node.

    You can do one thing if that is not working....

    Write and UDF

    Input will be a= E1WPA04->KONDART take it in one context

    Input :b=KONDWERT

    for(i=0;i<a.length;i++)

    {

    if(a{i}.equals("VKP0"))

    {

    result.addValue(b{i});

    }

    }

    Thnx

    Chirag

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      HI,

      Before the UDF u just use the remove context and then give the output of remove context to UDF. So it will take all the value in one context.

      Thnx

      Chirag

  • avatar image
    Former Member
    Dec 26, 2007 at 10:43 AM

    Hello

    u can write advance java function and take queue of E1WPA04->KONDART as well as E1WPA05->KONDWERT. Filter the values using similar java code

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

    {

    if(a(i).equals("VKP0");

    {

    ResultList.addValue(b(i)); //Use square brackets indicating array value

    }

    }

    Change the context accordingly and i guess for each E1WPA04->KONDART there will be E1WPA05->KONDWERT value.

    Regards

    Rajeev

    Edited by: Rajeev Patkie on Dec 26, 2007 11:43 AM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Rajeev,

      How can we use if-else here when one input(E1WPA04->KONDART) is an array and the other is a constant ("VKP0")?

      I mean first we have to use the function "EQUALS" to check if E1WPA04->KONDART equals to the constant "VKP0". But here if we see the queue of E1WPA04->KONDART, it will ahve 2 values ("VKP0" and "ZKA2"). Hence the "EQUALS" function will error out saying:

      "Cannot cast ZKA2 to boolean] in class com.sap.aii.mappingtool.flib3.Bool method equals[ZKA2, VKP0, com.sap.aii.mappingtool.tf3.rt.Context@21ac21ac]".

      anyway to do it?

      Yash

  • avatar image
    Former Member
    Dec 27, 2007 at 11:51 AM

    The problem is resolved now. I had to write advance UDFs and node functions to resolve the context issue.

    Thanks all for the ehlp.

    Regards,

    Yash

    Add comment
    10|10000 characters needed characters exceeded