SAP Classification(物料特性)

文章转自http://blog.csdn.net/wengyupeng/article/details/6418559?reload

 

SAP Classification 为了方便查询定义的一套技术体系。其实是建立了一个大树(根节点在上面),大致层次 Class Type>Class>characteristics .参见下图:

一 、Purpose

The classification system allows you to use characteristics to describe all types of objects, and to group similar objects in classes –to classify objects, in other words, so that you can find them more easily later.

You then use the classes to help you to find objects more easily,using the characteristics defined in them as search criteria. This ensures that you can find objects with similar or identical characteristics as quickly as possible.

二 、Features

Before you can use classification functions, you need to set up your classification system.

The there are three steps tosetting up a classification system:

...

         1、Defining the Properties of Objects

You use characteristics to describe the properties of objects. You create characteristics centrally in the system.

See the SAP Library,Characteristics (CA-CL-CHR).

          2、Creating Classes

You need classes to classify objects. These classes must be set up. During set up you must assign characteristics to the classes.

         3、Assigning Objects

Once you have created the classes you require for classification, you can assign objects to these classes. You use the characteristics of the class to describe the objects you classify.

三、示例

通过分类中的自定义特征(Characteristics)来对物料、客户、供应商、文档、批次、检验特性等进行自定义分类,系统通过类类型Class Type来区分不同的应用,譬如类类型001为物料分类,类类型010为供应商分类,类类型022/023为批次分类。

Characteristic是sap用来描述物料特性的,这里所说的物料包含原材料,机械设备等。

对于一个原材料,它的密度,比热,存储温度等都是它的特性。可以根据这个原材料的特性来判断它生产出来的产品的等级。

对于一台机械设备,它的功耗,一次最长使用时间,以及生产的产品规格等都是它的属性。可以根据它的特性来制定生产计划,工艺流程等。

这就是Characteristic存在的意义。

通常的过程是 创建一个或多个Characteristics(CT04),把它组合成一个Class(即分配给一个或多个Class)(CL01/CL02),然后将这个包含多个特性的class分配给Material。即维护的MM01 Create Material时的Classification View.

Table: CABN – Characteristic

KLAH – Class Header Data

KSSK – Allocation Table: Object to Class

T-cd: CT04 – Create/change the characteristics

CL01/ CL02/ CL03 – Create/change/display the class

四 、其它参考

官方介绍: http://help.sap.com/saphelp_erp60_sp/helpdata/en/24/47633a416711d189ec0000e81ddfac/frameset.htm

应用介绍: http://mfg.kingdee.com/pages/frankyue2001/blog/archive/2011/05/10/546231.aspx

 

 

 

文章转自 http://www.cnblogs.com/t-bug/archive/2012/05/17/2505938.html

BAPI :

BAPI_OBJCL_GETDETAIL  读取Classification

BAPI_OBJCL_CHANGE    修改Classification

如果Material Master data的Classification不存在,则在创建新的classification之后,

需要更新mara中  pstat ,vpsta 字段,将‘C‘ 添加到该字符串之后。

CONCATENATE wa_mara-pstat 'C'INTO wa_mara-pstat.
CONCATENATE wa_mara-vpsta 'C'INTO wa_mara-vpsta.

复制代码
DATA :wa_class_char LIKE bapi1003_alloc_values_char,"Alphanumeric Values
         wa_class_curr LIKE bapi1003_alloc_values_curr,"Currency Values
         wa_class_err LIKE bapiret2."Error Messages
         i_class_num LIKE TABLE OF wa_class_plmd,
         i_class_char LIKE TABLE OF wa_class_char,
         i_class_curr LIKE TABLE OF wa_class_curr,
         i_class_err LIKE TABLE OF wa_class_err.

*'C'表示classification
FIND 'C' IN wa_mara-vpsta.

IF sy-subrc <> 0.
      CONCATENATE wa_mara-pstat 'C' INTO wa_mara-pstat.
      CONCATENATE wa_mara-vpsta 'C' INTO wa_mara-vpsta.
ELSE.
*读取classification的信息
  CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
        EXPORTING
          objectkey              = g_objectkey
          objecttable            = 'MARA'
          classnum               = 'MATL_INFO'
          classtype              = '001'
*       KEYDATE                 = SY-DATUM
*       UNVALUATED_CHARS       = ' '
*       LANGUAGE               = SY-LANGU
*     IMPORTING
*       STATUS                 =
*       STANDARDCLASS          =
        TABLES
          allocvaluesnum         = i_class_num
          allocvalueschar        = i_class_char
          allocvaluescurr        = i_class_curr
          return                 = i_class_err
                .
ENDIF.
*------------------------------------------------------*
*
*修改或新增 classification
*
*------------------------------------------------------*
*更新Classification
 CALL FUNCTION 'BAPI_OBJCL_CHANGE'
    EXPORTING
      objectkey                = g_objectkey
      objecttable              = 'MARA'
      classnum                 = 'MATL_INFO'
      classtype                = '001'
*   STATUS                   = '1'
*   STANDARDCLASS            =
*   CHANGENUMBER             =
*   KEYDATE                  = SY-DATUM
*   NO_DEFAULT_VALUES        = ' '
* IMPORTING
*   CLASSIF_STATUS           =
    TABLES
      allocvaluesnumnew        = i_class_num
      allocvaluescharnew       = i_class_char
      allocvaluescurrnew       = i_class_curr
      return                   = i_class_err
            .
    READ TABLE i_class_err INTO wa_class_err  WITH KEY type = 'E'.
    IF syst-subrc = 0.
      CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
    ELSE.
  ELSE.
*****UPDATE MARA TBALE***********
    UPDATE mara FROM wa_mara.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
  ENDIF.

 

 

文章转自http://blog.sina.com.cn/s/blog_701594f40100l8gy.html

FORM CREATE_BATCH_CLASSFICATION USING P_WERKS
P_MATNR
P_CHARG
P_VALUE1
P_VALUE2
CHANGING EX_ERROR_FLAG.
data: objectkey like BAPI1003_KEY-OBJECT,
objectkeytable like TABLE OF BAPI1003_OBJECT_KEYS with HEADER LINE,
allocvaluesnumnew like table of BAPI1003_ALLOC_VALUES_NUM with header line,
allocvaluescharnew like TABLE OF BAPI1003_ALLOC_VALUES_char with header line,
allocvaluescurrnew like TABLE OF BAPI1003_ALLOC_VALUES_curr with header line,
return like table of BAPIRET2 with header line.
CLEAR: objectkey, objectkeytable, objectkeytable[],
allocvaluesnumnew, allocvaluesnumnew[],
return.
data: l_matnr like mara-matnr,
l_charg like aufm-charg,
l_werks like aufm-werks.
l_matnr = P_MATNR.
l_charg = P_CHARG.
l_werks = P_WERKS.
objectkeytable-key_field = 'MATNR'.
objectkeytable-value_int = l_matnr.
APPEND objectkeytable.
objectkeytable-key_field = 'CHARG'.
objectkeytable-value_int = l_charg.
APPEND objectkeytable.
* Only if Batch management is Plant dependant
objectkeytable-key_field = 'WERKS'.
objectkeytable-value_int = l_werks.
APPEND objectkeytable.
CALL FUNCTION 'BAPI_OBJCL_CONCATENATEKEY'
EXPORTING
objecttable = 'MCH1' "-objecttable
IMPORTING
objectkey_conc = objectkey
TABLES
objectkeytable = objectkeytable
return = return.
* allocvaluesnumnew-charact = "characteristic name goes here".
* allocvaluesnumnew-value_from = "characteristic value goes here".
* APPEND allocvaluesnumnew.
* allocvaluesnumnew-charact = 'Z_BATCH_CNPC_001'.
* allocvaluesnumnew-value_from = '20101010'.
* APPEND allocvaluesnumnew.
allocvaluescharnew-CHARACT = 'Z_BATCH_PVD_003'.

你可能感兴趣的:(sap,abap)