Skip to Content
avatar image
Former Member

Mapping problem

Hi,

I have the following source structure,

<?xml version="1.0" encoding="UTF-8"?>

http://sap.com/xi/XI/SplitAndMerge">

<ns0:Message1>

<L8_dataroot>

<L8_CUSTOMS_NO>

<RecordType/>

<CountryCode/>

<CustomsTariffNumber17/>

<LanguageCode/>

<Description/>

<UpdateCode/>

<IdentificationFootwearInvoice/>

<RecordStatus/>

<ValidStartDate/>

<ValidEndDate/>

<BrandUsage/>

</L8_CUSTOMS_NO>

</L8_dataroot>

</ns0:Message1>

<ns0:Message2>

<Q2_dataroot>

<ASSIGN_CUSTOMS_CAT>

<Recordtype/>

<CustomsRegionCode/>

<CustomsTariffNoNumber17/>

<CustomsQuotaCode/>

<CountryoforiginCode/>

<TransactionCode/>

<TransactionNo/>

<TransactionConfirmed/>

<TransactionErrorMessage/>

<RecordStatus/>

<ValidStartDate/>

<ValidEndDate/>

<BrandUsage/>

</ASSIGN_CUSTOMS_CAT>

</Q2_dataroot>

</ns0:Message2>

</ns0:Messages>

My target structure looks like

<?xml version="1.0" encoding="UTF-8"?>

http://sap.com/xi/XI/SplitAndMerge">

<ns0:Message1>

<dataroot>

<CUSTOMS_NO>

<RecordType>bvcxz </RecordType>

<CustomsRegionCode>as</CustomsRegionCode>

<CountryCode>sadd</CountryCode>

<CustomsTariffNumber17>aasc xzc</CustomsTariffNumber17>

<LanguageCode>cxzc</LanguageCode>

<Description>cxc</Description>

<UpdateCode>asdacxzc</UpdateCode>

<IdentificationFootwearInvoice/>

<RecordStatus>cxc</RecordStatus>

<ValidStartDate/>

<ValidEndDate/>

<BrandUsage/>

</CUSTOMS_NO>

</dataroot>

</ns0:Message1>

</ns0:Messages>

I have a requirement that if <CustomsTariffNumber17> of <L8_CUSTOMS_NO> matches with <CustomsTariffNoNumber17> of <Q2_dataroot> then map <CustomsRegionCode> of <Q2_dataroot> with the target <CustomsRegionCode>.

Other elements of target will be mapped from the corresponding elements of <L8_CUSTOMS_NO>.

I am facing some issues while doing this. Please let me know if you have any solutions.

Thanks

Mukesh

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Jun 25, 2007 at 12:57 PM

    >>>I have a requirement that if <CustomsTariffNumber17> of <L8_CUSTOMS_NO> matches with <CustomsTariffNoNumber17> of <Q2_dataroot> then map <CustomsRegionCode> of <Q2_dataroot> with the target <CustomsRegionCode>.

    YOur requirment can be easily achieved by a combinations of "equals" standard function and "If" boolean funtion

    regards

    krishna

    Add comment
    10|10000 characters needed characters exceeded

    • Mukesh,

      I asked you for Occurrences, but I haven't got reply based on the assumptions I did the below logic. First please see the structure , if its correct then see the logic below.

      http://www.flickr.com/photo_zoom.gne?id=623182139&size=o

      I've used 3 UDF's in order to achieve the same.

      UDF 1 - To create target CUSTOMS_NO root.

      [argument 1 - L8_tariffnum, argument 2 - Q2_tariffnum,type - Queue]

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

      {

      for(int j=0;j<Q2_tariffnum.length;j++)

      {

      if( L8_tariffnum<i>.equals(Q2_tariffnum[j]))

      {

      result.addValue("");

      }

      else

      {

      result.addSuppress();

      }

      }

      }

      UDF 2 - To create sub-elements in CUSTOMS_NO[Except CustomsRegionCode]

      [argument 1 - input,argument 2 - L8_tariffnum, argument 3 - Q2_tariffnum,type - Queue]

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

      {

      for(int j=0;j<Q2_tariffnum.length;j++)

      {

      if( L8_tariffnum<b>[</b>i<b>]</b>.equals(Q2_tariffnum[j]))

      {

      result.addValue(""input<b>[</b>i<b>]</b>"");

      }

      else

      {

      result.addSuppress();

      }

      }

      }

      UDF 3 - To create sub-element CustomsRegionCode in CUSTOMS_NO[only]

      [argument 1 - input,argument 2 - L8_tariffnum, argument 3 - Q2_tariffnum,type - Queue]

      //The only difference btw UDF 2& 3 is based on returning i & j.

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

      {

      for(int j=0;j<Q2_tariffnum.length;j++)

      {

      if( L8_tariffnum<b>[</b>i<b>]</b>.equals(Q2_tariffnum[j]))

      {

      result.addValue(""input[j]"");

      }

      else

      {

      result.addSuppress();

      }

      }

      }

      Now, lets come to the logic.

      CustomsTariffNumber17[input 1:change context to L8_dataroot], CustomsTariffNumber17[input 2:change context to Q2_dataroot] -


      ><b>UDF1</b> -


      >CUSTOMS_NO.

      RecordType[input 1:change context to L8_dataroot],CustomsTariffNumber17[input 2:change context to L8_dataroot], CustomsTariffNumber17[input 3:change context to Q2_dataroot] -


      ><b>UDF2</b>------->RecordType.

      CustomsRegionCode[input 1:change context to Q2_dataroot],CustomsTariffNumber17[input 2:change context to L8_dataroot], CustomsTariffNumber17[input 3:change context to Q2_dataroot]--


      ><b>UDF3</b>--


      > CustomsRegionCode

      CountryCode[input 1:change context to L8_dataroot],CustomsTariffNumber17[input 2:change context to L8_dataroot], CustomsTariffNumber17[input 3:change context to Q2_dataroot] -


      ><b>UDF2</b>------->

      CountryCode.

      CustomsTariffNumber17[input 1:change context to L8_dataroot],CustomsTariffNumber17[input 2:change context to L8_dataroot], CustomsTariffNumber17[input 3:change context to Q2_dataroot] -


      ><b>UDF2</b>------->CustomsTariffNumber17.

      LanguageCode[input 1:change context to L8_dataroot],CustomsTariffNumber17[input 2:change context to L8_dataroot], CustomsTariffNumber17[input 3:change context to Q2_dataroot] -


      ><b>UDF2</b>------->LanguageCode.

      Description[input 1:change context to L8_dataroot],CustomsTariffNumber17[input 2:change context to L8_dataroot], CustomsTariffNumber17[input 3:change context to Q2_dataroot] -


      ><b>UDF2</b>------->Description.

      UpdateCode[input 1:change context to L8_dataroot],CustomsTariffNumber17[input 2:change context to L8_dataroot], CustomsTariffNumber17[input 3:change context to Q2_dataroot] -


      ><b>UDF2</b>------->UpdateCode.

      IdentificationFootwearInvoice[input 1:change context to L8_dataroot],CustomsTariffNumber17[input 2:change context to L8_dataroot], CustomsTariffNumber17[input 3:change context to Q2_dataroot] -


      ><b>UDF2</b>------->IdentificationFootwearInvoice.

      RecordStatus[input 1:change context to L8_dataroot],CustomsTariffNumber17[input 2:change context to L8_dataroot], CustomsTariffNumber17[input 3:change context to Q2_dataroot] -


      ><b>UDF2</b>------->RecordStatus.

      ValidStartDate[input 1:change context to L8_dataroot],CustomsTariffNumber17[input 2:change context to L8_dataroot], CustomsTariffNumber17[input 3:change context to Q2_dataroot] -


      ><b>UDF2</b>------->ValidStartDate.

      ValidEndDate[input 1:change context to L8_dataroot],CustomsTariffNumber17[input 2:change context to L8_dataroot], CustomsTariffNumber17[input 3:change context to Q2_dataroot] -


      ><b>UDF2</b>------->ValidEndDate.

      BrandUsage[input 1:change context to L8_dataroot],CustomsTariffNumber17[input 2:change context to L8_dataroot], CustomsTariffNumber17[input 3:change context to Q2_dataroot] -


      ><b>UDF2</b>------->BrandUsage.

      Please note that, UDF 1 is used only for creating root node CUSTOMS_NO , UDF 3 is used only for creating CustomsRegionCode, UDF 2 is used for creating the rest of the target elements.

      I hope it helps you. If you have any doubt , kindly revert back.

      Best regards,

      raj.

  • avatar image
    Former Member
    Jun 25, 2007 at 12:47 PM

    Hi,

    Wat are the issues u r facing

    Regards

    Hemant

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 25, 2007 at 01:45 PM

    Mukesh,

    The occurrences of L8_dataroot and Q2_dataroot of source and dataroot of target are unbounded? can u please confirm it.

    Best regards,

    raj.

    Add comment
    10|10000 characters needed characters exceeded