cancel
Showing results for 
Search instead for 
Did you mean: 

Aggregation of fields

Former Member
0 Kudos

Hi,

I have a message with the following structure.

Plant, Storage Location, matnr, qty.

I want to sum the quantity by comparing the key fields in XI. how can I do it?

say for example if I have the follwoing values,

PLNT1 STO1 Mat1 20

PLNT1 STO1 Mat1 40

PLNT1 STO1 Mat2 20

The result shud look like this

PLNT1 STO1 Mat1 60

PLNT1 STO1 Mat2 20.

How can I do this?

with regards,

Vamsi

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Use standard functions count and sum in mapping.

Regards,

S.RamNarender

Former Member
0 Kudos

Hi,

With sum, irrespective of the key, the qty sum is being calculated.

with regards,

Vamsi

Former Member
0 Kudos

Hi,

Use sum and key as context in mapping.

Regards,

S.RamNarender

Former Member
0 Kudos

Hi Ram,

Can you please elaborate?

I have a structure, which contains another structure with occurence 0 to unbound. Now even if I am mapping the values at the context or node level all the qty is getting summed irrespective of the key.

with regards,

Vamsi

Former Member
0 Kudos

From My point of View, I will suggest to write the UDF with 4 as input parameters and 1 as output paramter. I will give the logic as follows

1 Take your key fields and quantity as input parameters

2. Take all values as queue based so that you will have all values in hand

3. Write the logic in JAVA by comparing the values and do the sum and reteturn with summation values

4. return the values you got in resultlist.

I hope it is clear for you.

Warm Regards,

Vijay

Former Member
0 Kudos

Hi,

Change the context of the another structure according to MAT

Regards,

S.RamNarender