BAPI FOR MD61,MD62,MD63
BAPI FOR MD61,MD62,MD63 (2008-11-19 15:03) 分类: abap REPORT ZBAPI_MD61. data: matemp like BAPISITEMR-MATERIAL. "物料编码 data: req_item like BAPISITEMR. data: req_data like BAPISSHDIN occurs 0 with header line. data: RETURN LIKE BAPIRETURN1 OCCURS 0 WITH HEADER LINE. data: matertemp like BAPISITEMR-MATERIAL. req_item-material = 'M-ZZM-20'. req_item-plant = '1000'. req_item-REQU_TYPE = 'VSE'. req_item-VERSION = '00'. req_item-VERS_ACTIV = 'X'. req_data-DATE_TYPE = 3. req_data-req_date = '20080821'. req_data-REQ_QTY = 200. append req_data. clear req_data. CALL FUNCTION 'BAPI_REQUIREMENTS_CREATE' EXPORTING REQUIREMENTS_ITEM = req_item * REQUIREMENT_PARAM = IMPORTING MATERIAL = matemp * PLANT = * REQUIREMENTSTYPE = * VERSION = * REQMTSPLANNUMBER = TABLES REQUIREMENTS_SCHEDULE_IN = REQ_data * REQUIREMENTS_CHAR_IN = RETURN = RETURN. if lines( RETURN ) = 0 . MESSAGE '计划创建成功' type 'S'. endif. clear:req_item,REQ_data,REQ_data[]. *&---------------------------------------------------------------------* *& Report ZBAPI_MD62 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT ZBAPI_MD62. data: req_data like BAPISSHDIN occurs 0 with header line. data: RETURN LIKE BAPIRETURN1 OCCURS 0 WITH HEADER LINE. req_data-DATE_TYPE = 1. req_data-req_date = '20070723'. req_data-REQ_QTY = 800. append req_data. clear req_data. req_data-DATE_TYPE = 1. req_data-req_date = '20070823'. req_data-REQ_QTY = 200. append req_data. clear req_data. CALL FUNCTION 'BAPI_REQUIREMENTS_CHANGE' EXPORTING MATERIAL = 'M-ZZM-20' PLANT = '1000' REQUIREMENTSTYPE = 'VSE' VERSION = '00' REQMTSPLANNUMBER = '' VERS_ACTIV = 'X' * REQUIREMENT_PARAM = * MRP_AREA = * DO_COMMIT = 'X' * UPDATE_MODE = 'X' DELETE_OLD = 'X' * NO_WITHDR = ' ' * MATERIAL_EVG = * IMPORTING * REQUIREMENT_ITEM_OUT = TABLES REQUIREMENTS_SCHEDULE_IN = req_data * REQUIREMENTS_CHAR_IN = RETURN = RETURN . if lines( RETURN ) = 0 . MESSAGE '计划修改成功' type 'S'. endif. clear:REQ_data,REQ_data[]. *&---------------------------------------------------------------------* *& Report ZBAPI_MD63 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT ZBAPI_MD63. data: req_data like BAPISITMEO occurs 0 with header line. data: RETURN LIKE BAPIRETURN1 OCCURS 0 WITH HEADER LINE. CALL FUNCTION 'BAPI_REQUIREMENTS_GETDETAIL' EXPORTING MATERIAL = 'M-ZZM-20' PLANT = '1000' REQUIREMENTSTYPE = 'VSE' VERSION = '00' REQMTSPLANNUMBER = '' * MRP_AREA = * MATERIAL_EVG = TABLES REQUIREMENTS_OUT = req_data RETURN = RETURN . BREAK-POINT.