‎2008 Apr 16 11:59 AM
Hi,
I want to print/output maximum and minimun value as range from one internal table.
How to print.
Example: for entries 1,2,3,5,6,8,9.
output : 01-09.
‎2008 Apr 16 12:01 PM
HI,
Use aggeriget function .
tables: ekko.
data: begin of itab occurs 0,
ebeln like ekko-ebeln,
matnr like ekpo-matnr,
netpr like ekpo-netpr,
end of itab.
data: v_cnt like sy-tabix.
select-options: s_ebeln for ekko-ebeln .
select ebeln from ekko into corresponding fields of table itab where ebeln in s_ebeln.
loop at itab.
select count(*) into v_cnt from ekpo where ebeln = itab-ebeln.
write:/1 itab-ebeln,15 v_cnt.
endloop.
Regards,
Nehru.s
‎2008 Apr 16 12:01 PM
HI,
Use aggeriget function .
tables: ekko.
data: begin of itab occurs 0,
ebeln like ekko-ebeln,
matnr like ekpo-matnr,
netpr like ekpo-netpr,
end of itab.
data: v_cnt like sy-tabix.
select-options: s_ebeln for ekko-ebeln .
select ebeln from ekko into corresponding fields of table itab where ebeln in s_ebeln.
loop at itab.
select count(*) into v_cnt from ekpo where ebeln = itab-ebeln.
write:/1 itab-ebeln,15 v_cnt.
endloop.
Regards,
Nehru.s
‎2008 Apr 16 12:03 PM
sort the values ...
say .. itab has entries
sort itab by field1.
read table itab index 1.
v_min = itab-field1.
sort itab by field1 descending.
read table itab index 1.
v_max = itab-field1.
‎2008 Apr 16 12:03 PM
‎2008 Apr 16 12:05 PM
Hi,
You can do as below:
sort itab by f1 descending.
Read table itab index 1.
write : 'Maximum value is', itab-f1.
sort itab by f1 ascending.
Read table itab index 1.
write : 'Mnimum value is', itab-f1.
Thanks,
Sriram Ponna.
‎2008 Apr 16 12:07 PM
Hi,
Check the below logic.
data: begin of itab occurs 0,
num type i,
end of itab.
data: v_min type i,
v_max type i.
do 9 times.
if sy-index = 4 or
sy-index = 7.
continue.
endif.
itab-num = sy-index.
append itab.
enddo.
if not itab[] is initial.
read table itab index 1.
v_min = itab-num.
v_max = itab-num.
loop at itab.
if itab-num lt v_min.
v_min = itab-num.
elseif itab-num gt v_max.
v_max = itab-num.
endif.
endloop.
endif.
write:/5 v_min, 25 v_max.