cancel
Showing results for 
Search instead for 
Did you mean: 

/: SUMMING in Sapscripts getting dump

Former Member
0 Kudos

hi,

i'm trying to make one total with SUMMING command in a sapscript.

With one PERFORM i get a total per position. And in sapscript i want to make the addition of all totals.

I make: SUMMING &X& INTO &Y&. Before i have declared Y with DEFINE Y = ' '.

I debug this and when the sapscript program goes through this item i get a dump.

It says:

+MOVE_TO_LIT_NOTALLOWED_NODATA

Assignment error: Overwriting a protected field

The program tried to assign a new value to a field even though

it is protected against changes.

The following objects are protected:

- Character or numeric literals,

- Constants (CONSTANTS),

- Function module and method parameters with the type IMPORTING

REFERENCE,

- Untyped field symbols to which a field has not yet been assigned

using ASSIGN,

- TABLES parameters, if the corresponding actual parameter is protected

against changes,

- USING reference parameters and CHANGING parameters in FORMS, if the

actual parameter is protected against changes,

- Field symbols, if the field assigned using ASSIGN is protected against

changes,

- External write access to attributes with the READ-ONLY property.

The field you want to overwrite is a parameter or a field symbol:

Declare the parameter as a VALUE parameter or pass an auxiliary field

to which you assigned the value from the constant before the call.

Alternatively, you can assign the auxiliary field to the field symbol

instead of the constant.+

I don't know what to do. ¿¿?? Please a little help for me.....

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

These are some of the test i had made:

1) I defined /:DEFINE .... at the top of sapscript with the object that de program only passes one time by the define sentence.

2) I defined /:DEFINE .... just over the sentence SUMMING.

3) I declared DATA Y LIKE .... in sapscript program.

Every test individual. I make one test and delete the other one. NO RESULTS. The dump persists.

former_member196280
Active Contributor
0 Kudos

I am not sure whether you are summing program symbol or not.. note summing is not possible if the program symbol is of character type as it has "," . For summing program symbol of type C remove "," and pass it to script.

FYI, for adding program symbol, we can work with sap script control command

/: summing <program-symbol> into <total symbol>

OR

From your replies, I understood that driver program is in your control why do you apply the below logic in your driver program

LOOP AT itab.

AT LAST.

SUM.

call your text element to write values.

ENDAT.

ENDLOOP.

Regards,

Sairam

Former Member
0 Kudos

Yes, yes, excuse me.

The sentence i had put was /: DEFINE &Y& = ' '. With &.

But the dumps continues.....

Former Member
0 Kudos

Hi,

change these,

/ : DEFINE &Y& = ' '.

then

SUMMING &X& INTO &Y&.

Regards

Sudheer