cancel
Showing results for 
Search instead for 
Did you mean: 

Totals n Subtotals in scripts?

Former Member
0 Kudos

hi,

How to find totals n sub totals of currency n quantity fields in SCRIPTS?

Nayak.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

HI,

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.

To know more, have a look at this thread ..

Kishore.

Answers (1)

Answers (1)

amit_khare
Active Contributor
0 Kudos

Write a subroutine to find the total & sub totals in the script as with in script you cant do it since script dont recognize mathematical calculations.

e.g. PERFORM <FORM_NAME> into <INCLUDE_NAME>.

Regards,

Amit

Reward all helpful replies.