2014 Oct 06 8:57 PM
Hello All,
I'm updating batch characteristics using FM BAPI_OBJCL_CHANGE. It's working fine for characteristics that have only 1 value, but it's not updating characteristics with multiple values.
Example:
Characteristic: XX_COUNTRY
VALUE: CANADA
Characteristic: XX_COUNTRY
VALUE: CHILE
After program execution if you check trx MSC3N you only get value CHILE.
I tried to add multiple values with instance field like the code below but it's not working.
LOOP AT mchb INTO ls_mchb
WHERE matnr IS NOT INITIAL
AND charg IS NOT INITIAL.
ls_batch_char_c-charact = 'XX_COUNTRY'.
ls_batch_char_c-instance = ls_batch_char_c-instance + 1.
ls_batch_char_c-value_char = ls_mchb-grw_loc.
APPEND ls_batch_char_c TO lt_batch_char_c.
ENDLOOP.
Is there any way to add multiple values for characteristics?
Thanks in advance for your help!
Emanuel.
2014 Oct 07 7:56 AM
Hi,
In MSC2N can You input multiple values ?
If not, please check characteristic in CT04 transaction.
I've made test and can provide multiple values using this FM without problems, part of code:
DATA:
lt_allocchar TYPE TABLE OF bapi1003_alloc_values_char,
ls_allocchar TYPE bapi1003_alloc_values_char.
ls_allocchar-charact = 'ZNUM_SERT'.
ls_allocchar-value_char = 'ABC'.
APPEND ls_allocchar TO lt_allocchar.
ls_allocchar-charact = 'ZNUM_SERT'.
ls_allocchar-value_char = 'DEF'.
APPEND ls_allocchar TO lt_allocchar.
CALL FUNCTION 'BAPI_OBJCL_CHANGE'
EXPORTING
OBJECTKEY = l_objkey
OBJECTTABLE = 'MCH1'
CLASSNUM = 'Z_FERT'
CLASSTYPE = '023'
TABLES
RETURN = lt_ret[]
ALLOCVALUESNUMNEW = lt_allocnum[]
ALLOCVALUESCHARNEW = lt_allocchar[]
ALLOCVALUESCURRNEW = lt_alloccurr[].
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
2014 Oct 07 7:56 AM
Hi,
In MSC2N can You input multiple values ?
If not, please check characteristic in CT04 transaction.
I've made test and can provide multiple values using this FM without problems, part of code:
DATA:
lt_allocchar TYPE TABLE OF bapi1003_alloc_values_char,
ls_allocchar TYPE bapi1003_alloc_values_char.
ls_allocchar-charact = 'ZNUM_SERT'.
ls_allocchar-value_char = 'ABC'.
APPEND ls_allocchar TO lt_allocchar.
ls_allocchar-charact = 'ZNUM_SERT'.
ls_allocchar-value_char = 'DEF'.
APPEND ls_allocchar TO lt_allocchar.
CALL FUNCTION 'BAPI_OBJCL_CHANGE'
EXPORTING
OBJECTKEY = l_objkey
OBJECTTABLE = 'MCH1'
CLASSNUM = 'Z_FERT'
CLASSTYPE = '023'
TABLES
RETURN = lt_ret[]
ALLOCVALUESNUMNEW = lt_allocnum[]
ALLOCVALUESCHARNEW = lt_allocchar[]
ALLOCVALUESCURRNEW = lt_alloccurr[].
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
2014 Oct 14 4:03 PM
Thanks!
It was a program error. I was not using correct data for the BAPI.
Regards!
2014 Oct 07 8:03 AM
Hi,
Did you try checking the threads
http://scn.sap.com/thread/1816534
http://scn.sap.com/thread/544274
Regards,
K.S
2014 Oct 15 6:53 AM
I have tried using the same BAPI for updating characteristics data with multiple values. Instance counter (ATZHL) should be specified and data should be placed correctly in their corresponding tables depending on the format (NUM, CHAR, CURR)