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 - Adds characteristic

Former Member
0 Likes
1,949

Hi all,

I use the BAPI BAPI_OBJCL_CHANGE to change the characteristics of batches.

The BAPI works fine.

But now I have a case where the same BAPI is not changing the characteristic value the new one will be added to the classification.

I don't want to add the value. I always want to change the value.

Any ideas?

regards

Hi all,

I use the BAPI BAPI_OBJCL_CHANGE to change the characteristics of batches.

The BAPI works fine.

But now I have a case where the same BAPI is not changing the characteristic value the new one will be added to the classification.

I don't want to add the value. I always want to change the value.

Any ideas?

regards

7 REPLIES 7
Read only

Former Member
0 Likes
1,279

Hello,

Check this FM y we will use it

  • IN CASE THE CHARACTERISTICS ALREADY EXISTS CHANGE THEM

----


CALL FUNCTION 'BAPI_OBJCL_CHANGE'

EXPORTING

objectkey = y_lv_matnr

objecttable = y_lv_tabelle

classnum = y_lv_klasse_d

classtype = y_lv_klassenart

keydate = sy-datum

TABLES

allocvaluesnumnew = y_i_alloc_num

allocvaluescharnew = y_i_alloc_char

allocvaluescurrnew = y_i_alloc_curr

return = y_i_return.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = y_k_x.

----


  • IN CASE THE CHARACTERISTICS DO NOT EXISTS CREATE THEM

----


CALL FUNCTION 'BAPI_OBJCL_CREATE'

EXPORTING

objectkeynew = y_lv_matnr

objecttablenew = y_lv_tabelle

classnumnew = y_lv_klasse_d

classtypenew = y_lv_klassenart

keydate = sy-datum

TABLES

allocvalueschar = y_i_alloc_char

return = y_i_return.

Try in this way you will find the solution

Read only

0 Likes
1,279

Hi,

my problem is that FM BAPI_OBJCL_CHANGE is normally changing the classification

BUT NOW

i have one value which will be added with the same FM!!!!

regards

Read only

0 Likes
1,279

Hello

Before call FM BAPI_OBJCL_CHANGE you need call BAPI_OBJCL_GETDETAIL.

Then analyze returned characteristics. If necessary characteristic is present in classification - update this, if not present - do nothing (because it will be created).

Read only

0 Likes
1,279

Hi,

I have found the error. In the classification the characteristics value was configured to multiple lines.

But what do i have to configure that the BAPI make an update to the value and not an insert.

regards

Read only

0 Likes
1,279

Hello

From documentation for this FM:

This BAPI changes an existing classification, or creates the classification if it does not yet exist.

Try to use Instance counter in parameter table for multiple lines.....

Read only

0 Likes
1,279

I guess this mite be helpful as I used teh FM to modified the custom status.

w_objekinob = lips-matnr. " Material

w_objekinob+18 = lips-werks. " Shipping plant

w_objekinob+22 = lips-charg. " Batch #

wa_allocvaluescharnew-value_char = '71'.

wa_allocvaluescharnew-charact = 'CUSTOMS_STATUS'.

IF t_allocvaluescharnew[] IS NOT INITIAL.

gv_objek = w_objekinob.

CALL FUNCTION 'BAPI_OBJCL_CHANGE'

EXPORTING

objectkey = gv_objek

objecttable = 'MCHA'

classnum = 'BATCHMGT'

classtype = '022'

TABLES

allocvaluesnumnew = t_allocvaluesnumnew

allocvaluescharnew = t_allocvaluescharnew

allocvaluescurrnew = t_allocvaluescurrnew

return = t_return.

ENDIF.

Cheers,

Gita

Read only

Former Member
0 Likes
1,279

It was a program error..