01-05-2006 12:43 PM
i have 6 row of 1 matnr
and i have to display only 1 with the sum of each field
example:
300032 3 4 1
300032 3 3 3
300032 2 2 2
i want
<b>300032 8 9 7</b>
how?
thanks.
01-05-2006 12:55 PM
Hi,
this should help u to do so
----
S o r t a n d S u b t o t a l
Below is Structure Sort (SLIS_T_SORTINFO_ALV).
information for sort and subtotals
TYPES: BEGIN OF SLIS_SORTINFO_ALV,
SPOS LIKE ALVDYNP-SORTPOS,
FIELDNAME TYPE SLIS_FIELDNAME,
TABNAME TYPE SLIS_FIELDNAME,
UP LIKE ALVDYNP-SORTUP, Ascending
DOWN LIKE ALVDYNP-SORTDOWN, Descending
GROUP LIKE ALVDYNP-GROUPLEVEL, Grouping
SUBTOT LIKE ALVDYNP-SUBTOTALS, Field Subtotal
COMP(1) TYPE C,
EXPA(1) TYPE C,
END OF SLIS_SORTINFO_ALV.
TYPES: SLIS_T_SORTINFO_ALV TYPE SLIS_SORTINFO_ALV OCCURS 1.
Every field to be configured is added to SLIS_T_SORTINFO_ALV. This table will be use as input parameter of function REUSE_ALV_LIST_DISPLAY.
01-05-2006 12:48 PM
Hi
Use Collect statament to append the record to output table.
DATA: BEGIN OF ITAB OCCURS 0,
KEY
FIELD1 TYPE I,
FIELD2 TYPE I,
FIELD3 TYPE I,
END OF ITAB.
ITAB-KEY = '300032'.
ITAB-FIELD1 = 3.
ITAB-FIELD2 = 4.
ITAB-FIELD3 = 1.
COLLECT ITAB.
ITAB-KEY = '300032'.
ITAB-FIELD1 = 2.
ITAB-FIELD2 = 2.
ITAB-FIELD3 = 2.
COLLECT ITAB.
ITAB-KEY = '300032'.
ITAB-FIELD1 = 3.
ITAB-FIELD2 = 3.
ITAB-FIELD3 = 3.
COLLECT ITAB.
Max
Message was edited by: max bianchi
Message was edited by: max bianchi
01-05-2006 12:52 PM
sort itab.
loop at itab.
v_quantity1 = v_quantity1 + itab-quantity1.
*--use these many variables to store.
at end of matnr.
read table itab index v_index.
itab2-matnr = itab1-matnr.
itab2-quantity1 = v_quantity1.
*--and so onn.
append itab2.
clear v_quantity1,etc..
endat.
endloop.
01-05-2006 12:53 PM
or use COLLECT STATEMENT.
loop at itab.
itab2 = itab.
collect itab2.
endloop.
regards
srikanth
01-05-2006 1:00 PM
1.how i can made collect to wa_record?
2.there is not simple func to make it,as i click on the matnr is making it to 1 row?
01-05-2006 12:53 PM
Yes.
Collect would solve your problem.
Collect will add all numeric fields.
Make sure that the Value 300032 will be a assigned to a character field.
Thanks,
Sreekanth
01-05-2006 12:55 PM
Hi,
this should help u to do so
----
S o r t a n d S u b t o t a l
Below is Structure Sort (SLIS_T_SORTINFO_ALV).
information for sort and subtotals
TYPES: BEGIN OF SLIS_SORTINFO_ALV,
SPOS LIKE ALVDYNP-SORTPOS,
FIELDNAME TYPE SLIS_FIELDNAME,
TABNAME TYPE SLIS_FIELDNAME,
UP LIKE ALVDYNP-SORTUP, Ascending
DOWN LIKE ALVDYNP-SORTDOWN, Descending
GROUP LIKE ALVDYNP-GROUPLEVEL, Grouping
SUBTOT LIKE ALVDYNP-SUBTOTALS, Field Subtotal
COMP(1) TYPE C,
EXPA(1) TYPE C,
END OF SLIS_SORTINFO_ALV.
TYPES: SLIS_T_SORTINFO_ALV TYPE SLIS_SORTINFO_ALV OCCURS 1.
Every field to be configured is added to SLIS_T_SORTINFO_ALV. This table will be use as input parameter of function REUSE_ALV_LIST_DISPLAY.
01-05-2006 1:05 PM
01-05-2006 1:16 PM
i made this and it's not working
loop at it_record into wa_record.
wa_record = itab1.
append itab1.
collect itab1.
endloop.
01-05-2006 1:29 PM
loop at it_record into wa_record.
<b>wa_record = itab1.</b> IS WRONG
append itab1. NO NEED OF APPEND HERE
ITAB1 = WA_RECORD. -> RIGHT Statement.
collect itab1.
endloop.
check this now.
01-05-2006 1:33 PM
01-05-2006 1:18 PM
Hi,
U can check this simple code.
data: itab1 like standard table of itab with header line.
loop at itab.
at end of matnr.
read table itab index sy-tabix.
sum.
move-corresponding itab to itab1.
append itab1.
endat.
endloop.
Regards,
Neelima.
01-05-2006 1:22 PM