Application Development 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: 

BAPI - BAPI_OBJCL_CHANGE error

Former Member
0 Kudos

Dear Expert,

Please suggest.

I am getting following error for BAPI - BAPI_OBJCL_CHANGE

Type = 'E' Number = 117 message ='Class type 023, object type MCHA, object 9030200000        PIPLPAPA3'

Type = 'E' Number = 656 message ='Table   not supported for class type 023'

Type = 'I' Number = 736 message ='Assignment was not created'

following are my input parameter for the same.

objectkey                = '9030200000        PIPLPAPA3     '

objecttable              = 'MCHA' ( Also tried for table MARA , MCH1)

classnum                = 'PIPFLUX_CLASS'

classtype                = '023'

Regards

Vaman kamat

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello Vaman,

You should be using table MCH1 for class type 023. It seems that error is caused because of the Object key. Are you sure it is the right key ? Can you please confirm this key in table INOB ?

Thanks

Amber

5 REPLIES 5

Former Member
0 Kudos

Hello Vaman,

You should be using table MCH1 for class type 023. It seems that error is caused because of the Object key. Are you sure it is the right key ? Can you please confirm this key in table INOB ?

Thanks

Amber

Former Member
0 Kudos

Thanks Amber,

I have check table INOB record exists and following are the fields value.

CUOBJ = 185

KLART  = 023

OBTAB = MARA

OBJEK = 9030200000

and object key which is passed is a combination of Stockno(18)+Plant(4)+Batch(10)

with the help of function module = 'BAPI_OBJCL_CONCATENATEKEY'

Please help me how do check this and based on table output what should be my parameters.

Regards

Vaman kamat

0 Kudos

Hi Vaman,

I am a bit confused. The object seems to be MARA . Do you want to change the assignment or create a new assignment ?BAPI_OBJCL_CHANGE is to change the assignment but if it doesnot exist then it creates a new assignment. If you are changing the assignment then the parameters should be the following ...

OBJECTKEY                       9030200000

OBJECTTABLE                   MARA

CLASSNUM                         Class number of the class that is assigned (KLAH-CLASS)

CLASSTYPE                       023

STATUS                              1

But if you want to create an assignment then please provide more details on what you want to be created ?

Thanks

Amber

Former Member
0 Kudos

Thanks Amber,

'BAPI_OBJCL_CHANGE' is used to for updating characteristics in MSC2N t-code,

for the combination of Stock no/Plant/Batch/SLoc.

Yes, you are right i am also passing additional details in BAPI table = "allocvaluesnumnew" .

As suggested i have changed parameter.

OBJECTKEY                       9030200000

OBJECTTABLE                             MARA

CLASSNUM                        PIPFLUX_CLASS

CLASSTYPE                       023

STATUS                          1

Getting folowing error

Number = 117 Class type 023, object type MARA, object 9030200000\

Number = 821 Inconsistent characteristic value assignment

Number = 738 The assignment was not changed

For your reference below is the ABAP code.

Please guide me what are the other changes required.

DATA : lv_value TYPE  bapi1003_alloc_values_num-value_from. "ATFLV

  REFRESH :  git_cabn,

             git_ksml,

             git_object,

             git_rettab.

  CLEAR :    gwa_cabn,

             gwa_ksml,

             gwa_object,

             gwa_rettab.

break : sap_abap_x6.

* example of an object key 00000000000730000007505847897897

  DATA: w_object LIKE bapi1003_key-object,

        p_klart LIKE klah-klart,

        p_class LIKE klah-class.

  CLEAR : gv_objek, gv_obtab, gv_klart, gv_class.

  CALL FUNCTION 'VB_BATCH_2_CLASS_OBJECT'

    EXPORTING

      i_matnr = p_gwa_wbdata_mst-matnr

      i_charg = p_gwa_wbdata_mst-charg

      i_werks = 'PIPL'

    IMPORTING

      e_objek = gv_objek

      e_obtab = gv_obtab

      e_klart = p_klart

      e_class = p_class.

  CLEAR lv_clint.

  SELECT SINGLE clint INTO lv_clint FROM klah

  WHERE klart = p_klart

  AND class = p_class.

  SELECT imerk FROM ksml

  INTO TABLE git_ksml

  WHERE clint = lv_clint.

  SELECT atinn

         atnam

         atfor

  FROM   cabn

  INTO TABLE git_cabn

  FOR ALL ENTRIES IN git_ksml

  WHERE atinn = git_ksml-imerk.

  gwa_object-key_field = 'MATNR'.

  gwa_object-value_int = p_gwa_wbdata_mst-matnr.

  APPEND gwa_object TO git_object.

  gwa_object-key_field = 'WERKS'.

  gwa_object-value_int = 'PIPL'.

  APPEND gwa_object TO git_object.

  gwa_object-key_field = 'CHARG'.

  gwa_object-value_int = p_gwa_wbdata_mst-charg.

  APPEND gwa_object TO git_object.

  CALL FUNCTION 'BAPI_OBJCL_CONCATENATEKEY'

    EXPORTING

      objecttable    = 'MCHA'

    IMPORTING

      objectkey_conc = w_object

    TABLES

      objectkeytable = git_object

      return         = git_rettab.

  CLEAR:  git_numtab, git_chatab, git_curtab, git_rettab.

  REFRESH:  git_numtab, git_chatab, git_curtab, git_rettab.

  CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'

    EXPORTING

      objectkey       = w_object

      objecttable     = 'MCHA'

      classnum        = p_class

      classtype       = p_klart

    TABLES

      allocvaluesnum  = git_numtab

      allocvalueschar = git_chatab

      allocvaluescurr = git_curtab

      return          = git_rettab.

  LOOP AT git_cabn INTO gwa_cabn.

     CLEAR lv_value.

    CASE gwa_cabn-atnam.

      WHEN 'H2O'.

        lv_value = gwa_wbdata_mst-moistperc.

      WHEN '+40MM'.

        lv_value = gwa_wbdata_mst-p40mm.

      WHEN '+30MM'.

        lv_value = gwa_wbdata_mst-p30mm.

      WHEN '-10MM'.

        lv_value = gwa_wbdata_mst-n10mm.

      WHEN 'FE'.

        lv_value = gwa_wbdata_mst-fe.

      WHEN 'MN'.

        lv_value = gwa_wbdata_mst-mn.

      WHEN 'SIO2'.

        lv_value = gwa_wbdata_mst-sio2.

      WHEN 'AL2O3'.

        lv_value = gwa_wbdata_mst-al2o3.

      WHEN 'P'.

        lv_value = gwa_wbdata_mst-p.

      WHEN 'NA2O'.

        lv_value = gwa_wbdata_mst-na2o.

      WHEN 'K2O'.

        lv_value = gwa_wbdata_mst-k2o.

      WHEN 'TIO2'.

        lv_value = gwa_wbdata_mst-tio2.

      WHEN 'AI'.

        lv_value = gwa_wbdata_mst-abrinx.

      WHEN 'TUMBLER'.

        lv_value = gwa_wbdata_mst-tuminx.

      WHEN 'S'.

        lv_value = gwa_wbdata_mst-s.

      WHEN '+10MM'.

        lv_value = gwa_wbdata_mst-p10mm.

      WHEN '+8MM'.

        lv_value = gwa_wbdata_mst-p8mm.

      WHEN '-8MM'.

        lv_value = gwa_wbdata_mst-n8mm.

      WHEN 'CAO'.

        lv_value = gwa_wbdata_mst-cao.

      WHEN 'MGO'.

        lv_value = gwa_wbdata_mst-mgo.

      WHEN 'FE2O3'.

        lv_value = gwa_wbdata_mst-fe2o3.

    ENDCASE.

    PERFORM update_table USING gwa_cabn-atfor gwa_cabn-atnam lv_value.

  ENDLOOP.

  Clear w_object.

  w_object = p_gwa_wbdata_mst-matnr.

  CALL FUNCTION 'BAPI_OBJCL_CHANGE'

    EXPORTING

      objectkey          = w_object

      objecttable        = 'MARA'                           "MCH1

      classnum           = p_class

      classtype          = p_klart

      status                   = '1'

    "  standardclass            = 'X'

*   CHANGENUMBER             =

  "  keydate                  = sy-datum

    TABLES

      allocvaluesnumnew  = git_numtab

      allocvaluescharnew = git_chatab

      allocvaluescurrnew = git_curtab

      return             = git_rettab.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

FORM update_table USING atfor atnam value.

  CLEAR : gwa_numtab , gwa_chatab.

          READ TABLE git_numtab INTO gwa_numtab WITH KEY charact = atnam.

      IF syst-subrc  = 0.

        gwa_numtab-value_from = value.

        gwa_numtab-value_relation = '1'.

        gwa_numtab-unit_from = '%'.

        MODIFY git_numtab FROM gwa_numtab.

      ELSE.

        gwa_numtab-charact = atnam.

        gwa_numtab-value_from = value.

        gwa_numtab-value_relation = '1'.

        gwa_numtab-unit_from = '%'.

        APPEND gwa_numtab TO git_numtab.

      ENDIF.

endform.

0 Kudos

When you change the itab "git_numtab" , do not change anything  other than "value_from" ,

Also  if the characteristic name is not even present as "empty"  for that Material/Batch its probably not even extended to that class.........

.to change the batch its either MCH1 or MCHA(Plant specific)....

combination and cannot be MARA as it denotes Material Class.........

Ensure the object key that you pass in " GET_DETAIL"   is same as in " OBJCL_CHANGE" ...

If object key fails for "OBJCL_CHANGE" it should have ideally failed in "GET_DETAIL" as well???

Did you try in msc2n to change the respective characteristic for that plant /material/batch???