The code below shows how to retrieve a characteristic value in mass.
The characteristic in example is named INDICE.
*&---------------------------------------------------------------------*
*& Form retrieve_indice
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PI_MATNR text
* <--PI_INDICES_SORTED text
*----------------------------------------------------------------------*
FORM retrieve_indice USING pi_matnr TYPE TDT_MATNR
CHANGING pi_indices TYPE ti_indices.
" DECLARED TYPES in TOP include
" =============================
TYPES : BEGIN OF ts_indices,
matnr TYPE matnr,
atwrt TYPE atwrt,
END OF ts_indices,
ti_indices TYPE TABLE OF ts_indices.
" =============================
DATA : lw_atinn TYPE atinn.
CHECK pi_matnr IS NOT INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ATINN_INPUT'
EXPORTING
input = 'INDICE' " <== Name of charac to be changed here
IMPORTING
output = lw_atinn.
SELECT mara~matnr ausp~atwrt
INTO TABLE pi_indices
FROM mara INNER JOIN inob
ON mara~matnr EQ inob~objek
INNER JOIN ausp
ON inob~cuobj EQ ausp~objek
FOR ALL entries IN pi_matnr
WHERE mara~matnr EQ pi_matnr-table_line
AND inob~klart EQ '300' " <=== Classification number (only if known)
AND inob~obtab EQ 'MARA'
AND ausp~atinn EQ lw_atinn.
IF sy-subrc <> 0.
CLEAR pi_indices.
ENDIF.
ENDFORM. " retrieve_indice
About the author