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: 

characteristics values

0 Kudos
412

I need get the value characteristics by description of value characteristic.

How function can do this?

3 REPLIES 3

Former Member
0 Kudos
131

The function module BAPI_OBJCL_GETDETAIL return all the characteristics in the tables allocvaluesnum, allocvalueschar and allocvaluescurr, then you need to put loop in each of them to find out which one you want.

Hope it helps.

Former Member
0 Kudos
131

We have to pass the concatenated value of MATNR and CHARG to the BAPI_OBJCL_GETDETAIL

Then we gert the batch characterstics

Narendra

Former Member
0 Kudos
131

Hai,

If you want desriptions, data type, size of characteristics of the class:

You can use BAPI_CLASS_GETDETAIL function module.

Example Code:

data:

ls_classbasicdata like BAPI1003_BASIC,

ls_classdocument like BAPI1003_DOCU,

ls_classadditional like BAPI1003_ADD,

ls_classstandard like BAPI1003_STAND,

ls_return like bapiret2,

lit_classdescriptions like BAPI1003_CATCH occurs 0,

lwa_classdescriptions like BAPI1003_CATCH,

lit_classdescriptions_r like BAPI1003_CATCH_R occurs 0,

lwa_classdescriptions_r like BAPI1003_CATCH_R,

lit_classlongtexts like BAPI1003_LONGTEXT occurs 0,

lwa_classlongtexts like BAPI1003_LONGTEXT,

lit_classlongtexts_r like BAPI1003_LONGTEXT_R

occurs 0,

lwa_classlongtexts_r like BAPI1003_LONGTEXT_R,

lit_classcharacteristics like BAPI1003_CHARACT

occurs 0,

lwa_classcharacteristics like BAPI1003_CHARACT,

lit_classcharacteristics_r like BAPI1003_CHARACT_R

occurs 0,

lwa_classcharacteristics_r like BAPI1003_CHARACT_R,

lit_classcharvalues_r like BAPI1003_CHAR_VAL_R

occurs 0,

lwa_classcharvalues_r like BAPI1003_CHAR_VAL_R,

lit_charactvalueoverwrite like BAPI1003_CHARACT_VALUE_OVR

occurs 0,

lwa_charactvalueoverwrite like BAPI1003_CHARACT_VALUE_OVR,

lit_charactoverwrite like BAPI1003_CHARACT_OVERWR

occurs 0,

lwa_charactoverwrite like BAPI1003_CHARACT_OVERWR,

lit_receivers type BDI_LOGSYS occurs 0.

CALL FUNCTION 'BAPI_CLASS_GETDETAIL'

EXPORTING

classtype = klart

classnum = class

  • LANGUISO =

LANGUINT = SY-LANGU

KEYDATE = datuv "#EC DOM_EQUAL

IMPORTING

CLASSBASICDATA = ls_classbasicdata

CLASSDOCUMENT = ls_classdocument

CLASSADDITIONAL = ls_classadditional

CLASSSTANDARD = ls_classstandard

RETURN = ls_return

TABLES

CLASSDESCRIPTIONS = lit_classdescriptions_r

CLASSLONGTEXTS = lit_classlongtexts_r

CLASSCHARACTERISTICS = lit_classcharacteristics_r

CLASSCHARVALUES = lit_classcharvalues_r.

**.....Report errors and leave..........................................

if ls_return-type eq 'E'.

message id ls_return-id type 'I' number ls_return-number

with ls_return-message_v1 ls_return-message_v2

ls_return-message_v3 ls_return-message_v4.

exit.

endif.

*....Handle differing parameter format..................................

refresh lit_classdescriptions.

clear lwa_classdescriptions.

loop at lit_classdescriptions_r

into lwa_classdescriptions_r.

move-corresponding lwa_classdescriptions_r to lwa_classdescriptions.

append lwa_classdescriptions to lit_classdescriptions.

clear: lwa_classdescriptions_r,

lwa_classdescriptions.

endloop.

refresh lit_classlongtexts.

clear lwa_classlongtexts.

loop at lit_classlongtexts_r

into lwa_classlongtexts_r.

move-corresponding lwa_classlongtexts_r to lwa_classlongtexts.

append lwa_classlongtexts to lit_classlongtexts.

clear: lwa_classlongtexts_r,

lwa_Classlongtexts.

endloop.

refresh lit_classcharacteristics.

clear lwa_classcharacteristics.

loop at lit_classcharacteristics_r

into lwa_classcharacteristics_r.

move-corresponding lwa_classcharacteristics_r

to lwa_classcharacteristics.

append lwa_classcharacteristics to lit_classcharacteristics.

clear: lwa_classcharacteristics_r,

lwa_classcharacteristics.

endloop.

refresh: lit_classcharacteristics,

lit_charactoverwrite.

clear: lwa_classcharacteristics,

lwa_charactoverwrite.

loop at lit_classcharacteristics_r

into lwa_classcharacteristics_r.

if not lwa_classcharacteristics_r-ch_ovrwrt is initial.

move-corresponding lwa_classcharacteristics_r

to lwa_charactoverwrite.

append lwa_charactoverwrite to lit_charactoverwrite.

else.

move-corresponding lwa_classcharacteristics_r

to lwa_classcharacteristics.

append lwa_classcharacteristics to lit_classcharacteristics.

endif.

clear: lwa_classcharacteristics_r,

lwa_classcharacteristics,

lwa_charactoverwrite.

endloop.

refresh lit_charactvalueoverwrite.

clear lwa_charactvalueoverwrite.

loop at lit_classcharvalues_r

into lwa_classcharvalues_r.

move-corresponding lwa_classcharvalues_r to lwa_charactvalueoverwrite.

append lwa_charactvalueoverwrite to lit_charactvalueoverwrite.

clear: lwa_classcharvalues_r,

lwa_charactvalueoverwrite.

endloop.

______________________________________________________________-

You can use 'BAPI_CLASS_GET_CLASSIFICATIONS' function module to get characteristic values.

See the following example code:

DATA: li_cl_obj LIKE bapi_class_objects OCCURS 0 WITH HEADER LINE,

li_obj_char LIKE bapi_object_values OCCURS 0 WITH HEADER LINE.

DATA: lv_pack TYPE p DECIMALS 2.

CONSTANTS:

c_brand(8) TYPE c VALUE 'Z_BRAND2', "Brand name

c_pack(7) TYPE c VALUE 'Z_SIZE2', "Pack Size

c_pak_cd(11) TYPE c VALUE 'Z_SIZE_CODE', "Pack Size Code

c_cl_typ(3) TYPE c VALUE '001', "Material Class type

c_cl_num(18) TYPE c VALUE 'ZMAT_CHAR', "Material Class Number

c_obj_typ(4) TYPE c VALUE 'MARA', "Object Type

CLEAR: li_cl_obj, li_obj_char.

REFRESH: li_cl_obj, li_obj_char.

li_cl_obj-object_key = i_material-matnr.

li_cl_obj-object_type = c_obj_typ.

APPEND li_cl_obj.

CALL FUNCTION 'BAPI_CLASS_GET_CLASSIFICATIONS'

EXPORTING

classtype = c_cl_typ

classnum = c_cl_num

key_date = sy-datum

TABLES

object_classification = li_obj_char

class_objects = li_cl_obj.

  • Read Brand name

CLEAR li_obj_char.

READ TABLE li_obj_char WITH KEY object_key = i_material-matnr

name_char = c_brand.

i_material-brand = li_obj_char-char_value. ********Char value

  • Read Pack Size

CLEAR: li_obj_char, lv_pack.

READ TABLE li_obj_char WITH KEY object_key = i_material-matnr

name_char = c_pack.

lv_pack = li_obj_char-num_val_fm. ***********Numeric value

i_material-pak_sz = lv_pack.

  • Read Pack size code

CLEAR li_obj_char.

READ TABLE li_obj_char WITH KEY object_key = i_material-matnr

name_char = c_pak_cd.

i_material-pak_sz_cd = li_obj_char-char_value.. ********Char value