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: 

Sum of field

Former Member
0 Kudos

Hi Everybody,

Can we sum a field in Layout(SAPScript) itself.

Although it can be calculated in Print Program and sent to Layout but if it can be done in Layout itself then nothing like that.

Thanks in advance.

Regards,

Deva Jyothi Singh

1 ACCEPTED SOLUTION

Vinod_Chandran
Active Contributor
0 Kudos

Hi,

Please try this(from SAP help),

The SUMMING command is used for accumulating a total value for a program symbol. The command should be specified just once. Then, each time the specified program symbol is formatted, its current value is added into the total symbol. Several program symbols may all be added into a single total symbol.

Syntax:

/: SUMMING program_symbol INTO total_symbol

SAPscript cannot create the field for the total dynamically. The summing symbol used for totalling must be declared with TABLES in the ABAP program. Otherwise, only zero is added. Declaring the symbol with the DATA statement is not sufficient (global data).

Thanks

Vinod

3 REPLIES 3

Vinod_Chandran
Active Contributor
0 Kudos

Hi,

Please try this(from SAP help),

The SUMMING command is used for accumulating a total value for a program symbol. The command should be specified just once. Then, each time the specified program symbol is formatted, its current value is added into the total symbol. Several program symbols may all be added into a single total symbol.

Syntax:

/: SUMMING program_symbol INTO total_symbol

SAPscript cannot create the field for the total dynamically. The summing symbol used for totalling must be declared with TABLES in the ABAP program. Otherwise, only zero is added. Declaring the symbol with the DATA statement is not sufficient (global data).

Thanks

Vinod

0 Kudos

Thanx a lot. I probably couldn't clearly explain my problem.

I'm trying to sum the value of all the items in a purchase requisition. I have developed a SAPScript for the purchase requisition print and have to put the total value of the items. I can do this by calculating in Print Program and sending it to Layout. But is there a way like SUMMING which will do it in Layout itself.

SUMMING works for program-symbols only, I suppose.

Thanx again. And please help.

Regards,

Deva.

0 Kudos

Hi Deva,

You can still use this. I think you are passing the item value (e.g. i_pr-value) to sapscript for displaying.

Now you can write the command as:

/: SUMMING &i_pr-value& INTO &<table-field>&