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 BAPI_OBJCL_CREATE

Former Member
0 Likes
5,382

Hi,

I am using BAPI BAPI_OBJCL_CREATE for creating classification view.

i am getting error that "An exception was raised".

Below is my code.

W_CLASSTYPE = '023'

W_CLASSNUM = 'VI_BATCH'.

W_OBJECTTABLE = 'MCHA'.
W_OBJECT = 'RM071'.

DATA: W_CLASSIF_STATUS(1).


CALL FUNCTION 'BAPI_OBJCL_CREATE'
EXPORTING
OBJECTKEYNEW = W_OBJECT
OBJECTTABLENEW = W_OBJECTTABLE
CLASSNUMNEW = W_CLASSNUM
CLASSTYPENEW = W_CLASSTYPE
IMPORTING
CLASSIF_STATUS = W_CLASSIF_STATUS
TABLES
RETURN = W_RETURN

thanx in advance

4 REPLIES 4
Read only

RaymondGiuseppi
Active Contributor
0 Likes
3,424

Is not '023' related to 'MARA' and not 'MCHA' (browse table INOB)

Regards,
Raymond

Read only

0 Likes
3,424

I have had it be 023 MCH1 in the past... MCH1 and 023 both are used for cross-plant batches which makes sense.

Read only

0 Likes
3,424

In my systems MARA and MCH1 usually carry this value, so OP should check his Customizing with actual requirement to build a correct key.

Read only

raghug
Active Contributor
0 Likes
3,424

The first thing I notice here is that the Object is wrong. It is usually a concatenation of the material batch and maybe the plant based on your setup.

Based on your setting you maybe able to see the key directly in table AUSP, or you might have to go through the table INOB to get the internal key from the generated (concatenated) key.

You can either concatenate the key manually, or I prefer using a call to BAPI_OBJCL_CONCATENATEKEY to generate the key for me. In my example I am using class type 022 with objecttable MCHA. You are using 023 which may change your object table to MCH1 or MARA. Like Raymond said, check table INOB to figure out your setup.

    l_objecttable = 'MCHA'.

    l_objectkeytable-key_field = 'MATNR'.
    l_objectkeytable-value_int = l_matnr.
    APPEND l_objectkeytable TO li_objectkeytable.

    l_objectkeytable-key_field = 'WERKS'.
    l_objectkeytable-value_int = werks.
    APPEND l_objectkeytable TO li_objectkeytable.

    l_objectkeytable-key_field = 'CHARG'.
    l_objectkeytable-value_int = charg.
    APPEND l_objectkeytable TO li_objectkeytable.

*... § Get object key for the batch
    CALL FUNCTION 'BAPI_OBJCL_CONCATENATEKEY'
      EXPORTING
        objecttable    = l_objecttable
      IMPORTING
        objectkey_conc = l_objectkey
      TABLES
        objectkeytable = li_objectkeytable
        return         = li_return.