Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI_OBJCL_CHANGE to change/create 2 Material Characteristics

Former Member
0 Likes
3,832

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,315

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

5 REPLIES 5
Read only

Former Member
0 Likes
1,315

Can you send us your code?

Ganga

Read only

Former Member
0 Likes
1,315

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.

Read only

Former Member
0 Likes
1,316

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.

Read only

0 Likes
1,315

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

Read only

Former Member
0 Likes
1,315

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