Classification data (transaction CL00
for the classification menu) is really data about data, which can be applied/used for many separate areas. It's available in many standard SAP elements such as the material master. So how to get to this information, when you need it in your report ?
The data in classification is composed of characteristics and characteristic values. The easiest way to fetch this is using function module BAPI_OBJCL_GETDETAIL
, which will return the characteristic values in 3 data tables. These values are separated in 3 tables, because of their types.
If you need values for your report, direct table access may be a more convenient way to select. To do this, first find out what the internal characteristic number is (ATINN
). This can be done like so:
DATA: lw_ATINN type AUSP-ATINN. CALL FUNCTION 'CONVERSION_EXIT_ATINN_INPUT' EXPORTING input = 'MY_CHARACTERISTIC' IMPORTING output = wa_atinn.
If there are multiple characteristics needed, check table CABN
which holds the characteristic name ATNAM
and it's internal characteristic number ATINN
.
With the internal characteristic numbers the actual values can be looked up in table AUSP
- Characteristic Values. Beware that the key to table AUSP
first needs to be looked up in table INOB
- Link between Internal Number and Object - in case of multi-value characteristics (this is declared on TCLA-MULTOBJ
).
This example demonstrates how these tables hang together and how they can be selected on for 1 specific characteristic and 1 specific object (the material MAT007).
types: begin of ty_char_value, objek type inob-objek, "The material number atnam type cabn-atnam, atwrt type ausp-atwrt, atwtb type cawnt-atwtb, end of ty_char_value. data: lt_char_values type STANDARD TABLE OF ty_char_value, lv_multiple_values_allowed type tcla-MULTOBJ. select single MULTOBJ from TCLA into lv_multiple_values_allowed where KLART = '001'. * Fetch the values for the characteristic(s): if lv_multiple_values_allowed = 'X'. * Link table INOB is involved when there are multiple values for * characteristic (specified on the class) SELECT inob~objek cabn~atnam ausp~atwrt cawnt~atwtb INTO CORRESPONDING FIELDS OF TABLE lt_char_values FROM inob INNER JOIN ausp ON inob~cuobj = ausp~objek INNER JOIN cawn "Soul purpose: pick up ATZHL value ON cawn~atinn = ausp~atinn AND cawn~atwrt = ausp~atwrt AND cawn~adzhl = ausp~adzhl INNER JOIN cawnt ON cawnt~atinn = ausp~atinn AND cawnt~atzhl = cawn~atzhl AND cawnt~adzhl = ausp~adzhl INNER JOIN cabn ON cabn~atinn = ausp~atinn * FOR ALL entries IN lt_objek - suggestion WHERE inob~objek = 'MAT007' and inob~klart = '001' and inob~obtab = 'MARA' and * cabn~atnam = 'MY_CHARACTERISTIC' and cawnt~spras = sy-langu. else. SELECT ausp~objek cabn~atnam ausp~atwrt cawnt~atwtb INTO CORRESPONDING FIELDS OF TABLE lt_char_values FROM ausp INNER JOIN cawn "Soul purpose: pick up ATZHL value ON cawn~atinn = ausp~atinn AND cawn~atwrt = ausp~atwrt AND cawn~adzhl = ausp~adzhl INNER JOIN cawnt ON cawnt~atinn = ausp~atinn AND cawnt~atzhl = cawn~atzhl AND cawnt~adzhl = ausp~adzhl INNER JOIN cabn ON cabn~atinn = ausp~atinn * FOR ALL entries IN lt_objek - suggestion WHERE ausp~objek = 'MAT007' and ausp~klart = '001' and * cabn~atnam = 'MY_CHARACTERISTIC' and cawnt~spras = sy-langu. endif.
Create classification data? Check out transaction CLB1
Batch Input for Classification and CLB2
Direct Input for Classification (also check CLB3
).