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: 

Why am I getting overwriting of a protected field error?

kirpi
Explorer
0 Kudos
3,158

Hello all,

I'm new to abap and to this community. Wish I can be useful here in the future, after I get some experience on abap.
I wish to ask you a question regarding my simple project which should be pretty basic. But this is not the case at all right now. I keep getting this error on one end of the program whenever I double click etc. I know that this should be about pai but I dont have a pai! But on the other end I dont get this error. The ends are almost similar and I cant find much of a difference. Would someone please help me out here? Many thanks for reading.

1 ACCEPTED SOLUTION

Maciej_Domagała
Contributor
2,932

Check the declaration of your internal table named: gt_imported - make sure that:

a. it contains a field named SELKZ ;

b. it is not seen as read-only by the code that calls fm REUSE_ALV_GRID_DISPLAY (it might be treated as read-only if passed as an IMPORTING parameter into a class method for example).

regards

11 REPLIES 11

AlexGourdet
Product and Topic Expert
Product and Topic Expert
0 Kudos
2,932

Thank you for visiting SAP Community to get answers to your questions.

As you're looking to get most out of your community membership, please consider include a profile picture to increase user engagement & additional resources to your reference that can really benefit you:

I hope you find this advice useful, and we're happy to have you as part of SAP Community!

All the best,

Alex

Sandra_Rossi
Active Contributor
2,932

Please clarify the question. What do you double click? Any screenshot? What EXACT error message do you get? What is the corresponding ABAP code? Etc.

DominikTylczyn
Active Contributor
2,932

Why don't share your code, so we can help you more? Please make sure to format the source with the button.

kirpi
Explorer
0 Kudos
2,931

Of course, I'll do my best on answering. Please excuse me for sending such a late response as it was the evening time in here. Also keep in mind that I'm a total noob in abap so don't judge me 🙂 There are some explanations on the pictures as well.

When I click on the first option and run, alv comes up to the screen and its totally normal.

main.png

I double click on the alv on second option, on any cell of any column and I get the dump screen like the following.

dump.png

The first and second parts of the code are divided with includes, I copied and pasted all. There may be some redundant lines or blocks as I have been trying everything out for the code to work. Please don't mind them.

My question once again is, how can I get rid of the dump screen when I do anything at all, on the second screen? Thank you kindly.

Let me know if there's anything missing.


*
*THE FIRST SECTION (WHICH WORKS) 
*


 SELECT * FROM cdhdr
    INNER JOIN cdpos
    ON cdhdr~objectid EQ cdpos~objectid
    AND cdhdr~changenr EQ cdpos~changenr
    AND cdhdr~objectclas EQ cdpos~objectclas
    INNER JOIN makt
    ON makt~matnr EQ cdhdr~objectid
    INTO CORRESPONDING FIELDS OF TABLE gt_conjoined
    WHERE matnr IN selopt_m
    AND udate IN selopt_u
    AND spras EQ 'TR'
    AND cdhdr~objectclas EQ 'MATERIAL'
    AND tabname EQ 'MARA'
    AND cdpos~chngind EQ 'U'
    AND ( fname EQ 'ZZYENI'
    OR fname EQ 'ZZSTIP'
    OR fname EQ 'ZZESKI' )
      .
*  BREAK-POINT.
  gs_layout-coltab_fieldname = 'CELL_COLOR'.

  LOOP AT gt_conjoined INTO gs_conjoined.

    IF gs_conjoined-fname EQ 'ZZYENI'.
      gs_conjoined-fname = 'Yeni Değer'.
      CLEAR: gs_cell_color.
      gs_cell_color-fieldname = 'FNAME'.
      gs_cell_color-color-col = 2 .
      gs_cell_color-color-int = 1 .
      gs_cell_color-color-inv = 0 .
      APPEND gs_cell_color TO gs_conjoined-cell_color.
      MODIFY gt_conjoined FROM gs_conjoined.
    ELSEIF gs_conjoined-fname EQ 'ZZESKI'.
      gs_conjoined-fname = 'Eski Değer'.
      CLEAR: gs_cell_color.
      gs_cell_color-fieldname = 'FNAME'.
      gs_cell_color-color-col = 5 .
      gs_cell_color-color-int = 1 .
      gs_cell_color-color-inv = 0 .
      APPEND gs_cell_color TO gs_conjoined-cell_color.
      MODIFY gt_conjoined FROM gs_conjoined.
    ELSEIF gs_conjoined-fname EQ 'ZZSTIP'.
      gs_conjoined-fname = 'Supersession Tipi'.
      CLEAR: gs_cell_color.
      gs_cell_color-fieldname = 'FNAME'.
      gs_cell_color-color-col = 3 .
      gs_cell_color-color-int = 1 .
      gs_cell_color-color-inv = 0 .
      APPEND gs_cell_color TO gs_conjoined-cell_color.
      MODIFY gt_conjoined FROM gs_conjoined.
    ENDIF.
  ENDLOOP.

----

  TYPE-POOLS:slis.
  DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,
        gs_fieldcat TYPE slis_fieldcat_alv.
  "
  CLEAR: gs_fieldcat.
  gs_fieldcat-fieldname = 'MATNR'.
  gs_fieldcat-seltext_s = 'Malzeme'.
  gs_fieldcat-seltext_m = 'Malzeme'.
  gs_fieldcat-seltext_l = 'Malzeme'.
  gs_fieldcat-key = abap_true.
  gs_fieldcat-col_pos = 0.
  APPEND gs_fieldcat TO gt_fieldcat.

  CLEAR: gs_fieldcat.
  gs_fieldcat-fieldname = 'MAKTX'.
  gs_fieldcat-seltext_s = 'Tanım'.
  gs_fieldcat-seltext_m = 'Mlz. Tanımı'.
  gs_fieldcat-seltext_l = 'Malzeme Tanımı'.
  gs_fieldcat-col_pos = 1.
  APPEND gs_fieldcat TO gt_fieldcat.

  CLEAR: gs_fieldcat.
  gs_fieldcat-fieldname = 'USERNAME'.
  gs_fieldcat-seltext_s = 'Kullanıcı'.
  gs_fieldcat-seltext_m = 'Kullanıcı'.
  gs_fieldcat-seltext_l = 'Kullanıcı'.
  gs_fieldcat-col_pos = 2.
  APPEND gs_fieldcat TO gt_fieldcat.

  CLEAR: gs_fieldcat.
  gs_fieldcat-fieldname = 'UDATE'.
  gs_fieldcat-seltext_s = 'Tarih'.
  gs_fieldcat-seltext_m = 'Tarih'.
  gs_fieldcat-seltext_l = 'Tarih'.
  gs_fieldcat-col_pos = 3.
  gs_fieldcat-key = abap_true.
  APPEND gs_fieldcat TO gt_fieldcat.

  CLEAR: gs_fieldcat.
  gs_fieldcat-fieldname = 'UTIME'.
  gs_fieldcat-seltext_s = 'Saat'.
  gs_fieldcat-seltext_m = 'Saat'.
  gs_fieldcat-seltext_l = 'Saat'.
  gs_fieldcat-key = abap_true.
  gs_fieldcat-col_pos = 4.
  APPEND gs_fieldcat TO gt_fieldcat.

  CLEAR: gs_fieldcat.
  gs_fieldcat-fieldname = 'FNAME'.
  gs_fieldcat-seltext_s = 'Alan adı'.
  gs_fieldcat-seltext_m = 'Alan adı'.
  gs_fieldcat-seltext_l = 'Alan adı'.
  gs_fieldcat-col_pos = 5.
  APPEND gs_fieldcat TO gt_fieldcat.

  CLEAR: gs_fieldcat.
  gs_fieldcat-fieldname = 'VALUE_NEW'.
  gs_fieldcat-seltext_s = 'Yeni d.'.
  gs_fieldcat-seltext_m = 'Yeni değer'.
  gs_fieldcat-seltext_l = 'Yeni değer'.
  gs_fieldcat-col_pos = 6.
  APPEND gs_fieldcat TO gt_fieldcat.

  CLEAR: gs_fieldcat.
  gs_fieldcat-fieldname = 'VALUE_OLD'.
  gs_fieldcat-seltext_s = 'Eski d.'.
  gs_fieldcat-seltext_m = 'Eski değer'.
  gs_fieldcat-seltext_l = 'Eski değer'.
  gs_fieldcat-col_pos = 7.
  APPEND gs_fieldcat TO gt_fieldcat.


gs_layout-box_fieldname = 'SELKZ'.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
     I_CALLBACK_PROGRAM                = sy-repid
     I_CALLBACK_PF_STATUS_SET          = 'PF_STATUS_SET'
     I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
*     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*     I_CALLBACK_HTML_END_OF_LIST       = ' '
*     I_STRUCTURE_NAME                  =
*     I_BACKGROUND_ID                   = ' '
*     I_GRID_TITLE  =
*     I_GRID_SETTINGS                   =
      IS_LAYOUT     = gs_layout
      it_fieldcat   = gt_fieldcat
*     IT_EXCLUDING  =
*     IT_SPECIAL_GROUPS                 =
*     IT_SORT       =
*     IT_FILTER     =
*     IS_SEL_HIDE   =
*     I_DEFAULT     = 'X'
*     I_SAVE        = ' '
*     IS_VARIANT    =
     IT_EVENTS     = gt_events
*     IT_EVENT_EXIT =
*     IS_PRINT      =
*     IS_REPREP_ID  =
*     IT_ALV_GRAPHICS                   =
*     IT_HYPERLINK  =
*     IT_ADD_FIELDCAT                   =
*     IT_EXCEPT_QINFO                   =
*     IR_SALV_FULLSCREEN_ADAPTER        =
* IMPORTING
*     E_EXIT_CAUSED_BY_CALLER           =
*     ES_EXIT_CAUSED_BY_USER            =
    TABLES
      t_outtab      = gt_conjoined
    EXCEPTIONS
      program_error = 1
      OTHERS        = 2.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.


--------


  gs_event-name = slis_ev_pf_status_set.
  gs_event-form = 'PF_STATUS_SET'.
  APPEND gs_event TO gt_events.
  gs_layout-box_fieldname = 'SELKZ'.
  gs_layout-coltab_fieldname = 'CELL_COLOR'.


--------


*
*END OF THE FIRST SECTION
*
*THE SECOND SECTION (WHICH DOESNT WORK AS THE PICTURE SHOWN ABOVE)
*


SELECT * FROM zmm_supersession
    INTO TABLE gt_imported.

-----

  TYPE-POOLS:slis.
  DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,
        gs_fieldcat TYPE slis_fieldcat_alv.
  "
  CLEAR: gs_fieldcat.
  gs_fieldcat-fieldname = 'MATNR'.
  gs_fieldcat-seltext_s = 'Malzeme'.
  gs_fieldcat-seltext_m = 'Malzeme'.
  gs_fieldcat-seltext_l = 'Malzeme'.
  gs_fieldcat-key = abap_true.
  gs_fieldcat-col_pos = 0.
*  gs_fieldcat-emphasize = 'C400'.
  APPEND gs_fieldcat TO gt_fieldcat.

  CLEAR: gs_fieldcat.
  gs_fieldcat-fieldname = 'MAKTX'.
  gs_fieldcat-seltext_s = 'Tanım'.
  gs_fieldcat-seltext_m = 'Mlz. Tanımı'.
  gs_fieldcat-seltext_l = 'Malzeme Tanımı'.
  gs_fieldcat-col_pos = 1.
  APPEND gs_fieldcat TO gt_fieldcat.

  CLEAR: gs_fieldcat.
  gs_fieldcat-fieldname = 'USERNAME'.
  gs_fieldcat-seltext_s = 'Kullanıcı'.
  gs_fieldcat-seltext_m = 'Kullanıcı'.
  gs_fieldcat-seltext_l = 'Kullanıcı'.
  gs_fieldcat-col_pos = 2.
  APPEND gs_fieldcat TO gt_fieldcat.

  CLEAR: gs_fieldcat.
  gs_fieldcat-fieldname = 'UDATE'.
  gs_fieldcat-seltext_s = 'Tarih'.
  gs_fieldcat-seltext_m = 'Tarih'.
  gs_fieldcat-seltext_l = 'Tarih'.
  gs_fieldcat-col_pos = 3.
  gs_fieldcat-key = abap_true.
  APPEND gs_fieldcat TO gt_fieldcat.

  CLEAR: gs_fieldcat.
  gs_fieldcat-fieldname = 'UTIME'.
  gs_fieldcat-seltext_s = 'Saat'.
  gs_fieldcat-seltext_m = 'Saat'.
  gs_fieldcat-seltext_l = 'Saat'.
  gs_fieldcat-key = abap_true.
  gs_fieldcat-col_pos = 4.
  APPEND gs_fieldcat TO gt_fieldcat.

  CLEAR: gs_fieldcat.
  gs_fieldcat-fieldname = 'FNAME'.
  gs_fieldcat-seltext_s = 'Alan adı'.
  gs_fieldcat-seltext_m = 'Alan adı'.
  gs_fieldcat-seltext_l = 'Alan adı'.
  gs_fieldcat-col_pos = 5.
  APPEND gs_fieldcat TO gt_fieldcat.

  CLEAR: gs_fieldcat.
  gs_fieldcat-fieldname = 'VALUE_NEW'.
  gs_fieldcat-seltext_s = 'Yeni d.'.
  gs_fieldcat-seltext_m = 'Yeni değer'.
  gs_fieldcat-seltext_l = 'Yeni değer'.
  gs_fieldcat-col_pos = 6.
  APPEND gs_fieldcat TO gt_fieldcat.

  CLEAR: gs_fieldcat.
  gs_fieldcat-fieldname = 'VALUE_OLD'.
  gs_fieldcat-seltext_s = 'Eski d.'.
  gs_fieldcat-seltext_m = 'Eski değer'.
  gs_fieldcat-seltext_l = 'Eski değer'.
  gs_fieldcat-col_pos = 7.
  APPEND gs_fieldcat TO gt_fieldcat.


gs_layout-box_fieldname = 'SELKZ'.


    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
     I_CALLBACK_PROGRAM                = sy-repid
     I_CALLBACK_PF_STATUS_SET          = 'PF_STATUS_SET'
     I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
*     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*     I_CALLBACK_HTML_END_OF_LIST       = ' '
*     I_STRUCTURE_NAME                  =
*     I_BACKGROUND_ID                   = ' '
*     I_GRID_TITLE  =
*     I_GRID_SETTINGS                   =
      IS_LAYOUT     = gs_layout
      it_fieldcat   = gt_fieldcat
*     IT_EXCLUDING  =
*     IT_SPECIAL_GROUPS                 =
*     IT_SORT       =
*     IT_FILTER     =
*     IS_SEL_HIDE   =
*     I_DEFAULT     = 'X'
*     I_SAVE        = ' '
*     IS_VARIANT    =
     IT_EVENTS     = gt_events
*     IT_EVENT_EXIT =
*     IS_PRINT      =
*     IS_REPREP_ID  =
* IMPORTING
*     E_EXIT_CAUSED_BY_CALLER           =
*     ES_EXIT_CAUSED_BY_USER            =
    TABLES
      t_outtab      = gt_imported
    EXCEPTIONS
      program_error = 1
      OTHERS        = 2.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

-----

  gs_event-name = slis_ev_pf_status_set.
  gs_event-form = 'PF_STATUS_SET'.
  APPEND gs_event TO gt_events.
  gs_layout-box_fieldname = 'SELKZ'.
  gs_layout-coltab_fieldname = 'CELL_COLOR'.

*
*END OF THE SECOND SECTION.
*

Maciej_Domagała
Contributor
2,933

Check the declaration of your internal table named: gt_imported - make sure that:

a. it contains a field named SELKZ ;

b. it is not seen as read-only by the code that calls fm REUSE_ALV_GRID_DISPLAY (it might be treated as read-only if passed as an IMPORTING parameter into a class method for example).

regards

0 Kudos
2,931

IMPORTING parameter of method or function module, as people often use the old way

2,931

I appreciate your answer, thanks a lot. Update: it works fine now.

Sandra_Rossi
Active Contributor
0 Kudos
2,931

It's best to embed the images to have text and images at the same place, like this (all the text and images below are yours):

When I click on the first option and run, alv comes up to the screen and its totally normal.

I double click on the alv on second option, on any cell of any column and I get the dump screen like the following.

The first and second parts of the code are divided with includes, I copied and pasted all. There may be some redundant lines or blocks as I have been trying everything out for the code to work. Please don't mind them.

My question once again is, how can I get rid of the dump screen when I do anything at all, on the second screen? Thank you kindly.

kirpi
Explorer
0 Kudos
2,931

I will close the topic if your help can solve my problem but I couldn't try it yet because of other office work. I appreciate your answer, thanks a lot. I will let you know if there is anything else about my problem.

Kind regards.

0 Kudos
2,931

Thank you so much, the problem was in selkz as you suggested.

Sandra_Rossi
Active Contributor
2,931

I guess Maciej may not receive your appreciation. -> If you want to target someone, if this person has posted an Answer, use the button COMMENT, if this person is the Original Poster of the question he/she will be automatically informed, otherwise copy/paste their hyperlinked name so that the person receives a warning (NB: @ doesn't work/but typing this character will suggest hyperlinked names).

Please use the COMMENT button for comments, asking for complements, adding details, replying to a comment or a proposed solution or to the OP question, etc., ANSWER is only to propose a solution, dixit SAP text at the right of the answer area.