Skip to Content
author's profile photo Former Member
Former Member

BPS formula exit err: field is entirely or partly protected against changes

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). how to resolve this problem for changing a character value?

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 07, 2007 at 10:47 AM

    Hi,

    I'm not the expert in exits, but I'm pretty sure you cannot change characteristic values. Only key figure values ...

    To change characteristic values you need to repost data, use derivation or other tools.

    D

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello,

      Yes I agree with what Dries says. You never really change a characteristic value but instead you repost the record, derive, and so on...

      So you could create a planning sequence where :

      - 1st step you repost your record to the desired char value

      - 2nd step you update your key figure value

      Rgds,

      Jeoffrey

  • author's profile photo Former Member
    Former Member
    Posted on Sep 07, 2007 at 08:37 PM

    Hi,

    This is an ABAP standard you cannot change a key field in a hashed table (all characteristics are key fields). Please delete the original record and create another one with the calculated field and the new characteristic value (<cl_yn> = 'Y'.) Let me know if you need help with this.

    thanks

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      HI, Anand Jain,

      Could you please give me a step by step guide on coding to delete original record and create a new one ? I mean work this by formula exit, not by repost (standard function). Because I have to realize other complex logic in the exit, which isn't shown in the sample coding.

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 12:42 AM

    HI,

    You will need help of good ABAP programmer, not on a system right now so it might give syntax error. let me know if it works for you

    DATA: L_NEW_DATA_TABLE TYPE REF TO DATA.

    DATA: L_NEW_DATA_WA TYPE RED TO DATA.

    FIELD-SYMBOLS: <FS_NEW_DATA_TABLE> TYPE ANY TABLE,

    <FS_NEW_DATA_WA> TYPE ANY.

    CREATE DATA L_NEW_DATA_TABLE TYPE REF TO XTH_DATA.

    ASSIGN L_NEW_DATA_TABLE->* TO <FS_NEW_DATA_TABLE>.

    CREATE DATA L_NEW_DATA_WA TYPE LINE OF XTH_DATA.

    ASSIGN L_NEW_DATA_WA->* TO <FS_NEW_DATA_WA>.

    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>.

    <FS_NEW_DATA_WA> = <LS_DATA>.

    BREAK-POINT.

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

    ASSIGN COMPONENT 'S_KYFS' OF STRUCTURE <FS_NEW_DATA_WA> 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'.

    INSERT <FS_NEW_DATA_WA> INTO TABLE <FS_NEW_DATA_TABLE>.

    DELETE XTH_DATA.

    ENDLOOP.

    APPEND LINES OF TABLE <FS_NEW_DATA_TABLE> TO XTH_DATA.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      Sorry I don't have an ABAP key to code this and try out, can you please try this

      CREATE DATA L_NEW_DATA_TABLE LIKE XTH_DATA.

      ASSIGN L_NEW_DATA_TABLE->* TO <FS_NEW_DATA_TABLE>.

      and check in debugging mode if <FS_NEW_DATA_TABLE> shows as a table

      thanks

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.