cancel
Showing results for 
Search instead for 
Did you mean: 

Map Line Items Total from IDOC to Header Total in xml

Former Member
0 Kudos

hi,

scenario -> IDOC -> XI - >XML

These are 3 line items whose total cost including the Tax should be mapped to a <Total> tag in the xml.

How do we do this?

From the same 3 line items we need to take the tax and show it in the Target <Tax> tag in the xml.

how do we do this?

Thanks,

tirumal

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

You could make <tax> as a global container element.

now, add the three line items line1,line2,line3 to <total> tag. i assume here, that all these line items are in the same context.

Since the <tax> element is global, it can again be mapped to the target <tax> element.

Regards,

Smitha.

Former Member
0 Kudos

Hi,

You can do this by using the standard SUM function.

I guess your total tag is for the total of all the element in that particalular message . So u can do a context change and make it for the whole document.

For the line Item tax total u just need to use the sum function and map them together.

Regards

Vijaya

moorthy
Active Contributor
0 Kudos

Hi Tirumal,

You can use container variables/Global Container to find out the Total and use the same in the target structure.

http://help.sap.com/saphelp_nw04s/helpdata/en/22/e127f28b572243b4324879c6bf05a0/frameset.htm

/people/michal.krawczyk2/blog/2005/03/04/globalcontainer--in-graphical-mapping-xi

/people/sap.user72/blog/2005/10/01/xi-new-features-in-sp14

Even you can try with Java User Defined Functions.

Hope this helps,

Regards,

Moorthy

Former Member
0 Kudos

hi,

thanks guys. will try it out.

tirumal

Former Member
0 Kudos

Hi,

Write the advanced user defined function in message mapping and do the total, using this function map it to the target node.

Sample code..

int tempCount = 0;

int tempSum = 0;

int temp = 0;

tempCount = a.length;

for (int i = 0; i<tempCount.length; i++)

{

temp = Integer.parseInt(a<i>.trim());

tempSum = tempSum + temp ;

}

}

result.addValue(tempSum);

Thanks,

Prateek