cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Query

former_member183906
Active Contributor
0 Kudos

Hi Pals,

In source message X1,X2 and X3 data type is there and in target L1,L2,L3 data type is there. I have added X1 to L1,X2 to L2 and X3 to L3 using remote context function. But not getting desired output. Other info is below :

Structure is as follows

<L1>50</L1>

- <Test>

<L2>40</L2>

- <Test1>

<L3>05</L3>

</Test1>

- <Test1>

<L3>10</L3>

<Test1>

</Test>

Desired output is below -

L1 50

L2 40

L3 05

L1 50

L2 40

L3 10

Can any one guide me how to do mapping to get below output.

Best Regards

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Vijay,

Only 3rd level, i.e Test1 is repeating?

Or even second level Test is repeating?

And if yes, then what is the required output in that case?

Regards,

Supriya.

former_member183906
Active Contributor
0 Kudos

Hi Supriya,

For every L1 there is one or many L2 under Test.

For every L2 there is one or many L3 under Test.

Output required may turn like this in those cases -

L1 50

L2 40

L3 05

L1 50

L2 40

L3 10

L1 50

L2 50

L3 05

L1 60

L2 55

L3 05

Best Regards

former_member187339
Active Contributor
0 Kudos

Hi,

Can you paste here how your source and target structure looks like... That will be easier to identify the logic

Regards

suraj

former_member183906
Active Contributor
0 Kudos

Hi Suraj -

SOURCE STR-

<L1>10</L1>

- <Test>

<L2>10</L2>

- <LINE>

<L3>05</L3>

</LINE>

- <LINE>

<L3>10</L3>

</LINE>

</Test>

<L1>45</L1>

- <Test>

<L2>15</L2>

- <LINE>

<L3>25</L3>

</LINE>

</Test>

TARGET STRUCTURE - 3 simple nodes below a common segment

X1

X2

X3

Output will be like

X1 L1 10

X2 L2 10

X3 L3 05

X3 L3 10

X1 L1 45

X2 L2 15

X3 L3 25

Pls suggest how mapping needs to be done b/w source and target structure.

Best Regards

Best Regards

former_member187339
Active Contributor
0 Kudos

Hello..

thinking your target to be like

root

-Details

--X1

---L1

--X2

---L2

--X3

---L3

Map[ping can be done as

L3 - removecontext-Details

L1 (source) -useoneasmany - splitbyValue-X1 (target)

L3 (context root)

L3 (context LINE)

L1 (source) -useoneasmany - splitbyValue-L1 (target)

L3 (context root)

L3 (context LINE)

L2 (source) -useoneasmany - splitbyValue-X2 (target)

L3 (context root)

L3 (context LINE)

L2 (source) -useoneasmany - splitbyValue-L2 (target)

L3 (context root)

L3 (context LINE)

L3----X3

L3 --- L3

PS: It is difficult to say whether this will work or not.. Try for X1 and L1 then X2 L2 and then X3 L3

Regards

suraj

jyothi_anagani
Active Contributor
0 Kudos

Hi Vijay...

if your input is like this....

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

<ns0:MT_TestSDNIn xmlns:ns0="http://abc.com/YH1314/Test">
   <Record>
      <L1>50</L1>
      <Test>
         <L2>40</L2>
         <Test1>
            <L3>05</L3>
         </Test1>
         <Test1>
            <L3>10</L3>
         </Test1>
      </Test>
      <Test>
         <L2>50</L2>
         <Test1>
            <L3>05</L3>
         </Test1>
      </Test>
   </Record>
   <Record>
      <L1>60</L1>
      <Test>
         <L2>50</L2>
         <Test1>
            <L3>05</L3>
         </Test1>
      </Test>
   </Record>
</ns0:MT_TestSDNIn>

and if you want the output like this....

<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_TestSDNOut xmlns:ns0="http://abc.com/YH1314/Test">
<Record>
    <L1>50</L1>
    <L2>40</L2>
    <L3>05</L3>
</Record>
<Record>
    <L1>50</L1>
    <L2>40</L2>
    <L3>10</L3></Record>
<Record>
   <L1>50</L1>
   <L2>50</L2>
   <L3>05</L3>
</Record>
<Record>
    <L1>60</L1>
    <L2>50</L2>
   <L3>05</L3>
</Record>
</ns0:MT_TestSDNOut>

Use this Mapping...

Test1---->removeContex----->Record


L1-------------------------\
L3(manual context change to Record)--->UseOneAsMany---->SpliByValue(EachValue)----->L1
Test1---------------------------/


L2---------\
Test1-------->UseOneAsMany---->SpliByValue(EachValue)----->L3
Test1--------/

L3----L3

Thanks

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Vijay,

'useOneAsMany' has 3 arguments.

If it is showing yellow, that means your mapping is incomplete.

First argument would be your source field.

2nd will be the Test1 field with context change according to which you will be changing the value in output queue.

And 3 rd argument would be the Test1 field for context changes in output queue.

Regards,

Supriya.

Former Member
0 Kudos

see my second reply about how to use useOneAsMany standard function in this thread


 you use function useOneAsMany() if a field that only occurs once needs to be replicated as often as another field occurs in the outbound message so that the fields can be written to the target structure in pairs as a record.

it takes three inputs
first input values to be replicated
second input for how many times the  values is to be repeated(Occurence)
third input How to structure the values


L1-------------------------\
L3(manual context change to Record)--->UseOneAsMany---->SpliByValue(EachValue)----->L1
Test1---------------------------/ 

first input is L1
Second input is L3(right click on L3 to change the context Record)
third input is Test1

if you still have doubts,then refer this http://wiki.sdn.sap.com/wiki/display/XI/Explainnodefunctions

for how to use UseOneAsMany std function

Former Member
0 Kudos

Hi Vijay,

In the above example, you have mentioned teh following output:

X1 L1 10

X2 L2 10

X3 L3 05

X3 L3 10

But hows it possible?

X3 is a simple element with 0 to 1 occurence, correct me if I am wrong.

In that case your output shuld look like,

X1 L1 10

X2 L2 10

X3 L3 05

X1 L1 10

X2 L2 10

X3 L3 10

Regards,

Supriya.

former_member183906
Active Contributor
0 Kudos

yeah u r rite..sorry it was wrong..

which output u had shown is perfect.

can u help in mapping now.

thanks

jyothi_anagani
Active Contributor
0 Kudos

Hi Vijay,

I have tested the Mapping...It is working fine......Do like this ..you will get it..

Thanks.

former_member183906
Active Contributor
0 Kudos

how to use - "UseOneAsMany" function . its showing yellow when i do this mapping

source field->useoneasmany->split by value_>target field

is there any blog which shows this mapping so that i can proceed.