cancel
Showing results for 
Search instead for 
Did you mean: 

Mappingf Via Node Functions

Former Member
0 Kudos

Dear Friends,

I have source structure as follows: <Matgrp>Renu</Matgrp> tag shld come in header node in Target.

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

<ns0:MT_SS1 xmlns:ns0="http://test.com/renu">

<Header>

<Matno>100</Matno>

<matdesc>sample</matdesc>

</Header>

<Item>

<MAtno>100</MAtno>

<itemno>201</itemno>

<Matgrp>Renu</Matgrp>

</Item>

<Item>

<MAtno>200</MAtno>

<itemno>202</itemno>

<Matgrp>Raj</Matgrp>

</Item>

</ns0:MT_SS1>

My Target Stucture is as follows:

I need to repeat Header for each Item node.

Kindly guide me.

Renu.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can use std. fun CopyValue for repeating the header values.

For more help on CopyValue function do a search on SDN.

Regards,

Sarvesh

Answers (4)

Answers (4)

former_member200962
Active Contributor
0 Kudos
My Target Stucture is as follows:

I need to repeat Header for each Item node.

I am not able to view the target structure......If you want to repeat the Header for each Item node then both Header and Item in the target should be mapped to the Item node from Source ..... you may need to adjust the Context of the source nodes within Header and Item nodes while mapping them to thate corresponding taregt nodes.

The target message structure should be as shown by Chirag if you want to maintain sequence between a Header and corresponding Item node.

Regards,

Abhishek.

Former Member
0 Kudos

Hi,

If I understood correctly u want the below target structure.

<ns0:MT_SS1 xmlns:ns0="http://test.com/renu">

<Message>

<Header>

<Matno>100</Matno>

<matdesc>sample</matdesc>

</Header>

<Item>

<MAtno>100</MAtno>

<itemno>201</itemno>

<Matgrp>Renu</Matgrp>

</Item>

</Message>

<Message>

<Header>

<Matno>100</Matno>

<matdesc>sample</matdesc>

</Header>

<Item>

<MAtno>200</MAtno>

<itemno>202</itemno>

<Matgrp>Raj</Matgrp>

</Item>

</Message>

</ns0:MT_SS1>

In this case - inside message (Occurance 0-unbounded) make header and item as child node( occurance 0-1).

map the source with the same values.

Chirag

Former Member
0 Kudos

Dear Friends,

My source Structure:

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

<ns0:MT_SS1 xmlns:ns0="http://test.com/renu">

<Header>

<Matno>100</Matno>

<matdesc>Test</matdesc>

</Header>

<Item>

<MAtno>100</MAtno>

<itemno>A100</itemno>

<Matgrp>grp1</Matgrp>

</Item>

<Item>

<MAtno>101</MAtno>

<itemno>A101</itemno>

<Matgrp>grp2</Matgrp>

</Item>

</ns0:MT_SS1>

I am getting my current target structure aa:

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

<ns0:MT_TT1 xmlns:ns0="http://palm.com/bpm">

<Header>

<MAtno>100</MAtno>

<Matdesc>Test</Matdesc>

<Matgrp>grp1</Matgrp>

</Header>

<Item>

<Matno>100</Matno>

<itemno>A100</itemno>

</Item>

<Item>

<Matno>101</Matno>

<itemno>A101</itemno>

</Item>

</ns0:MT_TT1>

I am not getting my desired result my Header is not repeating to item node.

Kindly guide me friends.

Renu.

Former Member
0 Kudos

Hi Renu,

What is the output structure you required?

If you want the source header field comes to the item field in the target structure then you have to use OneAsMany node function. if it is yes then check my previous reply.

Regards

Ramesh

Former Member
0 Kudos

Hi,

I mapped Header Node of source to Header node of Target as follows

Matno of Header -


>

Itemno of Item node -


> Use One as MAny -


>Split By Value------->Header

Item no of item node------->

I am getting following error in IR.

11:54:53 Start of test

Runtime exception during processing target field mapping /ns0:MT_TT1/Header. The message is: Exception:[com.sap.aii.mappingtool.tf3.IllegalInstanceException: Too few values in first queue in function useOneAsMany. It must have the same number of contexts as second queue.] in class com.sap.aii.mappingtool.flib3.NodeFunctions method useOneAsMany[, , ] com.sap.aii.mappingtool.tf3.MessageMappingException: Runtime exception during processing target field mapping /ns0:MT_TT1/Header. The message is: Exception:[com.sap.aii.mappingtool.tf3.IllegalInstanceException: Too few values in first queue in function useOneAsMany. It must have the same number of contexts as second queue.] in class com.sap.aii.mappingtool.flib3.NodeFunctions method useOneAsMany[, , ] at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:364) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:326) at com.sap.aii.mappingtool.tf3.AMappingProgram.start(AMappingProgram.java:415) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:142) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:118) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInternal(ServerMapService.java:431) at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:169) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.execute(MapServiceBean.java:52) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0.execute(MapServiceRemoteObjectImpl0_0.java:301) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0p4_Skel.dispatch(MapServiceRemoteObjectImpl0_0p4_Skel.java:146) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:319) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:200) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:136) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172) Root Cause: com.sap.aii.utilxi.misc.api.BaseRuntimeException: Exception:[com.sap.aii.mappingtool.tf3.IllegalInstanceException: Too few values in first queue in function useOneAsMany. It must have the same number of contexts as second queue.] in class com.sap.aii.mappingtool.flib3.NodeFunctions method useOneAsMany[, , ] at com.sap.aii.mappingtool.tf3.rt.Q2QFunctionWrapper.cacheQueue(Q2QFunctionWrapper.java:104) at com.sap.aii.mappingtool.tf3.rt.Q2QFunctionWrapper.gotoNextContext(Q2QFunctionWrapper.java:41) at com.sap.aii.mappingtool.flib3.SplitByValue$SplitByEach.gotoNextContext(SplitByValue.java:127) at com.sap.aii.mappingtool.flib3.SplitByValue.gotoNextContext(SplitByValue.java:31) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:266) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:326) at com.sap.aii.mappingtool.tf3.AMappingProgram.start(AMappingProgram.java:415) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:142) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:118) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInternal(ServerMapService.java:431) at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:169) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.execute(MapServiceBean.java:52) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0.execute(MapServiceRemoteObjectImpl0_0.java:301) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0p4_Skel.dispatch(MapServiceRemoteObjectImpl0_0p4_Skel.java:146) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:319) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:200) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:136) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172) RuntimeException in Message-Mapping transformation: Runtime exception during processing target field mapping /ns0:MT_TT1/Header. The message is: Exception:[com.sap.aii.mappingtool.tf3.IllegalInstanceException: Too few values in first queue in function useOneAsMany. It must have the same number of contexts as second queue.] in class com.sap.aii.mappingtool.flib3.NodeFunctions method useOneAsMany[, , ]

11:54:53 End of test

Former Member
0 Kudos

Hi,

I mapped Header Node of source to Header node of Target as follows

Matno of Header -


>

Itemno of Item node -


> Use One as MAny -
>Split By Value------->Header

Item no of item node------->

I am getting error for this node function.

Former Member
0 Kudos

Hi,

Change the context to a higher level.

Matno of Header -


>

Itemno of Item node -


> Use One as MAny -


>Split By Value------->Header

Item no of item node------->

Former Member
0 Kudos

Hi Renu,

If you want to repeat the header node many times then you have to use the OneAsMany node function.

Inputs for the OneAsMany node function.

first input give the header field (matdesc or matno what ever you required)

second and third fields input as same, that is Item field node segment. (item node based on your given input).

After this node function use split by value then map the target field.

Regards

Ramesh

Former Member
0 Kudos

Hi Renu,

If i am right tahn your target message structure should be

<message> (0..n)

<>Header> (1..1)

<Item > (1..1)

</message>

- Simply map source <Item> node to target <Message>

- Hardcode Header target node

- Header elements of source to Hedaer elements of target

- Hardcode Item node of target

- map source item elements to target item elements

Thanks

-Kulwant