on 06-25-2007 1:34 PM
Hi,
I have the following source structure,
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="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"?>
<ns0:Messages xmlns:ns0="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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>>>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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
both <L8_dataroot> and <Q2_dataroot> are unbounded.
SO simple if condition will not work. we have to loop over <Q2_dataroot> and see if there is any matching element for <CustomsTariffNumber17> then only map <CustomsRegionCode> to the target element. And i am facing problem while doing this looping.
What is your exact looping pblm
You dont have to specify an explicit loop say for eg inside a UDF. By default, during runtime, the subnodes of Q2_dataroot will be looped over for how many ever occurrences of the same. Check "Display Queues" to have an understanding of what i am talking about
regards
krishna
Thanks.
I have checking the queue and got the idea that equals and if condition will not work because, lets assume that I have <CustomsTariffNumber17>10</CustomsTariffNumber17> is in 10th position from message1 and <CustomsTariffNoNumber17>10</CustomsTariffNoNumber17> is in 20th position then it will never find that and result will be false though there is a match.
Hi Mukesh,
create a UDF, take input both <L8_dataroot> and <Q2_dataroot> and return output as "true" or false" depending on the match condition........send <L8_dataroot> as such, but change the context of <Q2_dataroot> by right-clicking it and selecting context-level to message2.........then for each <L8_dataroot> you will have all the values of <Q2_dataroot>.....then in graphical mapping, take output of UDF to splitbyvalue function and then to creatif function and then to root target node...........create another UDF by taking same inputs, but in output take the <Q2_dataroot> to target node CustomsRegionCode... both the UDFs will return string and both UDF will have same logic to check in a for loop the data of first argument in the array of second argument......This will solve your this mapping issue.
Thanks,
Rajeev Gupta
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]--
> 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.
Hi,
Wat are the issues u r facing
Regards
Hemant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.