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

sapscripts

Former Member
0 Likes
603

Hello,

Iam working with scripts,

I have to give totals for my line items.i have to write a code in my form painter.

See if there is one item then one total price value is displaying,if there is 2 or 3 means then also the total price values are coming,but the problem i need the code for summing of all the line items at the end.

if it is one value then the total has to come.

if the values are two means then also the total has to come for the two values. When ever the item nos. are increasing the total price values are also increasing. I need totals for this all the line items when ever it is increasing.

Pls send me the Pseudo code.

Urgent.

thank You.

5 REPLIES 5
Read only

dani_mn
Active Contributor
0 Likes
572

Hi you can't write code in form painter you have to write in a print program.

Or you can call a form from the form editor.

For SUMMING, use SUM statement.

LOOP AT itab.

AT LAST.

SUM.

call your text element to write values.

ENDAT.

ENDLOOP.

Regards,

Wasim Ahmed

Read only

Former Member
0 Likes
572

Hi Amit,

The Internal Table values will be given from the driver program only. So what you can do is calculate the total value in the program like.

loop at i_tab.

sum.

ws_value = i_tab-total.

endloop.

Now your entire value of all the line items will be in ws_value.

You can display this variable in your script. This variable will have the total value of all the line items in the internal table.

Reply back if you have any doubts.

Regards,

Tushar

Read only

Former Member
0 Likes
572

HI,

loop at itab.

call the finction module (to display line items)

with Element ex: ELE1

at last.

sum.

call the finction module (to display line items total)

with Element ex: ELE2

endat.

endloop.

Read only

Former Member
0 Likes
572

hi

You simply needs to add the statement sum in at-last. Here is the pseudo code.

loop at itab.

//to display line items

at last.

sum.

//Display line items total

endat.

endloop.

Hope this info is useful

Regards,

Richa

Read only

Former Member
0 Likes
572

Hi,

I think that you put the sum value in loop.Please check your code once.

Cheers,

Bujji