Skip to Content
0
Former Member
Mar 03, 2007 at 02:29 PM

logic- for required format output

30 Views

Hi,

I have a situation where material number has multiple entries(rows).

I required to show only single row output some of the respective material number quantity fields needs to be ADDED and some of the quantity should be same as a single row field value.

example :

following below code gives us output

<b>'Material' 'Quant1' 'Quant2'</b>

1000-A 10 999

1000-A 20 999

1000-B 10 700

1000-B 20 700

1000-B 30 700

but i need output in 2 lines only.

<b>'Material' 'Quant1' 'Quant2'</b>

1000-A 30 999

1000-B 60 700

i.e Quant1 values should be added and Quant2 values should remain same.

report x.

data: begin of itab occurs 0,

matnr(10) type c,

quant1(4) type c,

qunat2(4) type c,

end of itab.

itab-matnr = '1000-A'.

itab-quant1 = '10'.

itab-quant2 = '999'.

APPEND itab.

itab-matnr = '1000-A'.

itab-quant1 = '20'.

itab-quant2 = '999'.

APPEND itab.

itab-matnr = '1000-B'.

itab-quant1 = '10'.

itab-quant2 = '700'.

APPEND itab.

itab-matnr = '1000-B'.

itab-quant1 = '20'.

itab-quant2 = '700'.

APPEND itab.

itab-matnr = '1000-B'.

itab-quant1 = '30'.

itab-quant2 = '700'.

APPEND itab.

write : /10 'Material' , 30 'Quant1' , 45 'Quant2' .

loop at itab.

write : /10 itab-matnr , 30 itab-quant1 , 45 itab-quant2 .

endloop.

Any ideas?

Regards

Praveen