Bapi does not need a biographical account code, but you have to judge the amount symbol based on the account code.
Note: This bapi does not support B and W special general ledger (receipts), only bdc can be used; the function POSTING_INTERFACE_DOCUMENT is for recording BDC, which is ok
https://launchpad.support.sap.com/#/notes/2076117/E
It can also be achieved through enhancements, in LFACIF5D
Call code
3. If the tax code line item is not transmitted, the 0 tax code corresponding to the currency will be automatically written based on the currency judgment
4. If the header text header_txt cannot be written in, check whether badi AC_DOCUMENT is activated. If CHANGE_INITIAL and CHANGE_AFTER_CHECK are activated, you need to add a code
data: wa_header type acchd.
if sy-xprog ne 'SAPMSSY1'.
*---<SAPLBPFC> is for Posting with BAPI: BAPI_ACC_DOCUMENT_POST
*---<SAPCNVE > is for Posting(Tax) with BAPI: BAPI_ACC_DOCUMENT_POST
*---<SAPMSSY1> is for Test(Check) with BAPI: BAPI_ACC_DOCUMENT_CHECK
clear wa_header.
wa_header = im_document-header.
ex_document-header-bktxt = wa_header-bktxt.
clear wa_header.
endif.
5. According to the configuration, the tax account can be directly written into gl_acount. At this time, there is no need to write baseamount, and base_amount is required for writing into tax.
6. You can write the header field through additional fields
赋 值 wa_ext2-itemno_acc = 0.
7. Write CURRENCYAMOUNT in different currencies
it_currency-itemno_acc = '1'.
it_currency-curr_type = '00'.
it_currency-currency = 'MXN'.
it_currency-amt_doccur = '123.00'.
it_currency-itemno_acc = '1'.
it_currency-curr_type = '30'.
it_currency-currency = 'USD'.
it_currency-amt_doccur = '10.00'.
8. The assets are transferred to the gl_account table, koart ='A', ls_header-bus_act ='RFBU'. The asset number is passed to asset_no, and the secondary asset number must be filled with anln2. If the error AAPO 007 nconsistent with FI/CO document: different document structures is reported, it is likely that the enhanced field is overwritten (for example, the enhanced field has anln1 asset number that overwrites the gl account table). If the gl account table does not transmit the asset number, an error is reported It is easy to see that if it is emptied in the enhancement, it has been checked at this time, and the error report is difficult to understand.
9. Use this function to do f-47 unilateral prepayment. If you want to transfer assets with additional fields, there is a function AMSP_RLAMBU_FILL_FROM_ACCIT that will clear the assets field and make an implicit enhancement jump at the beginning.
data:
lv_exit.
import lv_exit to lv_exit from memory id 'ZFM_AM_01_11'.
IF lv_exit = 'X'.
return.
ENDIF.
currency type field. (00 = document, 30 = group, 10 = company code currency.)
10. There is a note if payment terms cannot be written in
11. When the tax amount is 0, the general ledger account can directly pass a tax code without passing ACCOUNTTAX (CALCULATE_TAX_FROM_NET_AMOUNT). If the reconciliation account is not passed, an error will be reported as FF 805.
12.Error KI-280
Create account 310231 for 05.08.2016 as a cost element in controlling area 1000
The front desk of the income account is no problem, bapi reports an error, check here
Additional field enhancement
Note: The additional field structure should not have the fields that can be in the item, otherwise the value passed in the item will be overwritten in the enhancement
The asset is in gl_account but not in the supplier, so add it to the additional field
1.se11 Create structure ZSTR_ACCIT_EXTEND
POSNR 1 type POSNR_ACC
BSCHL 1 type BSCHL
GSBER 1 type GSBER
XNEGP 1 type XNEGP
VBUND 1 type RASSC
KIDNO 1 type KIDNO
NUMPG 1 type J_1ANOPG
REBZG 1 type REBZG
REBZJ 1 type REBZJ
REBZZ 1 type REBZZ
REBZT 1 type REBZT
EBELN 1 type EBELN
ANBWA 1 type ANBWA
RSTGR 1 type RSTGR
KKBER 1 type KKBER
FKBER 1 type FKBER
HZUON 1 Type HZUON
SEGMENT 1 type FB_SEGMENT
AUGBL 1 type AUGBL
WSTAT 1 type WSTAT
ZUMSK 1 type DZUMSK
ANLN1 1 type ANLN1
ANLN2 1 type ANLN2
2. Create badi to implement ACC_DOCUMENT, method CHANGE
Added filter value BKPFF
Pre-made, ledger version
Copy code
data: wa_extension type bapiparex,
ext_value(960) type c,
wa_accit type accit,
l_ref type ref to data.
field-symbols: <l_struc> type any,
<l_field> type any.
sort c_extension2 by structure.
loop at c_extension2 into wa_extension.
at new structure.
create data l_ref type (wa_extension-structure).
assign l_ref->* to <l_struc>.
endat.
concatenate wa_extension-valuepart1 wa_extension-valuepart2
wa_extension-valuepart3 wa_extension-valuepart4
into ext_value.
move ext_value to <l_struc>.
assign component 'POSNR' of structure <l_struc> to <l_field>.
read table c_accit with key posnr = <l_field>
into wa_accit.
if sy-subrc is initial.
move-corresponding <l_struc> to wa_accit.
modify c_accit from wa_accit index sy-tabix.
endif.
endloop.
Activate, just call bapi directly
DEMO
BDC version