Hi All,
Please help me out for this requirement.
I have an amount field reguh-rbetr. I need to show the sum of this field as TOTAL.
How can we do it? Please let me know. Is there any function in the script itself or do we need to calculate it in the program? Pl gimme example code.
Regards,
Priya
Hi
In the Program(if it is not the std program) itself you can calculate the totals for that field using LOOP..ENDloop..In between AT end of the doc use SUM..
and put it in a variable and print it in the script
If the program is not accessable then write a PERFORM Subroutine and create the program and calculate in that program and pass back to script
Regards
Anji
Hi
<b>SAPscripts How to calculate Totals and Subtotals</b>
I have some doubs in BDC and SMART FORMS. I want to change the material number using the transaction code MM02 through BDC.
In scripts and smartforms how to calculate totals and subtotals?
To calculate totals and sub totals in sap scripts you have to use subroutines.
Say if you have to add the unit price (KOMVD-KBERT) then in the main window whereever tat value is picked write this routine
/: DEFINE &TOT_PRICE&
/: PERFORM F_GET_PRICE IN PROGRAM <subroutine prog name> /:USING &KOMVD-KBERT& /:CHANGING &TOT_PRICE& /:ENDPERFORM
Then write the variable where ever you want it to be printed (mostly it will be in footer window)
Then create subroutine pool program and you have to write the code.
FORM F_GET_PRICE tables int_cond structure itcsy
outt_cond structure itcsy. data : value type kbert.
statics value1 type kbert.
Read int_cond table index 1.
value = int_cond-value.
value1 = value1 + value.
Read outt_cond table index 1.
outt_cond-value = value1.
Modify outt_cond index 1.
ENDFORM.
I have given a rough outline, please be aware of the variable conversions as Int_cond-value and outt_cond-value are characters.
Add a comment