GOODSMVT_CODE nasıl bulunur?
BAPI_GOODSMVT_CREATE gibi mal hareketi fonksiyonlarında kullanılan GOODSMVT_CODE şu şekilde bulunur.
FORM determine_bapi_code USING p_bwart TYPE bwart
CHANGING p_code TYPE bapi2017_gm_code.
DATA lt_t158b TYPE TABLE OF t158b WITH HEADER LINE.
CLEAR : p_code, lt_t158b.
REFRESH : lt_t158b .
SELECT * FROM t158b INTO CORRESPONDING FIELDS OF TABLE lt_t158b
WHERE bwart EQ p_bwart.
LOOP AT lt_t158b.
SELECT SINGLE gmcode FROM t158g INTO p_code
WHERE tcode EQ lt_t158b-tcode.
IF sy-subrc IS INITIAL.
EXIT.
ENDIF.
ENDLOOP.
ENDFORM.