03-15-2007 10:21 AM
hi gurus,
i wanna multiply two diffent fields of two differnt internal tables. consider two internal tables to be it_ckis and it_marm. now i wanna multiply it_ckis-menge with it_marm-umrez and divide by it_marm-umren.
this is my current reqiuirement.
Thanks in advance,
Regards,
alson.
03-15-2007 10:24 AM
loop at it_ckis.
read table it_marm with key field1 eq it_ckis-field1.
if sy-subrc eq 0.
v_temp = it_ckis-menge * it_marm-umrez.
v_temp = v_temp / it_marm-umren.
endif.
endloop.
03-15-2007 10:24 AM
loop at it_ckis.
read table it_marm with key field1 eq it_ckis-field1.
if sy-subrc eq 0.
v_temp = it_ckis-menge * it_marm-umrez.
v_temp = v_temp / it_marm-umren.
endif.
endloop.
03-15-2007 10:25 AM
hi
do a nested looping and then multiply the fields based on the common key..
for example:
LOOP AT IT_CKIS.
LOOP AT IT_MARM WHERE (keyfield) = IT_CKIS-(keyfield).
(variable) = ( IT_CKIS-MENGE * IT_MARM-UMREX ) / IT_MARM-UMREN.
IT_CKIS-(field) = (variable).
MODIFY IT_CKIS.
ENDLOOP.
ENDLOOP.
OR
LOOP AT IT_CKIS.
READ TABLE IT_MARM WITH KEY (keyfield) = IT_CKIS-(keyfield).
IF SY-SUBRC EQ 0.
(variable) = ( IT_CKIS-MENGE * IT_MARM-UMREX ) / IT_MARM-UMREN.
IT_CKIS-(field) = (variable).
MODIFY IT_CKIS.
ENDIF.
ENDLOOP.
hope this helps...
thx
pavan
03-15-2007 10:25 AM
loop at it_ckis.
read table it_marm with kye matnr = it_ckis-matnr.
if sy-subrc = 0.
if not it_marm-umren is initial.
v_value = it_ckis-menge * ( it_marm-umrez / it_marm-umren ).
endif.
endif.
endloop.
Regards,
Ravi
03-15-2007 10:26 AM
HI
Loop at it_ckis
READ TABLE it_marm INTO (wa) WITH KEY () whatever u mention)
variable = ( it_ckis-menge * it_marm-umrez ) / it_marm-umren
modfy table (where u have to store)
endloop.
**Please reward suitable points***
With Regards
Navin Khedikar
03-15-2007 10:27 AM
loop at it_ckis .
read table it_marm with key matnr = it_ckis .
if sy-subrc = 0.
it_ckis-menge = ( it_ckis -menge * it_marm-umrez ) / it_marm-umren.
endif.
write : it_ckis-menge.
"or you can modify it_ckis.
endloop.
regards
shiba dutta
03-15-2007 10:29 AM
Hi,
<b>loop at it_ckis.
var = sy-tabix.
read table it_mam var with key (use a key field which having in both da tables) v_temp = it_ckis-menge * it_marm-umrez.
v_temp = v_temp / it_marm-umren.
endif.
endloop.</b>
01-22-2020 9:48 AM
I have the same problem but this code is a littlebit outdated. Can someone give me an answer in the new syntax?