DATA: lt_items_old LIKE TABLE OF bapiebanv WITH HEADER LINE.
DATA: lt_items_new LIKE TABLE OF bapiebanv WITH HEADER LINE.
DATA: lt_account_old LIKE TABLE OF bapiebknv WITH HEADER LINE.
DATA: lt_account_new LIKE TABLE OF bapiebknv WITH HEADER LINE.
DATA: lt_items LIKE TABLE OF bapieban WITH HEADER LINE.
DATA: lt_account LIKE TABLE OF bapiebkn WITH HEADER LINE.
DATA: lt_bapireturn LIKE TABLE OF bapireturn WITH HEADER LINE.
DATA: t_eban LIKE eban OCCURS 0 WITH HEADER LINE.
DATA: t_ebkn LIKE ebkn OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'BAPI_REQUISITION_GETDETAIL'
EXPORTING
number = lt_zmlprtopo-banfn
account_assignment = 'X'
TABLES
requisition_items = lt_items.
* requisition_account_assignment = lt_account.
LOOP AT lt_items.
MOVE-CORRESPONDING lt_items TO lt_items_old.
MOVE-CORRESPONDING lt_items TO lt_items_new.
*&->add.
*& X-固定供应商
IF lt_zmlprtopo-flag = 'X'.
lt_items_new-fixed_vend = lt_zmlprtopo-flief.
ELSE .
lt_items_new-des_vendor = lt_zmlprtopo-flief."期望供应商
ENDIF.
APPEND:lt_items_old, lt_items_new.
CLEAR lt_items_old.
CLEAR lt_items_new.
CLEAR lt_items.
ENDLOOP.
CALL FUNCTION 'BAPI_REQUISITION_CHANGE'
EXPORTING
number = lt_zmlprtopo-banfn
TABLES
requisition_items_old = lt_items_old
requisition_items_new = lt_items_new
requisition_account_old = lt_account_old
requisition_account_new = lt_account_new
return = lt_bapireturn.
READ TABLE lt_bapireturn WITH KEY type = 'E'. "or type = 'A'.
IF sy-subrc EQ 0.
l_flag = 'X'.
LOOP AT lt_bapireturn WHERE type = 'E'.
lt_zmlprtopo-req_qty_total = '更改PR供应商失败!'.
CONCATENATE lt_zmlprtopo-req_qty_total lt_bapireturn-message INTO lt_zmlprtopo-req_qty_total SEPARATED BY '&'.
ENDLOOP.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.
手机扫一扫
移动阅读更方便
你可能感兴趣的文章