REPORT y_bapitest.
DATA:lc_doc_header TYPE bapidochdrp,
lc_doc_no TYPE bapidochdrp-doc_no,
lit_items TYPE TABLE OF bapiaaitm,
lwa_item TYPE bapiaaitm,
lit_ret TYPE TABLE OF bapiret2,
lwa_ret like line of lit_ret.
DATA:lc_flg.
lc_doc_header-co_area = 'J100'.
lc_doc_header-docdate = sy-datum.
lc_doc_header-postgdate = sy-datum.
lc_doc_header-username = sy-uname.
lc_doc_header-val_period = sy-datum+4(2).
lc_doc_header-val_fisyear = sy-datum+0(4).
lwa_item-send_cctr = 'J1000001'.
lwa_item-acttype = 'T1'.
lwa_item-actvty_qty = '3'.
lwa_item-rec_wbs_el = 'F-J100-0001.01'.
APPEND lwa_item TO lit_items.
CALL FUNCTION 'BAPI_ACC_ACTIVITY_ALLOC_POST'
EXPORTING
doc_header = lc_doc_header
* IGNORE_WARNINGS = ' '
IMPORTING
doc_no = lc_doc_no
TABLES
doc_items = lit_items
return = lit_ret
* CRITERIA =
* CUSTOMER_FIELDS =
.
LOOP AT lit_ret INTO lwa_ret
WHERE type = 'A' OR type = 'E'.
lc_flg = 'X'.
ENDLOOP.
IF lc_flg = 'X'.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
* IMPORTING
* RETURN =
.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
.
WRITE: lc_doc_no.
ENDIF.
阅读(1701) | 评论(2) | 转发(0) |