09-22-2008 12:08 PM
hai experts ,
i have the requirement of performing the multiplication in row fields
the fields are
lifnr
name1
matnr
maktx
menge---- A
meins
netpr-------B
total = A*B
i want to multiply the menge and netpr for every row ..
plz help me
09-22-2008 12:11 PM
Hi,
Chinnaiyya wrote :
the fields are
lifnr
name1
matnr
maktx
menge---- A
meins
netpr-------B
total = A*B
i want to multiply the menge and netpr for every row ..
Try in the following way.
Loop at itab into wa.
total = wa-menge * wa-netpr.
write 😕 wa-lifnr,
wa-name1,
.......,
total.
clear total.
endloop.
Regards,
Swapna.
09-22-2008 12:09 PM
hi,
define a variable in final table and in ur final loop use this code.
var = it_final-menge * it_final-netpr.
09-22-2008 12:11 PM
hi,
before displaying loop ur final internal table say
loop at itab into wa_tab.
wa_tab-total = wa_tab-menge * wa_tab-netpr.
modify itab from wa_tab index sy-tabix.
then display..
Rgds,
subash
09-22-2008 12:11 PM
Hi,
Chinnaiyya wrote :
the fields are
lifnr
name1
matnr
maktx
menge---- A
meins
netpr-------B
total = A*B
i want to multiply the menge and netpr for every row ..
Try in the following way.
Loop at itab into wa.
total = wa-menge * wa-netpr.
write 😕 wa-lifnr,
wa-name1,
.......,
total.
clear total.
endloop.
Regards,
Swapna.
09-22-2008 12:11 PM
Hi,
loop at itab.
total = itab-menge * itab-netpr
write 😕 lifnr
name1
matnr
maktx
mengemeins
netpr
total
clear total.
endloop.
regards
padma
09-22-2008 12:18 PM
Dear friend,
declare one more internal table. Copy entire data into that.
loop on the both internal tables accoding to the material number, calculate the value what ever you want and append the claculated value into final internal table.
eg.
data : itab like iab1 occurs 0 with header line.
itab1[] = itab[].
sort itab1 by matnr.
delete adjacent duplicates from itab1 comparing matnr.
loop at itab1.
loop at itab where matnr = ita1-matnr.
zfinal-amt = qty * amt.
endloop.
append zfinal.
clear zfinal.
endloop.
hope it will help you.
regards,
Prashanth.
09-22-2008 12:22 PM
Hi,
TABLES : vbak.
TYPES : BEGIN OF ty_vbak,
vbeln TYPE vbeln_va,
erdat TYPE erdat,
erzet TYPE erzet,
END OF ty_vbak,
BEGIN OF ty_vbap,
vbeln TYPE vbeln_va,
posnr TYPE posnr_va,
matnr TYPE matnr,
END OF ty_vbap,
BEGIN OF ty_output,
vbeln TYPE vbeln_va,
erdat TYPE erdat,
erzet TYPE erzet,
posnr TYPE posnr_va,
matnr TYPE matnr,
product TYPE i,
END OF ty_output.
DATA : it_vbak TYPE STANDARD TABLE OF ty_vbak INITIAL SIZE 0,
it_vbap TYPE STANDARD TABLE OF ty_vbap INITIAL SIZE 0,
it_output TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
wa_vbak TYPE ty_vbak,
wa_vbap TYPE ty_vbap,
wa_output TYPE ty_output.
DATA : fldname TYPE string,
fldval TYPE i.
REFRESH : it_vbak,
it_vbap,
it_output.
CLEAR : wa_vbak,
wa_vbap,
wa_output.
SELECT-OPTIONS : s_vbeln FOR vbak-vbeln.
START-OF-SELECTION.
SELECT vbeln
erdat
erzet
FROM vbak
INTO TABLE it_vbak
WHERE vbeln IN s_vbeln.
IF NOT it_vbak IS INITIAL.
SELECT vbeln
posnr
matnr
FROM vbap
INTO TABLE it_vbap
FOR ALL ENTRIES IN it_vbak
WHERE vbeln = it_vbak-vbeln.
ENDIF.
LOOP AT it_vbap INTO wa_vbap.
wa_output-vbeln = wa_vbap-vbeln.
wa_output-posnr = wa_vbap-posnr.
wa_output-matnr = wa_vbap-matnr.
CLEAR wa_vbak.
READ TABLE it_vbak INTO wa_vbak WITH KEY vbeln = wa_vbap-vbeln.
IF sy-subrc = 0.
wa_output-erdat = wa_vbak-erdat.
wa_output-erzet = wa_vbak-erzet.
ENDIF.
wa_output-product = wa_output-vbeln * wa_output-posnr.
APPEND wa_output TO it_output.
CLEAR wa_output.
ENDLOOP.
LOOP AT it_output INTO wa_output.
WRITE 😕 wa_output-vbeln,
wa_output-erdat,
wa_output-erzet,
wa_output-posnr,
wa_output-product.
ENDLOOP.
thanks.
09-22-2008 12:33 PM
generate the report in alv and utilise the features provided in menu bar.