Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

display total in sapscript

Former Member
0 Likes
1,007

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 .

5 REPLIES 5
Read only

naimesh_patel
Active Contributor
0 Likes
657

You can calculate the total in the separate variable and print it out in the SAPScript.

Regards,

Naimesh Patel

Read only

Former Member
Read only

Former Member
0 Likes
657

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

Read only

Former Member
0 Likes
657

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

Read only

0 Likes
657

Hey Naresh,

You can't copy the code directly from one of the earlier post and just paste it here. It is not fare that you copy my code and without giving any credit just post it here.

Regards,

Naimesh Patel