MARA-MATNR = INOB-OBJEK
INOB-CUOBJ = KSSK-CLINT
KSSK-OBJEK = AUSP-OBJEK
物料特性可以从MM03分类 批次特性MSC3N中查看
类的T-CODE: CL03
特性T-CODE: CT04
特性可以通过下面的BAPI来进行批量维护:
BAPI_CHARACT_CREATE
BAPI_CHARACT_CHANGE
BAPI_CHARACT_DELETE
BAPI_CHARACT_GETDETAIL
特性分配给物料之后 ,如果要维护物料的特性值,会用到下面的BAPI函数
BAPI_OBJCL_GETDETAIL
BAPI_OBJCL_CHANGE
先用BAPI_OBJCL_GETDETAIL取得到物料的类下面的所有特性值,然后修改特性值,最后用BAPI_OBJCL_CHANGE写回去。
CALL FUNCTION ‘BAPI_OBJCL_GETDETAIL’
EXPORTING
objectkey = 物料号
objecttable = ‘MARA’
classnum = 类别
classtype = 类别种类
tables
allocvaluesnum = 数值型特性值
allocvalueschar = 字符型特性值
allocvaluescurr = 货币型特性值
return = 返回值
.
对于QM的批次特性来说,质检对每个批次检验结果回写到批次特性值中。同样可以用下面的。
BAPI_OBJCL_GETDETAIL
BAPI_OBJCL_CHANGE
但是调用BAPI_OBJCL_GETDETAIL的时候参数需要用另外的function取得:
CALL FUNCTION ‘VB_BATCH_2_CLASS_OBJECT’
EXPORTING
i_matnr = 物料号
i_charg = 批次号
I_WERKS = 工厂
IMPORTING
E_OBJEK = 对应objectkey
E_OBTAB = 对应objecttable
E_KLART = 对应classtype
E_CLASS = 对应classnum
.
批次特性的T-CODE: MSC3N
charact = ‘ZZYS’.“颜色
perform get_charg_type
using it_mseg-matnr it_mseg-charg it_mseg-werks charact
changing it_mseg-z_color.
form get_charg_type
using matnr type matnr
charg type charg_d
werks type werks_d
charact type char30
changing rtnstr type char30.
data:r_e_objek type objnum,
r_e_obtab type tabelle,
r_e_klart type klassenart,
r_e_class type klasse_d.
data: allocvaluesnum type standard table of bapi1003_alloc_values_num with header line,
allocvalueschar type standard table of bapi1003_alloc_values_char with header line,
allocvaluescurr type standard table of bapi1003_alloc_values_curr with header line,
return type standard table of bapiret2.
call function ‘VB_BATCH_2_CLASS_OBJECT’
exporting
i_matnr = matnr
i_charg = charg
i_werks = werks
importing
e_objek = r_e_objek
e_obtab = r_e_obtab
e_klart = r_e_klart
e_class = r_e_class.
call function ‘BAPI_OBJCL_GETDETAIL’
exporting
objectkey = r_e_objek
objecttable = r_e_obtab
classnum = r_e_class
classtype = r_e_klart
* KEYDATE = SY-DATUM
* UNVALUATED_CHARS = ’ ’
* LANGUAGE = SY-LANGU
* IMPORTING
* STATUS =
* STANDARDCLASS =
tables
allocvaluesnum = allocvaluesnum
allocvalueschar = allocvalueschar
allocvaluescurr = allocvaluescurr
return = return
.
loop at _allocvalueschar.
if allocvalueschar-charact = charact.
rtnstr = allocvalueschar-value_char.
endif.
endloop.
loop at _allocvaluesnum.
if allocvaluesnum-charact = charact.
data:ps type p decimals 4.
move allocvaluesnum-value_from to ps.
move ps to rtnstr.
endif.
endloop.
endform.