cancel
Showing results for 
Search instead for 
Did you mean: 

Similar materials displayed once with their total and quantity

Former Member
0 Kudos

Hi guys,

I am working on invoice smartform where I am displaying the materials in a sorted order. My requirement is if there are more than one same materials , it should display only once and their quantity and total should be added and displayed once as well. Please advice how can I achieve this.

Thanks in advance,

chintu gupta

Edited by: Chintu Gupta on May 15, 2009 11:19 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

After getting the data to Smartform, in intializtion we can write the code. in the loop use control break events to sum the quantity.

eg:

sort itab by matnr.

LOOP AT itab.

quantity = quantity + lv_sum.

at end of matnr.

append itab to itab1.

clear : quantity, sum, itab, itab1.

endat.

endloop.

Rgds,

Pavan

Former Member
0 Kudos

Hi pavan,

please explain in detail. And by the way, iam displaying the items sorted out by material type

for eg.all service type(DIEN) materials comes first, then HALB materials and so on..please keep this in mind and advice me how to approach.

Answers (5)

Answers (5)

Former Member
0 Kudos

thanks. answer rewarded

Former Member
0 Kudos

Hi,

Try this one with SUM Control Break Statement.

Former Member
0 Kudos

Hi,

Try like this

LOOP AT i_vbrp INTO wa_vbrp.

wrk_vbrp-vbeln = wa_vbrp-vbeln.

wrk_vbrp-fkimg = wa_vbrp-fkimg.

wrk_vbrp-netwr = wa_vbrp-netwr.

wrk_vbrp-arktx = wa_vbrp-arktx.

wrk_vbrp-vgbel = wa_vbrp-vgbel.

wrk_vbrp-matnr = wa_vbrp-matnr.

COLLECT wrk_vbrp INTO it_vbrp.

ENDLOOP.

Here it_vbrp and i_vbrp are having same structre.

Former Member
0 Kudos

Hi,

U can use collect statement also.

Former Member
0 Kudos

Hi

logic provided by PAVAN can be placed in driver pgm too,