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: 

field is entirely or partly protected against changes

Former Member
0 Kudos

I try to change a field of a hash table ( XTH_DATA as souce code below ), which is used in BI/BPS exit. It works well in changing a key figure ( which's in <kf_struct> as souce code below), but failed in changing a character ( which's in <ch_struct> as source code below).

The run error is:

===========

A new value is to be assigned to the field "<CL_YN>", although this field is

entirely or partly protected against changes.

The following are protected against changes:

- Character literals or numeric literals

- Constants (CONSTANTS)

- Parameters of the category IMPORTING REFERENCE for functions and

methods

- Untyped field symbols not yet assigned a field using ASSIGN

- TABLES parameters if the actual parameter is protected against changes

- USING reference parameters and CHANGING parameters for FORMs, if the

actual parameter is protected against changes and

- Accesses using field symbols if the field assigned using ASSIGN is

protected (or partially protected, e.g. key components of an internal

table with the type SORTED or HASHED TABLE) against changes

- Accesses using references, if the field bound to the reference is

protected (or partially protected) against changes

- External write accesses to READ-ONLY attributes,

- Content of a shared object area instance accessed using a shared lock

(ATTACH_FOR_READ).

===============================

The source code's below:

==================

FUNCTION zbps_001.

*"----


""Local Interface:

*" IMPORTING

*" REFERENCE(I_AREA) TYPE UPC_Y_AREA

*" REFERENCE(I_PLEVEL) TYPE UPC_Y_PLEVEL

*" REFERENCE(I_METHOD) TYPE UPC_Y_METHOD

*" REFERENCE(I_PARAM) TYPE UPC_Y_PARAM

*" REFERENCE(I_PACKAGE) TYPE UPC_Y_PACKAGE

*" REFERENCE(IT_EXITP) TYPE UPF_YT_EXITP

*" REFERENCE(ITO_CHASEL) TYPE UPC_YTO_CHASEL

*" REFERENCE(ITO_CHA) TYPE UPC_YTO_CHA

*" REFERENCE(ITO_KYF) TYPE UPC_YTO_KYF

*" EXPORTING

*" REFERENCE(ET_MESG) TYPE UPC_YT_MESG

*" CHANGING

*" REFERENCE(XTH_DATA) TYPE HASHED TABLE

*"----


FIELD-SYMBOLS:<ls_data> TYPE ANY,

<ch_struct> TYPE ANY,

<kf_struct> TYPE ANY,

<cl_yn> TYPE ANY,

<cl_quan> TYPE ANY.

LOOP AT xth_data ASSIGNING <ls_data>.

BREAK-POINT.

ASSIGN COMPONENT 'S_CHAS' OF STRUCTURE <ls_data> TO <ch_struct>.

ASSIGN COMPONENT 'S_KYFS' OF STRUCTURE <ls_data> TO <kf_struct>.

ASSIGN COMPONENT 'Z1YN' OF STRUCTURE <ch_struct> TO <cl_yn>.

ASSIGN COMPONENT '0QUANTITY' OF STRUCTURE <kf_struct> TO <cl_quan>.

<cl_quan> = <cl_quan> * 2.

<cl_yn> = 'Y'.

ENDLOOP.

ENDFUNCTION.

1 ACCEPTED SOLUTION

franois_henrotte
Active Contributor

try to set the checkbox "Pass value" of your parameter XTH_DATA

currently it is passed by reference and you loop at it with an assign statement

this is probably the reason of error

2 REPLIES 2

franois_henrotte
Active Contributor

try to set the checkbox "Pass value" of your parameter XTH_DATA

currently it is passed by reference and you loop at it with an assign statement

this is probably the reason of error

0 Kudos

works like a charm after this change