‎2007 Feb 01 7:32 AM
i m working in smartform
want the sum of service tax which are same
now i m geting indivisual service tax for each item
but i want to sum all the service tax which are same.
for example i m getting like this
service tax 10.20 % 10
service tax 4.0% 4
service tax 10.20 % 100
service tax 4.0% 50
but i want like below
service tax 10.20 % 110
service tax 4.0% 54
i wote below code
IF ( t_komv-waers = '%' OR t_komv-kschl = 'JSRE' OR
t_komv-kschl = 'JSRF' ).
IF t_komv-kschl = 'JSRE' .
g_percentage = t_komv-kbetr / 10.
ELSE.
g_percentage1 = t_komv-kbetr / 10.
ENDIF.
add t_komv-kwert to l_stax-amt.
ENDIF.
IF ( t_komv-waers = '%' OR t_komv-kschl = 'JSER' OR
t_komv-kschl = 'JSVD' ).
IF t_komv-kschl = 'JSER' .
g_percentage = t_komv-kbetr / 10.
ELSE.
g_percentage1 = t_komv-kbetr / 10.
ENDIF.
add t_komv-kwert to l_stax-amt.
ENDIF.
IF ( t_komv-waers = '%' OR t_komv-kschl = 'JSRC' OR
t_komv-kschl = 'JSRD' ).
IF t_komv-kschl = 'JSRC' .
g_percentage = t_komv-kbetr / 10.
ELSE.
g_percentage1 = t_komv-kbetr / 10.
ENDIF.
add t_komv-kwert to l_stax-amt.
ENDIF.
IF ( ( g_percentage IS NOT INITIAL AND
g_percentage1 IS NOT INITIAL ) AND
( t_komv-kschl = 'JSRE' OR t_komv-kschl = 'JSRF' OR
t_komv-kschl = 'JSER' OR t_komv-kschl = 'JSVD' OR
t_komv-kschl = 'JSRC' OR t_komv-kschl = 'JSRD') ).
g_mul = g_percentage * g_percentage1.
g_percentage3 = g_percentage + ( g_mul / 100 ).
l_stax-per = g_percentage3.
append l_stax to it_stax.
clear : g_percentage, g_percentage1.
ENDIF.
ENDLOOP.
thanks in advanced
‎2007 Feb 01 7:40 AM
First of all sort the Internal table.
And then loop at it.
Next, at end of the % Field, SUM.
And then move all the fields to may be another internal table.
And then endat and then endloop.
Now you can pass this new internal table to the smart form and get it printed.
‎2007 Feb 01 7:43 AM
Hi
U can store the condition in an internal table and collect the values in it.
DATA: BEGIN OF T_PERCENTAGE OCCURS 0,
KBETR(7) TYPE C,
KWERT LIKE KONV-KWERT,
END OF T_PERCENTAGE.
WRITE: T_KONV-KBETR CURRENCY '3' TO T_PERCENTAGE-KBETR.
T_PERCENTAGE-KWERT = T_KONV-KWERT.
COLLECT T_PERCENTAGE.Max
‎2008 Oct 31 12:06 PM
Hello,
thank you very much Max Bianchi.
Your answer helps me to understand, in VA03 tab condition price item, the difference between :
- value of field KOMV-KBETR (program SAPLV69A) displayed in DEBUG
-- DEBUG shows '20.000'
- and what is displayed in the corresponding screen field KOMV-KBETR (screen 640 of SAPLV69A).
-- the value displayed in the screen is '2,000'
Cordialement,
Chaouki.