我很好
分类: WINDOWS
2008-05-24 11:19:01
FORM GET_BOM USING VALUE(MATNR) TYPE C.
DATA:LINE LIKE ZMAST_STPO-IDNRK.
SELECT * FROM ZMAST_STPO WHERE MATNR = MATNR
ORDER BY MATNR DATUV DESCENDING.
IF ZMAST_STPO-REKRS = 'X'.
CONTINUE.
ENDIF.
IF ( ZMAST_STPO-MATNR = AFPO-MATNR ) AND
( AFKO-STLAL <> ZMAST_STPO-STLAL ).
CONTINUE.
ENDIF.
SELECT * FROM STKO WHERE STLNR = ZMAST_STPO-STLNR
ORDER BY DATUV DESCENDING.
RATE = RATE * ZMAST_STPO-MENGE / STKO-BMENG .
EXIT.
ENDSELECT.
PERFORM GET_BOM USING ZMAST_STPO-IDNRK.
ENDSELECT.
IF SY-SUBRC = 4 OR ZMAST_STPO-REKRS = 'X'.
ITABBOM-MATNR = ZMAST_STPO-IDNRK.
READ TABLE ITABBOM INTO LINE.
IF SY-SUBRC = 4.
ITABBOM-MATNR = ZMAST_STPO-IDNRK.
ITABBOM-RATE = RATE.
APPEND ITABBOM.
ENDIF.
RATE = 1.
ENDIF.
ENDFORM.