Application Development 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: 

subtotal in sap script

Former Member
0 Kudos

Hi,

How do we code for subtotal in sap script. The scenario is i have to total the extended price field (dmbtr) and that is subtotal.

Another doubt: how do i code division operator . ie. dividing quantity by extended price? in sap script i know i have to introduce a variable. kindly give me how do i code.

3 REPLIES 3

Former Member
0 Kudos

Hi,

Actually you cannot code division operator directly in the SAP Script form.SAP Script consists of two things i) SAP Script form(use SE71 to explore it) and ii) Driver program.

Script form(or) Layout set:

-


It specifies the layout of the output(where to put what).

Driver program:

-


It will have all the logic(for example selecting records from required tables for displaying the layout set and processing logic, for eg: Multiplication, division etc).

so, in your case you need to calculate the sub total in the driver program using a global variable and use the same variable name in the Layout set at the required position for printing the subtotal in output.

For eg: For your case consider w_qty(quantity variable), w_ext_prc(extended price) and if w_sub_tot is the subtotal field.

you can code the following logic in the driver program.

w_sub_tot = w_ext_prc / w_qty.

In the Layout set, you can use the &w_qty& to print the subtotal value in the output.

Hope this helps.....

Former Member
0 Kudos

hi,

u can use SUM keyword in script.

as

/: If &itab-pernr&.

/: sum.

/:

and to declare a variable use && as

for ex: &&suresh = 13.

/: write &&suresh.

if helpful reward some points.

with regards,

Suresh Aluri.

Former Member
0 Kudos