2005 Jul 27 5:23 PM
Hi,
I am using BAPI_OBJCL_CHANGE and BAPI_TRANSACTION_COMMIT to update the characteristics data but it is not getting updated but gives a success message.
I used BAPI_OBJCL_CONCATENATEKEY to generate a object key passing OBJECTTABLE as MARA and in OBJECTKEYTABLE values for matnr, and werks.
I am changing CHAR type characteristics and i gave the characteristics name in CHARAT and the new characteristics value in VALUE_NEUTRAL.
Any help regarding,
1. Populating the ALLOCVALUESNUMNEW, ALLOCVALUESCHARNEW,
ALLOCVALUESCURRNEW tables,
2. Creating a object key for a material.
Thanks in Advance,
Kathir~
2005 Jul 27 10:09 PM
Hi,
I used this FM to change class characteristics for batches without problems.
I used call:
CALL FUNCTION 'BAPI_OBJCL_CHANGE'
EXPORTING
OBJECTKEY = OBJECTNAME
OBJECTTABLE = 'MCHA'
CLASSNUM = CLASS
CLASSTYPE = '022'
TABLES
ALLOCVALUESNUMNEW = ALLOCVALUESNUM
ALLOCVALUESCHARNEW = ALLOCVALUESCHAR
ALLOCVALUESCURRNEW = ALLOCVALUESCURR
RETURN = RETURN.
variable OBJECTNAME contains concatenation of matnr, plant and batch, CLASS contains class name.
I think that if you are using 'MARA' you should only use matnr in key without werks.
Krzys
Hi,
I am using BAPI_OBJCL_CHANGE and BAPI_TRANSACTION_COMMIT to update the characteristics data but it is not getting updated but gives a success message.
I used BAPI_OBJCL_CONCATENATEKEY to generate a object key passing OBJECTTABLE as MARA and in OBJECTKEYTABLE values for matnr, and werks.
I am changing CHAR type characteristics and i gave the characteristics name in CHARAT and the new characteristics value in VALUE_NEUTRAL.
Any help regarding,
1. Populating the ALLOCVALUESNUMNEW, ALLOCVALUESCHARNEW,
ALLOCVALUESCURRNEW tables,
2. Creating a object key for a material.
Thanks in Advance,
Kathir~
2005 Jul 27 5:25 PM
I went through some of the forum threads but nothing turned to be fruitful.
Thanks in advance
Kathir~
2005 Jul 27 10:09 PM
Hi,
I used this FM to change class characteristics for batches without problems.
I used call:
CALL FUNCTION 'BAPI_OBJCL_CHANGE'
EXPORTING
OBJECTKEY = OBJECTNAME
OBJECTTABLE = 'MCHA'
CLASSNUM = CLASS
CLASSTYPE = '022'
TABLES
ALLOCVALUESNUMNEW = ALLOCVALUESNUM
ALLOCVALUESCHARNEW = ALLOCVALUESCHAR
ALLOCVALUESCURRNEW = ALLOCVALUESCURR
RETURN = RETURN.
variable OBJECTNAME contains concatenation of matnr, plant and batch, CLASS contains class name.
I think that if you are using 'MARA' you should only use matnr in key without werks.
Krzys
2005 Jul 28 6:12 PM
I tried using this Function Module to change the Classification data. There is Authroization object 'C_ROUT' which is preventing me to Make the changes thru the Program. The Same Authorization object allows me to change the values of characteristics when i manully go to the transaction(It is also triggered in the Transaction).
what do i do now? Please let me know.
2005 Jul 29 4:25 PM
Hello,
Check out with your BASIS people and get the necessary authorizations.
You can use Tx. SU53 to check the authorizations availability.
Hope this helps you.
Regds, Murugesh AS
2010 Oct 27 7:18 AM
>
> Hi,
>
> I used this FM to change class characteristics for batches without problems.
> I used call:
> CALL FUNCTION 'BAPI_OBJCL_CHANGE'
> EXPORTING
> OBJECTKEY = OBJECTNAME
> OBJECTTABLE = 'MCHA'
> CLASSNUM = CLASS
> CLASSTYPE = '022'
> TABLES
> ALLOCVALUESNUMNEW = ALLOCVALUESNUM
> ALLOCVALUESCHARNEW = ALLOCVALUESCHAR
> ALLOCVALUESCURRNEW = ALLOCVALUESCURR
> RETURN = RETURN.
> variable OBJECTNAME contains concatenation of matnr, plant and batch, CLASS contains class name.
>
> I think that if you are using 'MARA' you should only use matnr in key without werks.
>
> Krzys
how to create object key from (matnr, plant and batch)?
2005 Jul 28 6:38 AM
Hi,
Thanks for that info.
The Problem i am facing is that the BAPI gives a success message but does not update it even after giving a commit.
Kathir~
2005 Jul 28 7:39 AM
May be success message is misleading...
Anyway have you searched OSS for notes ?
I don't know what version of system are you using but you can look for example at: 301244, 328259 ...
Krzys
2005 Jul 28 4:21 PM
Thanks for the information.
Will do a bit of work on the same.
Cheers
Kathir~
2005 Jul 29 4:20 PM
Hi NagaSekhar,
I would like to suggest you to post your query as a separate thread. That will help you in gettng your problem solved much faster.
If i find any related info surely i will pass on.
Cheers,
Kathir~
2005 Dec 05 7:39 PM
Assign the new characteristic value to VALUE_CHAR and VALUE_NEUTRAL before passing it to BAPI_OBJCL_CHANGE, then calling BAPI_TRANSACTION_COMMIT should do the trick.
2005 Dec 05 9:57 PM
Hi,
try BAPI_OBJCL_CREATE instead of change if there is no value assigned to the characteristic before. I don't remember quite well but I guess some time ago that solved my problem in this case.
Good luck
Hans-Jürgen
2021 Dec 30 7:49 PM
Hi,
preliminary source code
DATA: lv_cuobj TYPE cuobj_bm.
DATA: ls_inob TYPE inob.
DATA: lt_allocvalueschar TYPE TABLE OF bapi1003_alloc_values_char WITH HEADER LINE .
DATA: ls_allocvalueschar LIKE LINE OF lt_allocvalueschar.
DATA: lt_allocvaluesnum TYPE TABLE OF bapi1003_alloc_values_num WITH HEADER LINE.
DATA: lt_allocvaluescurr TYPE TABLE OF bapi1003_alloc_values_curr WITH HEADER LINE.
DATA: lt_returnmessages TYPE TABLE OF bapiret2 WITH HEADER LINE.
DATA: ls_ret TYPE bapiret2.
DATA: lt_object TYPE TABLE OF bapi1003_object_keys WITH HEADER LINE.
DATA: ls_object TYPE bapi1003_object_keys.
DATA: lv_stand TYPE stdclass.
DATA: lv_status TYPE clstatus.
DATA: lv_classtype LIKE bapi1003_key-classtype.
DATA: lv_classnum LIKE bapi1003_key-classnum.
DATA: lv_objectkey LIKE bapi1003_key-object.
DATA: lv_objecttable LIKE bapi1003_key-objecttable.
DATA: lv_object LIKE bapi1003_key-object.
DATA: lv_stat TYPE bapi1003_key-status VALUE '1'.
SELECT SINGLE cuobj_bm FROM mch1 INTO lv_cuobj
WHERE matnr = pi_matnr
AND charg = pi_charg.
IF sy-subrc = 0.
SELECT SINGLE * FROM inob INTO ls_inob WHERE cuobj = lv_cuobj.
IF sy-subrc = 0.
MOVE ls_inob-klart TO lv_classtype.
MOVE 'Z_BATCH' TO lv_classnum.
MOVE ls_inob-obtab TO lv_objecttable.
CLEAR: ls_object.
ls_object-key_field = 'MATNR'.
ls_object-value_int = pi_matnr.
APPEND ls_object TO lt_object.
CLEAR: ls_object.
ls_object-key_field = 'CHARG'.
ls_object-value_int = pi_charg.
APPEND ls_object TO lt_object.
CALL FUNCTION 'BAPI_OBJCL_CONCATENATEKEY'
EXPORTING
objecttable = lv_objecttable
IMPORTING
objectkey_conc = lv_object
TABLES
objectkeytable = lt_object
return = lt_returnmessages.
lv_objectkey = lv_object.
CALL FUNCTION 'DEQUEUE_ALL'
EXPORTING
_synchron = 'X'.
CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
EXPORTING
objectkey = lv_objectkey
objecttable = lv_objecttable
classnum = lv_classnum
classtype = lv_classtype
unvaluated_chars = 'X'
IMPORTING
status = lv_status
standardclass = lv_stand
TABLES
allocvaluesnum = lt_allocvaluesnum
allocvalueschar = lt_allocvalueschar
allocvaluescurr = lt_allocvaluescurr
return = lt_returnmessages.
IF sy-subrc = 0.
SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}.L0S32 {
color: #3399FF;
}.L0S33 {
color: #4DA619;
}.L0S52 {
color: #0000FF;
}.L0S55 {
color: #800080;
}.L0S70 {
color: #808080;
}
1. do changes in
lt_allocvaluesnum in loop for all required/changed characteristisc
example
LOOP AT lt_allocvaluesnum WHERE charact = 'xxx' OR charact = 'yyy'.
PERFORM char2fltp USING pi_api_mix_date CHANGING lv_api_mix_date_fltp.
MOVE: lv_api_mix_date_fltp TO lt_allocvaluesnum-value_from.
MODIFY lt_allocvaluesnum TRANSPORTING value_from.
ENDLOOP.
2. delete all initial lines from table - because in other way all values will be overwriten by initial values.
worst case in characteristics have values assigned in CT04. Then many error will appear during update because system will try to set ZERO/INITAL value in characteristic where ZERO/INITIAL is not defined in CT04
DELETE lt_allocvaluesnum WHERE value_from IS INITIAL.
CALL FUNCTION 'DEQUEUE_ALL'
EXPORTING
_synchron = 'X'.
"Apply the characteristics to the batch.
CALL FUNCTION 'BAPI_OBJCL_CHANGE'
EXPORTING
objectkey = lv_objectkey
objecttable = lv_objecttable
classnum = lv_classnum
classtype = lv_classtype
* IMPORTING
* classif_status = lv_status
TABLES
allocvaluesnumnew = lt_allocvaluesnum
allocvaluescharnew = lt_allocvalueschar
allocvaluescurrnew = lt_allocvaluescurr
return = lt_returnmessages.
LOOP AT lt_returnmessages.
PERFORM add_single_message USING pi_loghandle lt_returnmessages-id
lt_returnmessages-number
lt_returnmessages-type
lt_returnmessages-message_v1
lt_returnmessages-message_v2
lt_returnmessages-message_v3
lt_returnmessages-message_v4.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
at the end 2 message should be populated CL737 and CL506SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; }.L0S31 { font-style: italic; color: #808080; }.L0S33 { color: #4DA619; }.L0S52 { color: #0000FF; }.L0S55 { color: #800080; }.L0S70 { color: #808080; } SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; }.L0S33 { color: #4DA619; }.L0S52 { color: #0000FF; }.L0S55 { color: #800080; }SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; }.L0S31 { font-style: italic; color: #808080; }.L0S33 { color: #4DA619; }.L0S52 { color: #0000FF; }.L0S55 { color: #800080; }.L0S70 { color: #808080; }SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; }
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |