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: 

Using Sum field in Sap script

Former Member
0 Kudos

Hi all,

I am trying to add content of field (Tax VAT) in sap script and put into another symbol using following command

/:SUMMING program symbol INTO sum symbol

but after running me22n tcode to display the PO error occured

<b>Overwriting a protected field</b>Error analysis

The program tried to assign a new value to the field "<SM_SUM>" even though

it is protected against changes.

I am modifying medruck std PO script and using standard prog. for it i.e. SAPFM06P.

Please tell me wheather it is necessary to make sum symbol dynamically define in SAPFM06P and how to do this.

with regards

Rajvinder Sahni

1 REPLY 1

Former Member
0 Kudos

Hi...

If you need to summ numbers or do any operation, in your SAP Script you can call subritunes and do all the operations you need.

On your SAP script write:

/: PERFORM subrutine IN PROGRAM Zprogram

/: USING &PAR1&

/: CHANGING &PAR2&

/: ENDPERFORM

PS: You can use as many USING AND CHANGING as you need.

And the zprogram goes;

FORM subrutine TABLES t_in STRUCTURE itcsy

t_out STRUCTURE itcsy.

data: par1 type n.

  • Read the value on PAR1

READ TABLE t_in WITH KEY 'PAR1'.

CHECK sy-subrc = 0.

PAR1 = t_IN-value.

  • DO WHATEVER YOU NEED TO DO

ADD 1 TO PAR1.

....

  • SEND THE VALUES BACK

READ TABLE t_OUT WITH KEY 'PAR2'.

t_sal-value = PAR1 .

MODIFY t_OUT INDEX sy-tabix.

ENDFORM.

Hope this helps,

Gabriel