Списание компонентов:
DATA: ls_afko TYPE afko, lt_resb TYPE TABLE OF resb, ls_resb LIKE LINE OF lt_resb, ls_return TYPE bapiret1, lt_athdrlevels TYPE TABLE OF bapi_pi_hdrlevel, ls_athdrlevels LIKE LINE OF lt_athdrlevels, lt_goodsmovements TYPE TABLE OF bapi2017_gm_item_create, ls_goodsmovements LIKE LINE OF lt_goodsmovements, lt_link_conf TYPE TABLE OF bapi_link_conf_goodsmov, ls_link_conf LIKE LINE OF lt_link_conf, lt_detail_return TYPE TABLE OF bapi_coru_return, lv_index TYPE i. READ TABLE lt_resb INTO ls_resb INDEX 1. CHECK sy-subrc = 0. ls_athdrlevels-orderid = ls_afko-aufnr. ls_athdrlevels-fin_conf = ''. ls_athdrlevels-clear_res = 'X'. ls_athdrlevels-postg_date = sy-datum. * ls_athdrlevels-conf_quan_unit = . ls_athdrlevels-yield = 0. INSERT ls_athdrlevels INTO TABLE lt_athdrlevels. ls_goodsmovements-material = ls_resb-matnr. ls_goodsmovements-plant = ls_resb-werks. ls_goodsmovements-stge_loc = ls_resb-lgort. ls_goodsmovements-move_type = '261'. ls_goodsmovements-entry_qnt = ls_resb-bdmng. ls_goodsmovements-entry_uom = ls_resb-meins. ls_goodsmovements-orderid = ls_afko-aufnr. ls_goodsmovements-reserv_no = ls_resb-rsnum. ls_goodsmovements-res_item = ls_resb-rspos. ls_goodsmovements-withdrawn = ''. ls_goodsmovements-ref_doc_it = '0001'. INSERT ls_goodsmovements INTO TABLE lt_goodsmovements. ADD 1 TO lv_index. ls_link_conf-index_confirm = 1. ls_link_conf-index_goodsmov = lv_index. INSERT ls_link_conf INTO TABLE lt_link_conf. CALL FUNCTION 'BAPI_PROCORDCONF_CREATE_HDR' EXPORTING post_wrong_entries = '2' * testrun = IMPORTING return = ls_return TABLES athdrlevels = lt_athdrlevels goodsmovements = lt_goodsmovements link_conf_goodsmov = lt_link_conf * characteristics_batch = * link_gm_char_batch = detail_return = lt_detail_return.
Выпуск ГП:
ls_athdrlevels-orderid = ls_afko-aufnr. ls_athdrlevels-fin_conf = ''. ls_athdrlevels-clear_res = 'X'. ls_athdrlevels-postg_date = sy-datum. ls_athdrlevels-dev_reason = ''. " Причина отклонения ls_athdrlevels-conf_quan_unit = afko-gmein. ls_athdrlevels-yield = 10. " Для примера INSERT ls_athdrlevels INTO TABLE lt_athdrlevels. ls_goodsmovements-material = ls_afpo-matnr. ls_goodsmovements-plant = ls_aufk-werks. ls_goodsmovements-stge_loc = ls_afpo-lgort. ls_goodsmovements-move_type = '131'. ls_goodsmovements-entry_qnt = 10. " Для примера ls_goodsmovements-entry_uom = ls_afpo-amein. ls_goodsmovements-no_more_gr = ''. ls_goodsmovements-orderid = ls_afko-aufnr. ls_goodsmovements-order_itno = ls_afpo-posnr. ls_goodsmovements-mvt_ind = 'F'. INSERT ls_goodsmovements INTO TABLE lt_goodsmovements. ADD 1 TO lv_index. ls_link_conf-index_confirm = 1. ls_link_conf-index_goodsmov = lv_index. INSERT ls_link_conf INTO TABLE lt_link_conf. CALL FUNCTION 'BAPI_PROCORDCONF_CREATE_HDR' EXPORTING post_wrong_entries = '2' * testrun = IMPORTING return = ls_return TABLES athdrlevels = lt_athdrlevels goodsmovements = lt_goodsmovements link_conf_goodsmov = lt_link_conf * characteristics_batch = * link_gm_char_batch = detail_return = lt_detail_return.
Комментариев нет:
Отправить комментарий