I have an internal table it_display where the invoice wise bill types are appearing with sale value calculated as in my previous thread as follows :
My requirement is
I wanted to write a condition if it_display-fkart = f2,fvat,l2
then total = Z_PR00 - V_ZCAS
if it_display-fkart = g2,re
then total = - (total) (should i need to declare another variable as total1 and for first case total1 = total and for 2nd case total1 = -(total). system doesn't permit to write -(total) or -1 * total. Please guide.
____________________________________
previous code in my earlier threads.
SELECT
KONV~KNUMV
konv~kposn
konv~kschl
konv~kbetr as kbetr2
into CORRESPONDING FIELDS OF TABLE it_display3 from konv
for ALL ENTRIES IN it_display where
konv~knumv = it_display-knumv AND
konv~kschl IN ('ZCAS','PR00').
lets take 2 variable V_ZCAS and Z_PR00
in order for calculation you can do the following.
loop at it_display.
read it_display3 with key Knumv = it_display-knumv and kposn = it_display-kposn and kschl = 'ZCAS'.
if sy-subrc = 0.
add the value of 'ZCAS'
V_ZCAS = it_display3-kbetr / 10 .
endif.
clear it_display3. ( Should clear the work area )
read it_display3 with key Knumv = it_display-knumv and kposn = it_display-kposn and kschl = 'PR00'.
if sy-subrc = 0.
add the value of 'PR00'
V_PR00 = it_display3-kbetr / 10 .
endif.
clear it_display3. ( Should clear the work area )
total = Z_PR00 - V_ZCAS.
endloop.
total = Z_PR00 - V_ZCAS.
I wanted to write a condition if it_display-fkart = f2,fvat,l2
then total = Z_PR00 - V_ZCAS
endloop.