Skip to Content
-1

BAPI BAPI_OBJCL_CREATE

Jan 27, 2017 at 12:07 PM

175

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Raymond Giuseppi
Jan 27, 2017 at 02:25 PM
0

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

Regards,
Raymond

Show 2 Share
10 |10000 characters needed characters left characters exceeded

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

0

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

0
Raghu Govindarajan Jan 27, 2017 at 03:17 PM
0

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.
Share
10 |10000 characters needed characters left characters exceeded