04-30-2006 4:01 PM
i have table itab
lgort matnr count
10 2 5
10 3 7
10 6 8
20 1 4
20 2 6
20 3 1
i want to get:
the low and high count acording <b>lgort-matnr</b> the low and high count acording <b>matnr</b>
how i made it ?
04-30-2006 4:08 PM
Hi Liat,
You can code something like this.
SORT ITAB BY LGORT ASCENDING
MANTR ASCENDING.
For more information, please chcek this link.
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3800358411d1829f0000e829fbfe/content.htm
Hope this will help.
Regards,
Ferry Lianto
04-30-2006 4:14 PM
thank ferry.
i did not find how i can make select by matnr for min or max
04-30-2006 4:43 PM
04-30-2006 4:48 PM
04-30-2006 4:49 PM
once in lgort and once not only the matnr and his count min and max
04-30-2006 4:51 PM
04-30-2006 4:53 PM
give me only 1 answer
how you cna tell me the min and max count per matnr
just it PLS
04-30-2006 5:24 PM
Hi,
SORT ITAB by LGORT ASCENDING MATNR ASCENDING.
LOOP AT ITAB.
AT NEW LGORT.
WRITE 😕 ITAB-LGORT, ITAB-MATNR.
ENDAT.
AT END OF LGORT.
WRITE 😕 ITAB-LGORT, ITAB-MATNR.
ENDAT.
ENDLOOP.
This should give you the output of
lgort matnr
10 6 8
10 2 5
20 3 1
20 1 4
Regards,
Ravi
Note :Please mark the helpful answers
05-01-2006 3:10 AM
Hi Liat,
I think you would have got better and quicker answers if you had laid out your question better. It's not exactly clear what you want. People are unsure if you mean max and min of matnr within lgort or something else. When they asked for more details they really wanted you to give your exact expected results for your example.
I'm assuming you mean max/min count at matnr regardless of lgort. If this is correct you want an answer of:
Matnr Min Max
1 4 4
2 5 6
3 1 7
6 8 8
Try this:
data itab2 like itab.
field-symbols <entry> like line of itab.
itab2[] = itab[].
loop at itab2 assigning <entry>.
clear <entry>-lgort.
endloop.
sort itab2 by matnr count.
loop at itab2 assigning <entry>.
at new matnr.
write:/ 'min',<entry>-matnr,<entry>-count.
endat.
at end of matnr.
write:/ 'max',<entry>-matnr,<entry>-count.
endat.
endloop.