BAPI_ACC_DOCUMENT_POST 在过账会计凭证时候,经常会发现一些标准字段在参数中并没有
可以通过CMOD/SMOD增强出口--》ACBAPI01--》EXIT_SAPLACC4_001--》ZXACCU15
示例代码:
DATA: wa_extension TYPE bapiextc,it_extension TYPE STANDARD TABLE OF bapiextc.
wa_extension(3) = '005'. "ITEMNO_ACC
wa_extension+3(11) = 'Note 487722'. "Data, not in standard interface
APPEND wa_extension TO it_extension.传递到函数里面然后在include中这样写
READ TABLE t_accit WITH KEY posnr = extension(3).
IF sy-subrc IS INITIAL.
* Update the line item textt_accit-sgtxt = extension+3(11).MODIFY t_accit INDEX sy-tabix.
ENDIF.
另外还可以通过BTE的增强:RWBAPI01
1.FIBF--》设置--》产品--》客户的--》然后新增一条
2.复制函数 SAMPLE_INTERFACE_RWBAPI01 示例代码
(SE37-->/SAPPCE/DPC_PROCESS_EXTENSION)
3.FIBF-->设置--》处理函数模块---》客户的-》新增条目 RWBAPI01
另外如果字段还是没找到你要的,可以在如下结构中:append structure
示例代码:
DATA: LS_EXTEND1 TYPE BAPIACEXTC.
DATA: LT_EXTEND2 TYPE STANDARD TABLE OF BAPIACEXTC.CLEAR:LS_EXTEND1.
LS_EXTEND1-FIELD1 = LV_BUZEI.
LS_EXTEND1-FIELD2 = 'KUNNR'.
LS_EXTEND1-FIELD3 = '0000001000'.
APPEND LS_EXTEND1 TO LT_EXTEND1.
FUNCTION /sappce/dpc_process_extension.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" TABLES
*" IT_ACCIT STRUCTURE ACCIT
*" IT_ACCCR STRUCTURE ACCCR
*" RETURN STRUCTURE BAPIRET2
*" EXTENSION STRUCTURE BAPIACEXTC
*" IT_ACCWT STRUCTURE ACCIT_WT
*" CHANGING
*" VALUE(DOCUMENT_HEADER) LIKE ACCHD STRUCTURE ACCHD
*"----------------------------------------------------------------------DATA ld_tabix TYPE sy-tabix.DATA ld_posnr TYPE posnr_acc.DATA ls_bapi_extension TYPE bapiacextc.DATA ls_accit TYPE accit.DATA ls_acccr TYPE acccr.DATA ls_accit_wt TYPE accit_wt.DATA ld_shkzg TYPE shkzg.DATA ld_currtyp TYPE acccr-currtyp. "N1282263* process extension dataLOOP AT extension INTO ls_bapi_extension.ld_posnr = ls_bapi_extension-field1.* evaluate fieldnameCASE ls_bapi_extension-field2.WHEN c_ext_document_status.
* set document StatusREAD TABLE it_accit INTO ls_accitWITH KEY posnr = ld_posnr.CHECK sy-subrc EQ 0.ld_tabix = sy-tabix.ls_accit-bstat = ls_bapi_extension-field3.
* modify document itemMODIFY it_accit FROM ls_accit INDEX ld_tabix.WHEN c_ext_wbs_element.
* set wbs elementREAD TABLE it_accit INTO ls_accitWITH KEY posnr = ld_posnr.CHECK sy-subrc EQ 0.ld_tabix = sy-tabix.ls_accit-ps_psp_pnr = ls_bapi_extension-field3.
* modify document itemMODIFY it_accit FROM ls_accit INDEX ld_tabix.WHEN c_ext_target_sp_ind.READ TABLE it_accit INTO ls_accitWITH KEY posnr = ld_posnr.CHECK sy-subrc EQ 0.ld_tabix = sy-tabix.
* set target special G/L indicatorls_accit-zumsk = ls_bapi_extension-field3.
* modify document itemMODIFY it_accit FROM ls_accit INDEX ld_tabix.WHEN c_ext_tax_code.
* set tax codeREAD TABLE it_accit INTO ls_accitWITH KEY posnr = ld_posnr.CHECK sy-subrc EQ 0.ld_tabix = sy-tabix.ls_accit-mwskz = ls_bapi_extension-field3.
* modify document itemMODIFY it_accit FROM ls_accit INDEX ld_tabix.WHEN c_ext_tax_base_amount.
* set tax base amountIF ls_bapi_extension-field4 IS INITIAL. "N1282263ld_currtyp = '00'. "N1282263ELSE. "N1282263ld_currtyp = ls_bapi_extension-field4. "N1282263ENDIF. "N1282263READ TABLE it_acccr INTO ls_acccrWITH KEY posnr = ld_posnr "N1282263curtp = ld_currtyp. "N1282263
* WITH KEY posnr = ld_posnr. "N1282263CHECK sy-subrc EQ 0.ld_tabix = sy-tabix.ls_acccr-wmwst = ls_bapi_extension-field3.
* modify document itemMODIFY it_acccr FROM ls_acccr INDEX ld_tabix.WHEN c_ext_stat_tax_amount.
* set statistic tax amountREAD TABLE it_accit INTO ls_accitWITH KEY posnr = ld_posnr.CHECK sy-subrc EQ 0.ld_tabix = sy-tabix.ls_accit-sttax = ls_bapi_extension-field3.
* modify document itemMODIFY it_accit FROM ls_accit INDEX ld_tabix.WHEN c_ext_stat_tax_amount_ccc.
* set statistic tax amount (company code currency)READ TABLE it_accit INTO ls_accitWITH KEY posnr = ld_posnr.CHECK sy-subrc EQ 0.ld_tabix = sy-tabix.ls_accit-sthtx = ls_bapi_extension-field3.
* modify document itemMODIFY it_accit FROM ls_accit INDEX ld_tabix.* set WT_KEY for CREDITOR, if creditor is subject to withholding taxWHEN c_ext_with_tax_creditor.READ TABLE it_accit INTO ls_accitWITH KEY posnr = ld_posnr.CHECK sy-subrc EQ 0.ld_tabix = sy-tabix.ls_accit-wt_key = ls_bapi_extension-field3.ls_accit-qsskz = 'XX'.
* modify document itemMODIFY it_accit FROM ls_accit INDEX ld_tabix.* set withholding taxWHEN c_ext_withholding_tax.CLEAR ls_accit_wt.ls_accit_wt-wt_key = ls_bapi_extension-field1+0(6).ls_accit_wt-witht = ls_bapi_extension-field1+6(2).ls_accit_wt-wt_withcd = ls_bapi_extension-field1+8(2).ld_shkzg = ls_bapi_extension-field1+10(1).ls_accit_wt-wt_qsshb = ls_bapi_extension-field3.ls_accit_wt-wt_qbuihb = ls_bapi_extension-field4.APPEND ls_accit_wt TO it_accwt.WHEN c_ext_activity.
* set activity for down payment requestsREAD TABLE it_accit INTO ls_accitWITH KEY posnr = ld_posnr.CHECK sy-subrc EQ 0.ld_tabix = sy-tabix.ls_accit-vorgn = ls_bapi_extension-field3.
* modify document itemMODIFY it_accit FROM ls_accit INDEX ld_tabix.*** header data *****************************************WHEN c_ext_business_transaction.
* change activity (needed for CA-JVA)document_header-glvor = ls_bapi_extension-field3.WHEN c_ext_transaction_code.
* change transaction code (needed for CA-JVA)document_header-tcode = ls_bapi_extension-field3.WHEN c_ext_invoice_reference.
* set invoice referenceREAD TABLE it_accit INTO ls_accitWITH KEY posnr = ld_posnr.CHECK sy-subrc EQ 0.ld_tabix = sy-tabix.ls_accit-rebzg = ls_bapi_extension-field3.
* modify document itemMODIFY it_accit FROM ls_accit INDEX ld_tabix.WHEN c_ext_invoice_reference_year.
* set invoice reference yearREAD TABLE it_accit INTO ls_accitWITH KEY posnr = ld_posnr.CHECK sy-subrc EQ 0.ld_tabix = sy-tabix.ls_accit-rebzj = ls_bapi_extension-field3.
* modify document itemMODIFY it_accit FROM ls_accit INDEX ld_tabix.WHEN c_ext_invoice_reference_item.
* set invoice reference itemREAD TABLE it_accit INTO ls_accitWITH KEY posnr = ld_posnr.CHECK sy-subrc EQ 0.ld_tabix = sy-tabix.ls_accit-rebzz = ls_bapi_extension-field3.
* modify document itemMODIFY it_accit FROM ls_accit INDEX ld_tabix.WHEN c_ext_sub_document_type.
* set type of subsequent documentREAD TABLE it_accit INTO ls_accitWITH KEY posnr = ld_posnr.CHECK sy-subrc EQ 0.ld_tabix = sy-tabix.ls_accit-rebzt = ls_bapi_extension-field3.
* modify document itemMODIFY it_accit FROM ls_accit INDEX ld_tabix.WHEN c_ext_invoice_reference_check.
* set invoice reference check = NOREAD TABLE it_accit INTO ls_accitWITH KEY posnr = ld_posnr.CHECK sy-subrc EQ 0.ld_tabix = sy-tabix.ls_accit-rebzg_check = ls_bapi_extension-field3.
* modify document itemMODIFY it_accit FROM ls_accit INDEX ld_tabix.WHEN c_ext_allocation.
* fill allocation for tax itemsREAD TABLE it_accit INTO ls_accitWITH KEY posnr = ld_posnr.CHECK sy-subrc EQ 0.ld_tabix = sy-tabix.ls_accit-zuonr = ls_bapi_extension-field3.
* modify document itemMODIFY it_accit FROM ls_accit INDEX ld_tabix.* insert XAUTO for tax clearing linesWHEN c_xauto.READ TABLE it_accit INTO ls_accitWITH KEY posnr = ld_posnr.CHECK sy-subrc EQ 0.ld_tabix = sy-tabix.ls_accit-xauto = ls_bapi_extension-field3.
* modify document itemMODIFY it_accit FROM ls_accit INDEX ld_tabix.** insert cash discount amount "#976257 "N1140971
* when c_ext_cash_discount_amount. "#976257 "N1140971
* read table it_acccr into ls_acccr "#976257 "N1140971
* with key posnr = ld_posnr. "#976257 "N1140971
* check sy-subrc eq 0. "#976257 "N1140971
* ld_tabix = sy-tabix. "#976257 "N1140971
* ls_acccr-wskto = ls_bapi_extension-field3. "#976257 "N1140971
** modify document item "#976257 "N1140971
* modify it_acccr from ls_acccr index ld_tabix. "#976257 "N1140971* insert posting key (requested by functionality DBM) "#976257when c_ext_posting_key. "#976257read table it_accit into ls_accit "#976257with key posnr = ld_posnr. "#976257check sy-subrc eq 0. "#976257ld_tabix = sy-tabix. "#976257ls_accit-bschl = ls_bapi_extension-field3. "#976257
* modify document item "#976257modify it_accit from ls_accit index ld_tabix. "#976257* othersWHEN OTHERS.CONTINUE.ENDCASE.ENDLOOP.ENDFUNCTION.