Добрый день!
При проводке документа с помощью BAPI_ACC_DOCUMENT_POST - ошибка: "Введите другой вид движения (вид движения не существует)
№ сообщения AA816"
Проверила таблицы TABWD и T856*: ВД (cs_trans_t) 210 и 260 есть.
Через транзакцию f-92 проводка выполняется 210 ВД без проблем.
Подскажите, пожалуйста, где ошибка в коде:
Code:
DATA:
lt_accountgl TYPE STANDARD TABLE OF bapiacgl09,
lt_accountreceivable TYPE STANDARD TABLE OF bapiacar09,
lt_accounttax TYPE STANDARD TABLE OF bapiactx09,
lt_currency_amount TYPE STANDARD TABLE OF bapiaccr09,
lt_return TYPE STANDARD TABLE OF bapiret2,
ls_accountgl TYPE bapiacgl09,
ls_accountreceivable TYPE bapiacar09,
ls_accounttax TYPE bapiactx09,
ls_currency_amount TYPE bapiaccr09,
ls_header TYPE bapiache09.
rv_ret = abap_true.
* заголовок
ls_header-header_txt = 'text'.
ls_header-username = sy-uname.
ls_header-comp_code = is_tr_sap-bukrs.
ls_header-fisc_year = is_tr_sap-bzdat+0(4).
ls_header-doc_date = is_tr_sap-bzdat.
ls_header-pstng_date = is_tr_sap-bzdat.
ls_header-trans_date = is_tr_sap-bzdat.
ls_header-doc_type = 'DR'.
ls_header-bus_act = 'RFBU'.
* позиция 1 - Кредит
ls_accountreceivable-itemno_acc = 1.
ls_accountreceivable-customer = is_tr_sap-KUNNR.
ls_accountreceivable-tax_code = 'DC'. APPEND ls_accountreceivable TO lt_accountreceivable.
* позиция 2
CLEAR ls_accountgl.
ls_accountgl-itemno_acc = 2.
ls_accountgl-gl_account = '0090011999'.
ls_accountgl-item_text = 'text'.
ls_accountgl-acct_type = 'S'.
ls_accountgl-de_cre_ind = 'H'.
ls_accountgl-ref_key_2 = is_tr_sap-xref2.
ls_accountgl-ref_key_3 = '50'.
ls_accountgl-tax_code = 'DC'.
ls_accountgl-pstng_date = is_tr_sap-bzdat.
ls_accountgl-fisc_year = is_tr_sap-bzdat(4).
APPEND ls_accountgl TO lt_accountgl.
* позиция 3. ОС
CLEAR ls_accountgl.
ls_accountgl-itemno_acc = 4.
ls_accountgl-gl_account = '0001001299'.
ls_accountgl-cs_trans_t = '210'.
ls_accountgl-comp_code = is_tr_sap-bukrs.
ls_accountgl-asset_no = is_tr_sap-anln1_kt.
ls_accountgl-sub_number = is_tr_sap-anln2_kt.
ls_accountgl-item_text = 'text'.
ls_accountgl-acct_type = 'A'.
ls_accountgl-de_cre_ind = 'H'.
ls_accountgl-ref_key_2 = is_tr_sap-xref2.
ls_accountgl-ref_key_3 = '75'.
ls_accountgl-tax_code = 'V0'.
ls_accountgl-pstng_date = is_tr_sap-bzdat.
ls_accountgl-fisc_year = is_tr_sap-bzdat(4).
APPEND ls_accountgl TO lt_accountgl.
* позиция 4
CLEAR ls_accountgl.
ls_accountgl-itemno_acc = 5.
ls_accountgl-gl_account = '0091029999'.
ls_accountgl-item_text = 'text'.
ls_accountgl-acct_type = 'S'.
ls_accountgl-de_cre_ind = 'S'.
ls_accountgl-ref_key_2 = is_tr_sap-xref2.
ls_accountgl-ref_key_3 = '40'.
ls_accountgl-pstng_date = is_tr_sap-bzdat.
ls_accountgl-fisc_year = is_tr_sap-bzdat(4).
APPEND ls_accountgl TO lt_accountgl.
* позиция 1
CLEAR ls_currency_amount.
ls_currency_amount-itemno_acc = 1.
ls_currency_amount-amt_doccur = is_tr_sap-profit.
ls_currency_amount-currency = is_tr_sap-waers.
APPEND ls_currency_amount TO lt_currency_amount.
* позиция 2
CLEAR ls_currency_amount.
ls_currency_amount-itemno_acc = 2. "profit - 1.00
ls_currency_amount-amt_doccur = - is_tr_sap-profit.
ls_currency_amount-currency = is_tr_sap-waers.
APPEND ls_currency_amount TO lt_currency_amount.
* позиция 3
CLEAR ls_currency_amount.
ls_currency_amount-itemno_acc = 4. " - 1.00
ls_currency_amount-amt_doccur = - is_tr_sap-dmbtr.
ls_currency_amount-currency = is_tr_sap-waers.
APPEND ls_currency_amount TO lt_currency_amount.
* позиция 4
CLEAR ls_currency_amount.
ls_currency_amount-itemno_acc = 5. " 1.00
ls_currency_amount-amt_doccur = is_tr_sap-dmbtr.
ls_currency_amount-currency = is_tr_sap-waers.
APPEND ls_currency_amount TO lt_currency_amount.
* проведение
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = ls_header
TABLES
accountgl = lt_accountgl
accountreceivable = lt_accountreceivable
accounttax = lt_accounttax
currencyamount = lt_currency_amount
return = lt_return.