Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Mapping challenge !! Generate target for unique combination of source field

Hi,

I/P:

<Segement1>

<Article>1</Article>

</Segement1>

<Segement1>

<Article>2</Article>

</Segement1>

<Segement2>

<StoreNum>12</StoreNum>

<StoreNum>13</StoreNum>

<StoreNum>14</StoreNum>

</Segement2>

and the output should be like for every unique combination of Article and StoreNum I have to create a target node and the corresponding values in that node: (So in this case the o/p node will come 6 times)

<Detail>

<Article>1</Article>

<StoreNum>12</StoreNum>

</Detail>

<Detail>

<Article>1</Article>

<StoreNum>13</StoreNum>

</Detail>

.

.

.

.

.

<Detail>

<Article>2</Article>

<StoreNum>14</StoreNum>

</Detail>

Can anybody please suggest a solution ?

Former Member
replied

articleremovecontext-sortsplibyvalue(valuechange)-collapsecontext

-


UDF---details

storenumsort-splitbyvalue(valuechange)--collapsecontext

mapping of the elements inside details node can be achieved using UDF or standard function also.

UDF2

for(int i=0;i<var1.length;i++)
{
for(int j=0;j<var2.length;j++)
{
result.addValue(var1<i>);
result.addContextchange();
}
}

repeat the same mapping for Article(target filed) using udf2 as mentioned above for details...

UDF3:

for(int i=0;i<var1.length;i++)
{
for(int j=0;j<var2.length;j++)
{
result.addValue(var2<i>);
result.addContextchange();
}
}

repeat the same mapping for Storenum(target filed) using udf3 as mentioned above for details...

Note: check for syntax errors.....

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question