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: 

Get class details of the material using BAPI

Former Member
0 Kudos
1,068

Hi,

I want to use BAPI BAPI_OBJCL_GETDETAIL, to get the class details of the material.

But I am not sure how to pass the material number to this BAPI.

Could you please let me know what to pass to the parameter OBJKEY.

Thanks

Sankar

1 ACCEPTED SOLUTION

ravisankara_varaprasad
Active Participant
0 Kudos
247

Hi ,

Build the object key like below.i.e. Concatenation of Material , Plant and Batch name.

it_object-key_field = 'MATNR'.

it_object-value_int = p_matnr.

append it_object.

it_object-key_field = 'WERKS'.

it_object-value_int = p_werks.

append it_object.

it_object-key_field = 'CHARG'.

it_object-value_int = p_charg.

append it_object.

call function 'BAPI_OBJCL_CONCATENATEKEY'

exporting

objecttable = 'MCHA'

importing

objectkey_conc = w_object

tables

objectkeytable = it_object

after this call the FM BAPI_OBJCL_GETDETAIL .

table name: MCHA

and class name , class type.

Hope this helps you.

Kind Regards,

Ravi Sankar.Z

4 REPLIES 4

ravisankara_varaprasad
Active Participant
0 Kudos
248

Hi ,

Build the object key like below.i.e. Concatenation of Material , Plant and Batch name.

it_object-key_field = 'MATNR'.

it_object-value_int = p_matnr.

append it_object.

it_object-key_field = 'WERKS'.

it_object-value_int = p_werks.

append it_object.

it_object-key_field = 'CHARG'.

it_object-value_int = p_charg.

append it_object.

call function 'BAPI_OBJCL_CONCATENATEKEY'

exporting

objecttable = 'MCHA'

importing

objectkey_conc = w_object

tables

objectkeytable = it_object

after this call the FM BAPI_OBJCL_GETDETAIL .

table name: MCHA

and class name , class type.

Hope this helps you.

Kind Regards,

Ravi Sankar.Z

Former Member
0 Kudos
247

Hi Ravi,

Please tell me what is the table or structure we need to refer for internal table it_object.

Regards,

Sankar

0 Kudos
247

Hi ,

Delcare like below.

data: w_object like bapi1003_key-object.

data: begin of it_object occurs 0.

include structure bapi1003_object_keys.

data: end of it_object.

data: p_class like klah-class,

p_klart like klah-klart.

data: begin of numtab occurs 0.

include structure bapi1003_alloc_values_num.

data: end of numtab.

  • holds data for charcateristics with type CHAR/DATE

data: begin of chatab occurs 0.

include structure bapi1003_alloc_values_char.

data: end of chatab.

data: begin of curtab occurs 0.

include structure bapi1003_alloc_values_curr.

data: end of curtab.

  • Error return table

data: begin of rettab occurs 0.

include structure bapiret2.

data: end of rettab.

Kind Regards,

Ravi Sankar.Z

Former Member
0 Kudos
247

Hi Ravi,

Thanks.

I need to pass only material number, so i formed 18 characters length material number with leading zeros, then i passed to the BAPI , it returns the expected characteristics for a material.

Thanks for your help.

Regards,

Sankar