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

scripts- subtotals

Former Member
0 Likes
948

Hi,

how to get subtotals on each page of a script?

Regards,

pritha.

8 REPLIES 8
Read only

Former Member
0 Likes
888

Hi

Declare a variable like

/: DEFINE &TOTAL&

/ total = total + <&itab-netwr&>

and display the TOTAL field for subtotals

Reward points for useful Answers

Regards

Anji

Read only

0 Likes
888

Hi,

I already get the subtotals for each sales order no.

But for 1 order, there r about 200 records.

So they go on the next page.....the subtotlas gets printed after a sales order number.

but i want it on each page.

hope u r getting me......

plz reply

Read only

0 Likes
888

Hi,

print your subtotals in the footer window

Regards,

Sooness

Read only

0 Likes
888

Hi Sooness,

I m printing it on main window at the bottom.

I need the subtotals on each page.

if i m having a sales order number with 200 records, it gets it's subtotal at last but i want the subtotals on each page.

Thanks inadvance.

Points will be awarded.

pritha

Read only

0 Likes
888

Hi,

actually if you print it in the main window , it will be printed after aal displayed records.

So ,if you want to print it in all pages , try printing it in footer window instead.

You just have to update subtotal after each record or sales order using a perform.

Regards,

Sooness

Read only

dev_parbutteea
Active Contributor
0 Likes
888

<b>In scripts and smartforms how to calculate totals and subtotals?</b>

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.

Regards,

Sooness

Read only

Former Member
0 Likes
888

hi

good

SAP Printer commands in SAPScripts The command line in the editor must be as follows: /: PRINT-CONTROL xxxxx or /: PRINT-CONTROL 'xxxxx' where xxxxx stands for the five-character name of the print control. Example: /: PRINT-CONTROL ZM100 The complete printer command normally resides in the print control. If characters belonging to the print command follow after the print control in the text (only useful for the HPL2 printer driver for PCL-5 printers), the text line following after the PRINT-CONTROL command should begin with an equals sign (=) in the format column. Example: /: PRINT-CONTROL SESCP = *c5G If you do not use the equals sign, a space character is inserted between the print control SESCP and the character *c5G. Different font on the same line You can have different font on the same line by defining a character format. For example B for bold text and U for Underline. In your SAPScript apply like this : Underline Text<> Bold Text<> Print Footer notes only on the last page Command to used in your sapscripts :- /: IF &NEXTPAGE& EQ 0 whatever footer you want. /: ENDIF SAPscripts How to calculate Totals and Subtotals 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

thanks

mrutyun^

Read only

Former Member
0 Likes
888

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.

I have given a rough outline, please be aware of the variable conversions as Int_cond-value and outt_cond-value are characters.

Regards,

Bhaskar