ABAP 根据批次特性获取描述 快速开始
TYPES:BEGIN OF ty_inob,
matnr TYPE mara-matnr,
charg TYPE mchb-charg,
objek TYPE inob-objek,
cuobj TYPE inob-cuobj,
END OF ty_inob.
DATA:gt_inob TYPE TABLE OF ty_inob,
gs_inob TYPE ty_inob.
DATA:lv_objek TYPE ausp-objek.
DATA:lv_zxx TYPE ausp-atinn.
WITH +data AS ( SELECT objek FROM @gt_inob AS lt_data ) ##DB_FEATURE_MODE[ITABS_IN_FROM_CLAUSE] ##ITAB_KEY_IN_SELECT
SELECT
inob~objek,
ausp~atinn,
ausp~atwrt
* ausp~atflv
FROM inob
INNER JOIN +data ON +data~objek = inob~objek
INNER JOIN ausp ON inob~cuobj = ausp~objek
WHERE obtab = 'MCH1'
INTO TABLE @DATA(lt_ausp).
SORT lt_ausp BY objek atinn.
"XX
CALL FUNCTION 'CONVERSION_EXIT_ATINN_INPUT'
EXPORTING
input = 'XX'
IMPORTING
output = lv_xx.
LOOP AT bestand ASSIGNING FIELD-SYMBOL(<line>).
IF <line>-charg IS NOT INITIAL AND xmchb IS NOT INITIAL.
CALL FUNCTION 'VB_BATCH_2_CLASS_OBJECT'
EXPORTING
i_matnr = <line>-matnr
i_charg = <line>-charg
IMPORTING
e_objek = lv_objek.
READ TABLE lt_ausp INTO DATA(ls_ausp) WITH KEY objek = lv_objek
atinn = lv_zxx BINARY SEARCH.
IF sy-subrc = 0.
<line>-zxx = ls_ausp-atwrt.
ENDIF.
endloop.