cancel
Showing results for 
Search instead for 
Did you mean: 

XI mapping issue

Former Member
0 Kudos

Hi All,

I have a scenario where GL transactional data from a database is to be uploaded into SAP. Basically a file is being created at the receiver side which will be uploaded.

While mapping the source and the target fields I have to check that the line items for a particular document are not exceeding 999. If the number exceeds 999 then the document has to be split into two. While doing so I have to also check that the document amount for all the line items is netting to zero. If it does not comes out to be zero then I have to introduce a suspension line item which will net the amount to zero.

Can anyone suggest how to achive this? Do I need to create a advanced UDF and write a java code?

Thanks,

Aparna

Accepted Solutions (0)

Answers (3)

Answers (3)

stefan_grube
Active Contributor
0 Kudos

> While mapping the source and the target fields I have to check that the line items for a particular document are not exceeding 999. If the number exceeds 999 then the document has to be split into two.

This is very complex to do this in mapping. You can do this with a combination of:

index - divide (999) - floor - splitbyvalue(eachvalue)

and other node functions like collapsecontext and fromatbyexample

As I assume that you want to use IDOC as target, I recommend using a two tier mappiing and create an intermediate structure to do only th split in first mapping.

Have you thought about splitting the incoming file in file adapter?

> While doing so I have to also check that the document amount for all the line items is netting to zero. If it does not comes out to be zero then I have to introduce a suspension line item which will net the amount to zero.

This is a bad idea. Mapping should not invent data, especially not in G/L accounts.

But if you really want this, you can add an additional line by clicking on target node and use "dublicate subtree" and use sum function to create the additional entry.

Former Member
0 Kudos

Can you please elaborate the java code for checking whether the number of line items are more than 999 as I dont know much of java. In the input parameter do we have to pass the array of document no?

madhusudana_reddy2
Contributor
0 Kudos

Hi Aparna,

While mapping the source and the target fields I have to check that the line items for a particular document are not exceeding 999. If the number exceeds 999 then the document has to be split into two.

For this you write one Advanced UDF check for every 999 records, you create one message by splitting target node simply by

if(a<i>==999)

result.addvalue('"");

While doing so I have to also check that the document amount for all the line items is netting to zero. If it does not comes out to be zero then I have to introduce a suspension line item which will net the amount to zero.

For this you check sum of all that line items are zero or not by using arithimetic function if it is not comes to zero then use CREATEIF node to create one suspension line item.

thanks,

madhu