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 symbol problem

Former Member
0 Kudos

Hi,

I am getting this short dump error .please advise what i need to do.

Error analysis

A new value is to be assigned to the field "<GFS_F1>", 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 problem is with this line <gfs_f1> = i_nodata. of below code.

FORM init_structures USING tabname tab i_nodata.
  REFRESH git_nametab.
  CALL FUNCTION 'NAMETAB_GET'
    EXPORTING
      langu          = sy-langu
      tabname        = tabname
    TABLES
      nametab        = git_nametab
    EXCEPTIONS
      no_texts_found = 1.
  LOOP AT git_nametab INTO gwa_nametab.
    CLEAR gfd_char.
    gfd_char(2)    = 'I_'.
    gfd_char+2(5)  = gwa_nametab-tabname.
    gfd_char+7(1)  = '-'.
    gfd_char+8(10) = gwa_nametab-fieldname.
    ASSIGN (gfd_char) TO <gfs_f1>.
    <gfs_f1> = i_nodata.
  ENDLOOP.
ENDFORM.                    "init_structures

Regards

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello Sanjay,

The possible reason for the error can be bcoz of the two two reasons.

Make shure you declare

field-symbols <gfs_f1> type DNTAB.

Map the data of the form parameter i_nodata to a another variable of type DNTAB.

Hope this helps,

Murthy.

8 REPLIES 8

guilherme_frisoni
Contributor
0 Kudos

Hi Sanjay,

i_nodata is in USING parameters of your form. If you want to change you have to declare i_nodata as CHANGING.

Regards,

Frisoni

Former Member
0 Kudos

Replace using by changing

0 Kudos

Hi,

I have done as advised by you but i am still getting the same error.

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

entirely or partly protected against changes."

I have used the data key word to declare "<GFS_F1>", and not constant then why it is giving this message.

Kindly advise.

Regards

Sm1tje
Active Contributor
0 Kudos

ASSIGN (gfd_char) TO <gfs_f1>.
    <gfs_f1> = i_nodata.

I guess this field <gfs_f1> is pointing to an internal table, correct? Is there a key field involved or sorted table? Give some more details on to what this fields symbol is pointing to (I_tabname-fieldname).

Former Member
0 Kudos

PLS FIND DETAILS AS BELOW.

DATA: gfd_char(21) TYPE c.

FIELD-SYMBOLS: <gfs_f1> .

Sm1tje
Active Contributor
0 Kudos

Ok, but what I meant was this: What is the content of the field symbol the moment the dump occurs. You are dynamically setting the value of this field symbol at runtime based on GIT_TABNAME.

Former Member
0 Kudos

Hello Sanjay,

The possible reason for the error can be bcoz of the two two reasons.

Make shure you declare

field-symbols <gfs_f1> type DNTAB.

Map the data of the form parameter i_nodata to a another variable of type DNTAB.

Hope this helps,

Murthy.

Former Member
0 Kudos

Hi Sanjay,

<gfs_f1> = i_nodata.

Here <gfs_f1> is assigned to have structure same as gfd_char.

And i_nodata , I assume , is an internal table.

You cannot assign internal table data to a workarea.

Here's what you can do:

Go in debugging mode.

Check what is the structure of both variables.

Only if both are similar , it can be copied.

Regards,

Nisha Vengal.