‎2006 Oct 30 2:32 PM
hi,
how to divide fields vbrp-netwr and vbrp-fkimg?
i used this>
REPORT ZDIVIDE.
tables: vbrp.
data : pcena type vbrp,
cena type vbrp-netwr,
kolicina type vbrp-fkimg,
ls_vb type vbrp,
lt_vb type table of vbrp.
select-options: P_cena for vbrp-netwr.
select-options: P_kolic for vbrp-fkimg.
start-of-selection.
break-point.
select * from vbrp appending table lt_vb where netwr in p_cena and fkimg in p_kolic.
move-corresponding ls_vb to pcena.
COMPUTE CENA = CENA / kolicina.
write :cena.
result O.
‎2006 Oct 30 2:36 PM
Do this way ..
loop at ls_vb.
ls_vb-CENA = ( ls_vb-CENA ) / ( ls_vb-kolicina ).
modify ls_vb index sy-tabix transporting CENA.
endloop.Regards,
Santosh
‎2006 Oct 30 2:36 PM
Is it becasue there is no data in ls_vb .
Do you need to do a
read table lt_vb into ls_vb index 1
Maybe....
‎2006 Oct 30 2:39 PM
????
First get the valid record from VBRP, you would probably be selecting using VBELN and POSNR in your WHERE clause.
data: xvbrp type vbrp.
data: result type p decimals 2.
parameters: p_vbeln type vbrp-vbeln,
p_posnr type vbrp-posnr.
select Single * into xvbrp from vbrp
where vbeln = p_vbeln
and posnr = p_posnr.
if sy-subrc = 0
and xvbrp-fkimg <> 0.
result = xvbrp-netwr / xvbrp-fkimg.
endif.Regards,
Rich Heilman
‎2006 Oct 30 2:40 PM
hi
try this.
loop at <b>lt_vb into ls_vb</b>.
ls_vb-CENA = ( ls_vb-CENA ) / ( ls_vb-kolicina ).
modify lt_vb from ls_vb transporting CENA.
clear ls_vb.
endloop.
rgds
anver
if hlped pls mark points
‎2006 Oct 30 2:41 PM
In the given code you are to initialising the values for Cena and kolicina. Hence the result is zero.
Try the below
<b>cena = pcena-cena/pcena-kolicina.</b>