清账
-
密码保护:修改SAP会计科目的未清项管理标识
无法提供摘要。这是一篇受保护的文章。
-
SAP用不同币种清账的差异问题
对于香港等多币种活跃流通的地区,可能会存在类似订单币种是HKD,但用USD支付货款的场景,而不是严格按照合同货币进行支付。 如下图所示,应付本币100CNY,供应商借项102.05…
-
用外币清外币未清项的汇兑损益处理
When a payment in foreign currency clears the amount of the invoice exactly in the foreign…
-
应收应付清账现金折扣科目配置及简单应用
应收应付清账现金折扣科目配置及简单应用 应用场景 少收客户1毛钱,且按照公司的财务政策,允许清账。这时候可以计入营业外收支科目,也可以计入财务费用,只要统一口径就好。 科目配置 事…
-
ABAP程序使用FB05清账示例_POSTING_INTERFACE_CLEARING
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213FORM frm_create_ab.*目的:财务分别做预收款和开billing,需要后续做清账对冲DZ和RV.*逻辑:由于只需要模拟人工F-32做清账,只需要根据XBLNR找到借贷方进行对冲即可,因此程序非常简单,核心传递的值为it_ftclear-selfd.*由于VF01开票中已经做了拆分增强,所以billing的金额和DZ的金额是无法对应上的,因此无法采用标准自动清账配置,必须开发实现。*函数:POSTING_INTERFACE_CLEARING.*POSTING_INTERFACE_CLEARING并非纯函数,本质上是call bdc.*examples: http://www.se80.co.uk/sapfms/p/post/posting_interface_clearing.htm* https://blogs.sap.com/2013/06/11/fb05-through-fm-postinginterfaceclearing/* https://archive.sap.com/discussions/thread/1873193* https://archive.sap.com/discussions/thread/2005974* http://blog.csdn.net/chfeijj/article/details/51443437* http://blog.csdn.net/zhongguomao/article/details/50214341*清账逻辑:取出RV、DZ、DG,将XBLNR字段相同的行组合在一起,清账.*处理异常,事务代码:F-32.*重点需要解决的两个问题:1. 清账函数的使用;* 2. 清账数据的准备(按照公司业务逻辑).DATA: it_blntab TYPE TABLE OF blntab WITH HEADER LINE,it_ftclear TYPE TABLE OF ftclear WITH HEADER LINE,it_ftpost TYPE TABLE OF ftpost WITH HEADER LINE,it_fttax TYPE TABLE OF fttax WITH HEADER LINE.DATA: lt_bsad_clearing TYPE TABLE OF bsad WITH HEADER LINE. "客户未清项表.DATA: lt_kunnr TYPE TABLE OF zthy_ecc_kunnr WITH HEADER LINE.DATA: lv_ftclear_agbuk TYPE bukrs. "清账公司代码."仅电商平台用自动清账程序,其他平台人工处理.SELECT * INTO CORRESPONDING FIELDS OF TABLE lt_kunnrFROM zthy_ecc_kunnr."每次处理一个客户的清账业务.*宏.*SELFD = Field Name from the Document Index*SELVON = Input Field for Search Criterion for Selecting Open Items.DEFINE populate_ftclear.it_ftclear-agkoa = &1. "科目类型,based on account type, Vendor or Customer for Out Going / Incoming Payments.it_ftclear-agbuk = &2. "公司代码.it_ftclear-xnops = 'X'. "标准未清项目.it_ftclear-AGUMS = 'A'. "特别总账未清项目.it_ftclear-selfd = 'XBLNR'. "凭证索引中的字段名(使用该字段搜索用来做对冲的借贷方).it_ftclear-selvon = &3. "Input Field for Search Criterion for Selecting Open Items.append it_ftclear.END-OF-DEFINITION.DEFINE populate_ftpost.it_ftpost-stype = &1. "K为header,P为item.it_ftpost-count = &2. "凭证抬头或行项目的计数器(记帐界面).it_ftpost-fnam = &3. "BDC 字段名.it_ftpost-fval = &4. "BDC 字段值.append it_ftpost.END-OF-DEFINITION.*1.Start of call transaction: SHDB.CALL FUNCTION 'POSTING_INTERFACE_START'EXPORTINGi_client = sy-mandti_function = 'C' "B= BDC, C= Call Trans.i_mode = 'N' "N – no screen, A – all screen, E – Error –> Mode we use in Call transactioni_update = 'S' "S: 数据更新完成后执行下一个操作i_keep = 'X' "用于已处理会话的队列删除标志.i_user = sy-unameEXCEPTIONSclient_incorrect = 1function_invalid = 2group_name_missing = 3mode_invalid = 4update_invalid = 5OTHERS = 6.IF sy-subrc <> 0.* Implement suitable error handling hereENDIF.*2.Fill data for SHDB."调用两次,一次借方,一次贷方.populate_ftclear 'D' '1000' 'SA00012090'.*每执行一次添加一条清账行项目.*如果借贷方分录不是正好等于两条,则应使用loop追加清账条目.populate_ftpost: 'K' 1 'BKPF-BUKRS' '1000','K' 1 'BKPF-BLART' 'AB','K' 1 'BKPF-BLDAT' sy-datum,'K' 1 'BKPF-BUDAT' sy-datum,'K' 1 'BKPF-XBLNR' 'SA00012090', "清账参考号.'K' 1 'BKPF-WAERS' 'CNY'.**由于根据参考号(XBLNR)自动搜索清账的方式进行清账,因此行项目级别均不需要传值.** 'P' 1 'RF05A-NEWBS' '17',* 'P' 1 'RF05A-NEWBS' '18', "通过FB05进行预收和应收对冲清账时,记账码为18(手工做F-32为17)* 'P' 1 'RF05A-NEWUM' '', "Special G/L indicator.** 'P' 1 'BSEG-HKONT' '0011220001',* 'P' 1 'BSEG-KUNNR' '0011000000', "统驭科目.** 'P' 1 'BSEG-WRBTR' '347.09', "程序根据搜索条件自动搜出金额,无需指定.* 'P' 1 'BSEG-ZFBDT' sy-datum,* 'P' 1 'BSEG-SGTXT' '清账测试'.*populate_ftpost: 'K' 2 'BKPF-BUKRS' '1000','K' 2 'BKPF-BLART' 'AB','K' 2 'BKPF-BLDAT' sy-datum,'K' 2 'BKPF-BUDAT' sy-datum,'K' 2 'BKPF-XBLNR' 'SA00012090', "清账参考号.'K' 2 'BKPF-WAERS' 'CNY'.**由于根据参考号(XBLNR)自动搜索清账的方式进行清账,因此行项目级别均不需要传值.* 'P' 2 'RF05A-NEWBS' '09',* 'P' 2 'RF05A-NEWUM' 'A', "Special G/L indicator.** 'P' 2 'BSEG-HKONT' '0022030001',* 'P' 2 'BSEG-KUNNR' '0011000000', "统驭科目.** 'P' 2 'BSEG-WRBTR' '347.09', "程序根据搜索条件自动搜出金额,无需指定.* 'P' 2 'BSEG-ZFBDT' sy-datum,* 'P' 2 'BSEG-SGTXT' '清账测试'.*SE16查询表BSAD按BUKRS、AUGBL、GJAHR查询,可查询到清账凭证行及原始行信息.*3.Process BDC.*每次只能传入一个清账分录.*AUGLV Purpose*AUSGZAHL Outgoing payment*EINGZAHL Incoming payment*GUTSCHRI Credit memo(W为承兑汇票,可能比较特殊)*UMBUCHNG Transfer posting with clearing*Note the following :*---------------------------------------*The data is marked with a record type (header, code = K; item, code = P) and counter. – LCF_STYPE_K and LCF_STYPE_S*Up to 950 line items can be transferred.*The data is transferred with the field name and field value.*The data must be transferred in the following sequence:*Document header data ( K 1)*Document item 1 ( P 1)*Document item 2 ( P 2) etc.*The field names are the same as those used on the entry screen (e.g. ‘BKPF-WAERS’, ‘BSEG-WRBTR’, ‘COBL-GSBER’…).*Suppose if it Cost Center / Profit Center – its COBL-KOSTL and COBL-PRCTR*The footer data can be transferred using the following fields:*Posting key: RF05A-NEWBS or BSEG-BSCHL*Account number: RF05A-NEWKO or BSEG-KONTO* or BSEG-KUNNR (for customer accounts)* or BSEG-LIFNR (for vendor accounts)* or BSEG-HKONT (for G/L accounts)*Special G/L indicator: RF05A-NEWUM or BSEG-UMSKZ*Company code (for intercompany posting):* RF05A-NEWBK or BSEG-BUKRS.*The field names are analyzed by the function module so that the data can be assigned to the right screens.*Field names for one-time data or data for an alternative payer must start with ‘BSEC-‘, for example (see screen SAPLFCPD 0100).*Processing with ‘Call Transaction … Using ‘**If processing takes place with ‘Call Transaction .. Using’, the initiator can see whether processing was successful by looking at the export parameter’SUBRC’.**SUBRC = 0 means that the document was posted. The document number is stored in table T_BLNTAB. For intercompany documents, several document numbers are stored here.**SUBRC <> 0 means that the document could not be posted. Information concerning the error which has arisen is returned via the message fields MSGID, MSGNO, etc.**Support of transaction ‘FBB1’**If you want to access transaction FBB1, you should note the following:**Enter the foreign currency key in field BKPF-WAERS.*In this transaction you should enter the local currency amount in field BSEG-WRBTR for each document item.CALL FUNCTION 'POSTING_INTERFACE_CLEARING' "Post with clearing (FB05) using internal posting interfaceEXPORTINGi_auglv = 'AUSGZAHL' " t041a-auglv Clearing Transactioni_tcode = 'FB05' " sy-tcode Transaction codei_sgfunct = space " rfipi-sgfunct Different FUNCT functionIMPORTINGe_msgid = sy-msgid " sy-msgid Message ID (only for Call Trans. ..Using)e_msgno = sy-msgno " sy-msgno Message number (only for Call Trans. ..Using)e_msgty = sy-msgty " sy-msgty Message category (only for Call Trans. ..Using)e_msgv1 = sy-msgv1 " sy-msgv1 Message variable 1 (only for Call Trans. ..Using)e_msgv2 = sy-msgv2 " sy-msgv2 Message variable 2 (only for Call Trans. ..Using)e_msgv3 = sy-msgv3 " sy-msgv3 Message variable 3 (only for Call Trans. ..Using)e_msgv4 = sy-msgv4 " sy-msgv4 Message variable 4 (only for Call Trans. ..Using)TABLESt_blntab = it_blntab " blntab Table of the document numbers (only for Call Trans ..)t_ftclear = it_ftclear " ftclear Clearing datat_ftpost = it_ftpost " ftpost Document header and item datat_fttax = it_fttax " fttax TaxesEXCEPTIONSclearing_procedure_invalid = 1clearing_procedure_missing = 2table_t041a_empty = 3transaction_code_invalid = 4amount_format_error = 5too_many_line_items = 6company_code_invalid = 7screen_not_found = 8no_authorization = 9OTHERS = 10.IF sy-subrc EQ 0."清账成功,清账凭证信息存储在it_blntab中.ELSE."清账失败,查看importing中的消息.ENDIF.*4.After bdc processing.CALL FUNCTION 'POSTING_INTERFACE_END'EXPORTINGi_bdcimmed = 'X'EXCEPTIONSsession_not_processable = 1OTHERS = 2.*5.log record.ENDFORM.