2007 Oct 18 8:16 AM
DATA : BEGIN OF SUBVBPLP OCCURS 10,
vendprodid like mara-mfrpn ,
CUMQUANTITY TYPE I ,
PACKLISTID LIKE VBRK-VBELN,
mfr_id(3) ,
debtorid(27),
END OF SUBVBPLP.
SUBVPLP-CUMQUANTITY = 10.
APPEND .
SUBVPLP-CUMQUANTITY = 20.
APPEND.
I WANT TO FIND THE MAX VALUE FORM CUMQUANTITY . AND RESULT INTO ONE VARIBALE . PLS GIVE SUGGESTION TO GET MAX VALUE
2007 Oct 18 8:22 AM
declare two workareas wa1 and wa2 of the same type SUBVBPLP
loop at itab into wa1.
read table itab into wa2 with index sy-index + 1.
if wa2-CUMQUANTITY > wa1-CUMQUANTITY.
maxval = wa2-CUMQUANTITY.
endif.
endloop.
This wil give max in variable maxval.
Hope dis solves ur query
Reward points if helpful
declare two workareas wa1 and wa2 of the same type SUBVBPLP
loop at itab into wa1.
read table itab into wa2 with index sy-index + 1.
if wa2-CUMQUANTITY > wa1-CUMQUANTITY.
maxval = wa2-CUMQUANTITY.
endif.
endloop.
This wil give max in variable maxval.
Hope dis solves ur query
Reward points if helpful
2007 Oct 18 8:18 AM
Hi,
data : test type i.
Sort subvbplp by cumquantity descending.
read table subvbplp index 1.
test = subvbplp-cumquantity.
Regards,
Himanshu
2007 Oct 18 8:22 AM
declare two workareas wa1 and wa2 of the same type SUBVBPLP
loop at itab into wa1.
read table itab into wa2 with index sy-index + 1.
if wa2-CUMQUANTITY > wa1-CUMQUANTITY.
maxval = wa2-CUMQUANTITY.
endif.
endloop.
This wil give max in variable maxval.
Hope dis solves ur query
Reward points if helpful
2007 Oct 18 11:18 AM
loop at subvbplp.
sort subvbplp by cumquantity descending.
read table subvbplp into w_subvbplp with index sy-index+1.
if w_subvbplp > subvbplp.
maxval = w_subvbplp-cumquantity.
endif.
endloop.
NO I GETTING SOME ERROR " KEY = ....","JEY...= "OR TABLE KEY ...=" EXPECTED AFTER WITH
2007 Oct 18 11:23 AM
Hi Anil.
There is no need to Loop the Internal table in this case .
This is the better way.
Check this which i gave in my prev post.
Hi.
This is the code to get the Max CUMQUANTITY.
<b>Sort SUBVBPLP by CUMQUANTITY DESCENDING.
READ TABLE SUBVBPLP INDEX 1.
WRITE: / SUBVBPLP-CUMQUANTITY .
</b>
REWARD IF HELPFUL
2014 Jun 13 11:50 PM
The logic is not complete. If the max value is the first one, it will not be saved to maxval. This would be the proper solution:
loop at itab into wa1.
maxval = wa1-cumquantity.
read table itab into wa2 index sy-index + 1.
if wa2-CUMQUANTITY > wa1-CUMQUANTITY.
maxval = wa2-CUMQUANTITY.
endif.
endloop.
2007 Oct 18 8:26 AM
use this select statement...
Select max ( <fieldname in itab> ) from table <i_tab> into <f_name> where .........
2007 Oct 18 8:34 AM
Hi.
This is the code to get the Max CUMQUANTITY.
Sort SUBVBPLP by CUMQUANTITY DESCENDING.
READ TABLE SUBVBPLP INDEX 1.
WRITE: / SUBVBPLP-CUMQUANTITY .
<b>Reward if Helpful.</b>
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |