cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Logic

Former Member
0 Kudos

Hi,

This is my source file extract.

Cost Center      ExtractId     Amount

C1                         1

C1                         1

B2                         2

B2                         2

Based on each cost center, I need to create the idoc.

Please advise me how to achieve it using graphical mapping.

Regards

Anandh.B

Accepted Solutions (1)

Accepted Solutions (1)

rajasekhar_reddy14
Active Contributor
0 Kudos

first change IDoc occurance to 1 to unbounded(take xsd of IDoc and change it manually and upload as external definition) and use the same XSD in message mapping.

Cost centre----->splitbyvalue(value change)------>IDoc

Former Member
0 Kudos

Hi,

My other requirement is I also need to add an extra dummy record on the total amount of summing of costcentre at group level and create one more debit entry in the idoc.

For Eg.,

Cost Center      ExtractId     Amount

C1                         1               1000

C1                         2               2000

B2                         1               3000

B2                         2               4000

With this I will have two idocs  based on C1 and B2. In first idoc, i will need to add an mapping by summing the amount for C1 alone and similarly for B2 as well. Say  3000 for C1 and 7000 for B2.

Assume that the field is WRBTR

One entry of WRBTR will contain 3000 for C1 and 7000 for B2 at cost centre level.

Regards

Anandh.

rajasekhar_reddy14
Active Contributor
0 Kudos

Well its very easy,

Fist identify the field in IDoc to map total amount value then write  a UDF to add all values and map UDF output IDoc field.

set right context to UDF.

Regards,

Raj

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Doing UDF is the better option. You can also try

C1(set context to Cost Center)  -> SUM -> WRBTR.  Similarly for the B2.

former_member184681
Active Contributor
0 Kudos

Hi,

Here is how I would calculate the totals for each Cost Center, without using UDF:

Amount -----------------------------------------------> formatByExample -> sum -> WRBTR

CostCenter -> SplitByValue(ValueChange) ->

It assumes that your entries are sorted by CostCenter value as in your example, if this is not true, use sort for CostCenter and sortByExample(CostCenter) for Amount.

Hope this helps,

Greg

Answers (1)

Answers (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

If you have difficulty in changing the idoc occurence and import it as external definition, Please go through this link

http://scn.sap.com/community/pi-and-soa-middleware/blog/2005/12/04/xi-idoc-bundling--the-trick-with-...