‎2007 Nov 24 4:03 AM
sir, i like to know how can print total in sapscript, is it using separate variable for print total and also know how calculation performed in sapscript .
‎2007 Nov 24 4:08 AM
You can calculate the total in the separate variable and print it out in the SAPScript.
Regards,
Naimesh Patel
‎2007 Nov 24 4:10 AM
‎2007 Nov 24 11:20 AM
Hi Sandeep,
First of all you have to see wheather any variable/parameter is available in the Main window for printing total.
If Available then
You have to fill that by developing subroutine (as a seperate executable progam ) which you can call in the form by PERFORM <FORM NAME> IN PROGRAM <PROGRAM NAME> ENDPERFORM. If your driver program is standard one. If your driver program is Z program then you dont have to develop subroutine, you can develop logic in driver program itself....
If Not Available then
You have to define one variable at the end of the loop to add the all values in the total field. This has to be calculated in the subroutine again as stated above.
If any other query please let me know for more clarification ..
Reward Points....
Cheers....
Sagun Desai
‎2007 Nov 25 6:20 AM
Hi
Yes, you can define a variabe in your print program and pass it to the SAPScript.
LIKE:
Define L_SUM in the Global data.
DATA: L_SUM TYPE BSEG-DMBTR.
LOOP AT ITAB.
L_SUM = L_SUM + ITAB-AMOUNT.
ENDLOOP.
CALL FUNCTION 'WRITE_FORM'
WINDOW = 'MAIN'
ELEMENT = 'TOTAL'.
Now, in your SAPScript, create a text element in MAIN window
/E TOTAL
Total,, &L_SUM&.
Go through below link
http://sap-img.com/sapscripts/sapscript-how-to-calculate-totals-and-subtotals.htm
‎2007 Nov 25 6:25 AM