SAP ABAP 批次和特性值

2023-10-13 19:14:53 浏览数 (1)

1、事务码

MSC1N、MSC2N、MSC3N

2、常用表

MCH1、MCHA、AUSP、MCH*开头的几个

3、批次

代码语言:javascript复制
1、创建批次
BAPI:BAPI_BATCH_CREATE

2、修改批次
BAPI:BAPI_BATCH_CHANGE

3、删除批次
BAPI:BAPI_BATCH_DELETE

4、获取批次明细
BAPI:BAPI_BATCH_GET_DETAIL

5、查询物料的分类视图是否扩充
BAPI: BAPI_OBJCL_GETCLASSES

OBJECTKEY_IMP:物料号 带前导0
OBJECTTABLE_IMP  MARA
CLASSTYPE_IMP  022

4、特性值

代码语言:javascript复制
1、获取类别
CALL FUNCTION 'VB_BATCH_2_CLASS_OBJECT'
     EXPORTING
        I_MATNR = LS_DATA-MATNR
        I_CHARG = LS_DATA-CHARG
        I_WERKS = LS_DATA-WERKS
     IMPORTING
        E_OBJEK = LV_OBJEK
        E_OBTAB = LV_OBTAB
        E_KLART = LV_KLART
        E_CLASS = LV_CLASS.
DATA:LV_OBJEK             TYPE  CUOBN,
     LV_OBTAB             TYPE  TABELLE,
     LV_KLART             TYPE  KLASSENART,
     LV_CLASS             TYPE  KLASSE_D.

2、通过物料 批次获取表和类别
SELECT SINGLE CUOBJ_BM FROM MCH1 INTO @DATA(LV_BM)
         WHERE MATNR EQ XXX
           AND CHARG EQ XXX.

DATA:LV_OBJECTNAME        LIKE BAPI1003_KEY-OBJECT,
     LV_OBJECTTABLE       LIKE BAPI1003_KEY-OBJECTTABLE,
     LV_CLASSTYPE         LIKE BAPI1003_KEY-CLASSTYPE,
     RETURN               LIKE TABLE OF BAPIRET2      WITH HEADER LINE.

CALL FUNCTION 'BAPI_OBJCL_GET_OBJECT_OF_KEY'
     EXPORTING
        CLOBJECTKEYIN = LV_BM
     IMPORTING
        OBJECTNAME    = LV_OBJECTNAME
        OBJECTTABLE   = LV_OBJECTTABLE
        CLASSTYPE     = LV_CLASSTYPE
     TABLES
        RETURN        = RETURN.

3、获取特性值明细
DATA:I_OBJEK              TYPE  BAPI1003_KEY-OBJECT,
     I_OBTAB              TYPE  BAPI1003_KEY-OBJECTTABLE,
     I_KLART              TYPE  BAPI1003_KEY-CLASSTYPE,
     I_CLASS              TYPE  BAPI1003_KEY-CLASSNUM.

CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
     EXPORTING
       OBJECTKEY        = I_OBJEK
       OBJECTTABLE      = I_OBTAB
       CLASSNUM         = I_CLASS
       CLASSTYPE        = I_KLART
       UNVALUATED_CHARS = 'X'
     TABLES
       ALLOCVALUESNUM   = CLASSVALUATIONSNUM
       ALLOCVALUESCHAR  = CLASSVALUATIONSCHAR
       ALLOCVALUESCURR  = CLASSVALUATIONSCURR
       RETURN           = RETURN.

4、特性值修改
BAPI:BAPI_OBJCL_CHANGE

5、批量修改批次特性值
BAPI:BAPI_BATCH_SAVE_REPLICA

5、分类、特性值关系

代码语言:javascript复制
根据分类别查KLAH表,KLAH-CLASS = 'XXX',获取内部等级号 CLINT
根据KLAH-CLINT = KSML-CLINT取得分类下所有的内部特性号 IMERK
根据KSML-IMERK = CABN-ATINN取得特性详细信息,CABNT是特性描述

0 人点赞