2010 Feb 18 2:07 PM
Hi,
I am using BAPI_OBJCL_CHANGE to change/create 2 Material Characteristics.
Create is working fine, but I am not able to change 2 characterics at the same time. If I try to change 1 at a time, it works fine.
When trying with 2characteristics, getting error
Entry " " is too long
Please help asap.
Thanks,
Ipsita
2010 Feb 19 7:27 AM
Hi,
You can try this way.
The problem may with the characteristic values.
So, what you can do is Go to CT04 and check for the Data type, Length and possible values of the all Characteristic for which
you are updating.There might be a mismatch.
And also When you use the FM to change BAPI_OBJCL_CHANGE, it will just over write the existing entries and will store the new values.
So, before doing update, please use the FM BAPI_OBJCL_GETDETAILS for getting all the existing characteristics.And for the same tables attach you new values and then pass it to BAPI_OBJCL_CHANGE.By this it will not affect the existing values.
Thanks & Regards,
Vamsi.
Hi,
I am using BAPI_OBJCL_CHANGE to change/create 2 Material Characteristics.
Create is working fine, but I am not able to change 2 characterics at the same time. If I try to change 1 at a time, it works fine.
When trying with 2characteristics, getting error
Entry " " is too long
Please help asap.
Thanks,
Ipsita
2010 Feb 18 2:25 PM
2010 Feb 18 3:55 PM
li_allocvalueschar-charact = 'X_NUMBER'.
li_allocvalueschar-value_char = l_x_atwrt.
li_allocvalueschar-value_neutral = l_x_atwrt.
APPEND li_allocvalueschar.
li_allocvalueschar-charact = 'Y_NUMBER''.
li_allocvalueschar-value_char = l_y_atwrt.
li_allocvalueschar-value_neutral = l_y_atwrt.
APPEND li_allocvalueschar.
CALL FUNCTION 'BAPI_OBJCL_CHANGE'
EXPORTING
objectkey = l_objectkey
objecttable = c_objecttable
classnum = c_classnum
classtype = c_classtype
STATUS = '1'
STANDARDCLASS =
CHANGENUMBER =
KEYDATE = SY-DATUM
TABLES
allocvaluesnumnew = li_allocvaluesnum
allocvaluescharnew = li_allocvalueschar
allocvaluescurrnew = li_allocvaluescurr
return = li_return
.
READ TABLE li_return WITH KEY type = 'E'.
IF sy-subrc EQ 0.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
IMPORTING
RETURN =
.
w_output-desc = 'Updation Failled'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
w_output-desc = 'Updated Successfully'.
ENDIF.
2010 Feb 19 7:27 AM
Hi,
You can try this way.
The problem may with the characteristic values.
So, what you can do is Go to CT04 and check for the Data type, Length and possible values of the all Characteristic for which
you are updating.There might be a mismatch.
And also When you use the FM to change BAPI_OBJCL_CHANGE, it will just over write the existing entries and will store the new values.
So, before doing update, please use the FM BAPI_OBJCL_GETDETAILS for getting all the existing characteristics.And for the same tables attach you new values and then pass it to BAPI_OBJCL_CHANGE.By this it will not affect the existing values.
Thanks & Regards,
Vamsi.
2010 Feb 19 7:37 AM
As Vamsi mentioned, the problem is definitely with characteristic values.
First fetch the existing char using "BAPI_OBJCL_GETDETAIL" Bapi.
then modify the characteristic values with your required values and then call "BAPI_OBJCL_CHANGE' BAPI.
This worked fine for me in one of my object.
Ganga
2010 Feb 19 9:22 AM
Thanks Ganga & Vamsi,
I was already using the BAPI_OBJCL_GETDETAIL in my program, but the problem lied in the field length, which I found by going to CT04.
Thanks a ton to both of U,
Ipsita