‎2008 Jun 11 10:32 AM
Hi All,
How can I implement this logic with abap ?
PNR PL P.Suba ROOT-ID ORGEH HJ Quota
200 0001 0001 00012128 00012128 02 81
210 0001 0001 00012128 00012128 02 34
515 0001 0001 00012128 00012128 02 64
551 0001 0001 00012128 00012128 02 80
829 0001 0001 00011256 00011256 02 72
843 0001 0001 00011256 00011256 02 92
in order to calculate OSHA it is necessary
to operate as follows:
1. Finding out number of personal per ORGEH
2. Add up the quoatas per ORGEH
e.g. ORGEH 00011256 = (72 + 92) / 100
Result = 1.62
Pls can somebody help me to perform above
shown logic with abap
Regards
ertas
‎2008 Jun 11 10:36 AM
Loop at data
w_total = w_total + data-quato_value
at end of ORGEH.
w_res = w_total / 100.
endat.
endloop.
‎2008 Jun 11 10:36 AM
Loop at data
w_total = w_total + data-quato_value
at end of ORGEH.
w_res = w_total / 100.
endat.
endloop.
‎2008 Jun 11 10:48 AM
Its a field to accumulate the values that you are adding, (72 + 92 for example).
‎2008 Jun 11 10:40 AM
‎2008 Jun 11 10:42 AM
HI,
First move the data into one more table in that ORGEH should be the first field
declaretiong of temp_table.
same as current_table but ORGEH will be the first field
loop at current_table.
move-corresponding current_table into temp_table.
append temp_table.
endloop.
sort temp_table by orgeh.
loop at temp_table.
add the quotas.
at end of orgeh.
quota = quota / 100.
endat.
endloop..
‎2008 Jun 11 10:44 AM
hi Ertas,
First create a internal table with first field ORGEH then other fields.
use events At new
At NEW ORGEH.
loop at IT_tab.
v_total = wa_tab-Quota+v_total.
wa_finaloutput-Quota = v_tatal.
append wa_finaloutput to IT_finaloutput.
endloop.
end at .
‎2008 Jun 11 1:01 PM
‎2008 Jun 11 1:17 PM
without a loop u cannot acheive this..
There is multiple records
‎2008 Jun 11 10:50 AM
Hi ,
do the following
consider all these records are in internal table itab.
U can first declare another internal table itab1 simialr to itab with one more field precent.
Loop at itab.
Itab1-pl = itab-pl.
Itab1-p.suba = itab-p.suba
Itab1-root-id = itab-root-id.
Itab1-orgeh = itab-orgeh.
Itab1-hj = itab-hj
Itab1-quota = itab-quota.
Collect itab1.----
ïƒ instead of append u can use collect. So it will add 72 and 92.
Clear itab1.
Endloop.
Loop at itab1.
Wa_precent = itab1-quota / 100.
Itab1-persent = wa_precent.
Modify itab-precent index sy-tabix.
Clear itab1.
Endloop.
reward if useful.
diana.
‎2008 Jun 11 11:13 AM
say F1 , F2 as last two fields of ur list
put ORGEH as first field of itab.
sort itab by orgeh.
data:val1 type i.
data:val2 type i.
loop at itab
val1 = val1 + F2.
at end of orgeh.
val2 = val1 / 100.
move corresponding itab to itab1.
itab1-result = val2.
clear val2.
clear val1.
endat.
endloop.
‎2008 Jun 11 12:10 PM
hi ,
thanks for rewarding . is yr problem solved?
regards,.
diana.