cancel
Showing results for 
Search instead for 
Did you mean: 

mapping (please <removed>help)

Former Member
0 Kudos

My scenario is Web Service to Idoc and I created everything in ESR and id part and configuration steps but stuck in mapping level

Here my Source Structure(example):

 

<MT_INPUT>
	<Header>
		<Vendor>XXXX</Vendor>
	</Header>
	<Records>
		<Item>
			<POSNR>10</POSNR>
			<TYPE>T</TYPE>
			<AMOUNT>100</AMOUNT>
		</Item>
	</Records>
	<Records>
		<Item>
			<POSNR>20</POSNR>
			<TYPE>G</TYPE>
			<AMOUNT>200</AMOUNT>
		</Item>
	</Records>
	<Records>
		<Item>
			<POSNR>30</POSNR>
			<TYPE>G</TYPE>
			<AMOUNT>300</AMOUNT>
		</Item>
	</Records>
	<Records>
		<Item>
			<POSNR>40</POSNR>
			<TYPE>T</TYPE>
			<AMOUNT>400</AMOUNT>
		</Item>
	</Records>
</MT_INPUT>



<MT_OUTPUT>
	<Header>
		<VendorName>XXXX</VendorName>
	</Header>
	<TYPE_T>
		<ITEM>
			<POSNR>10</POSNR>
			<TYPE>T</TYPE>
			<AMOUNT>100</AMOUNT>
		</ITEM>
		<ITEM>
			<POSNR>40</POSNR>
			<TYPE>T</TYPE>
			<AMOUNT>400</AMOUNT>
		</ITEM>
	</TYPE_T>
	<TYPE_S>
		<POSNR>20</POSNR>
		<TYPE>S</TYPE>
	</TYPE_S>
	<TYPE_G>
		<POSNR>30</POSNR>
		<TYPE>G</TYPE>
	</TYPE_G>
</MT_OUTPUT>

On the target side i need to collect items with type = t in TYPE_T Segment and take over the Amount values.

In another types amount shouldnt be created.

Could you please tell me how to map this?

thanks

PM

Edited by: Prateek Raj Srivastava on Dec 29, 2011 11:46 PM

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi peter,

You can use this UDF for select the value with one qualifier.

public void GetQualf(String[] qualf, String[] value, String qualfID, ResultList result, Container container) throws StreamTransformationException{

boolean found = false;

int i;

for(i=0;i<qualf.length && !found;i++){

found = qualf<i>.equals(qualfID);

}

if(found)

result.addValue(value[i-1]);

else

result.addValue("");

}

Answers (2)

Answers (2)

Former Member
0 Kudos

Solved with XSLT mapping.

PriyankaAnagani
Active Contributor
0 Kudos

Hi Peter,

try with the below mapping..and please let me if it is not working.

type>removecontext>sort>splitByvaluechange>if type equals t>create if> Item

sortBykey>formatByExample>POSNR

sortByKey:

input1:type-->removecontext

input2:posnr-->removeContext

FormatByExample:

input1:resultOfSortByKey

input2:type>removecontext>sort-->splitByEachValue

type>removecontext>sort>splitByEachValue>Type

type>removecontext>sort>splitbyvaluechange>if equals T > then pass result of formatByexample>Amount

formatByexample:

input1:result of sortby key

input2:type>removecontext>sort-->splitByEachValue

SortBykey:

input1:type-->removecontext

input2:amount-->removecontext

Regards,

Priyanka

Former Member
0 Kudos

Hi,

thanks, which field should i map with TYPE_T ?

Former Member
0 Kudos

Hi Priyanka,

your suggestions are no working.

PriyankaAnagani
Active Contributor
0 Kudos

Hi Peter,


type-->removecontext-->sort-->splitByvaluechange-->collapseContext-->copyvalue(0)-->TYPE_G
type-->removecontext-->sort-->splitByvaluechange-->collapseContext-->copyvalue(1)-->TYPE_S
type-->removecontext-->sort-->splitByvaluechange-->collapseContext-->copyvalue(2)-->TYPE_T

Regards,

Priyanka

Former Member
0 Kudos

Thanks but couldn't help it!

PriyankaAnagani
Active Contributor
0 Kudos

Hi Peter,

Hope it should work surely.....please try it once again & let me know where you're strucking.

Are you able to create the TYPE_T,G,S nodes and item nodes successfully? First map the other elements with constant and check whether you are getting the required no.of nodes or not and then map the elements.


type-->removecontext-->sort-->splitByvaluechange-->collapseContext-->copyvalue(0)-->TYPE_G
type-->removecontext-->sort-->splitByvaluechange-->collapseContext-->copyvalue(1)-->TYPE_S
type-->removecontext-->sort-->splitByvaluechange-->collapseContext-->copyvalue(2)-->TYPE_T

type>removecontext>sort>splitByvaluechange>if equals constant T>create if> Item

sortBykey>formatByExample>POSNR

sortByKey:

input1:type-->removecontext

input2:posnr-->removeContext

FormatByExample:

input1:resultOfSortByKey

input2:type>removecontext>sort-->splitByEachValue

type>removecontext>sort>splitByEachValue>Type

type>removecontext>sort>splitbyvaluechange>if equals constant T > then pass result of formatByexample>Amount

formatByexample:

input1:result of sortby key

input2:type>removecontext>sort-->splitByValueChange

SortBykey:

input1:type-->removecontext

input2:amount-->removecontext

Regards,

Priyanka

Edited by: priyanka.anagani on Dec 29, 2011 6:21 PM

Former Member
0 Kudos

Hi Priyanka,

please check your mail.

Kind Regards,

PM

Former Member
0 Kudos

can anyone help also to solve this issue? I am lost in this mapping.