on 09-07-2007 10:10 AM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
to: Anand Jain
the coding below( at >>>) turns out a run error.
================================================
CREATE DATA L_NEW_DATA_WA LIKE LINE OF XTH_DATA.
ASSIGN L_NEW_DATA_WA->* TO <FS_NEW_DATA_WA>.
CREATE DATA L_NEW_DATA_TABLE LIKE TABLE OF XTH_DATA.
ASSIGN L_NEW_DATA_TABLE->* TO <FS_NEW_DATA_TABLE>.
.......
>>>INSERT <FS_NEW_DATA_WA> INTO TABLE <FS_NEW_DATA_TABLE>.
====================================================
In my opinion, declarartion of <FS_NEW_DATA_TABLE> is compatible to <FS_NEW_DATA_WA>. why this error occurs ? This is a really an abap problem...Thanks for your feedback...
error details is below:
========================
OBJECTS_WA_NOT_COMPATIBLE
Line types of an internal table and a work area not compatible.
The statement
"INSERT wa INTO TABLE itab"
requires the lines of the internal table "<FS_NEW_DATA_TABLE>" and the
work area " wa" to be compatible. Compatibility means
equivalence in the context of ABAP/4 type checking.
In this case, the condition is not satisfied because the internal table
"<FS_NEW_DATA_TABLE>" has the line type "l" and the length 8, but the work area
" wa"
has the type "/1SEM/_YS_DATA_800ZDPO8" and the length 104.
(If the work area " wa" is the header line of the internal
table "<FS_NEW_DATA_TABLE>", the above inconsistency can arise if an internal
table t with the line type T1 is passed to a subroutine (FORM or
FUNCTION) as an actual parameter and the corresponding formal
parameter p is declared in the subroutine by "TABLES p STRUCTURE T2".
If then T1 and T2 are incompatible, the header line p
has the type T2 (specifed by STRUCTURE), but the internal
table p has the line type T1 (passed from the actual parameter)).
======================================
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.