清账例子(20210608)

例一:FB05 through FM, POSTING_INTERFACE_CLEARING

osting Clearing document through function module POSTING_INTERFACE_CLEARING

*** Header and line item diffrentiation:

               LCF_STYPE_K            TYPE  STYPE_PI           VALUE ‘K’, ” HEADER Line

               LCF_STYPE_P            TYPE  STYPE_PI           VALUE ‘P’, ” Line Item

*** Populate and map FTCLEAR  to POSTING_INTERFACE_CLEARING

       LDS_FTCLEAR–AGKOA  = ‘K’ or ‘D’ ( based on account type, Vendor or Customer for Out Going / Incoming Payments.

       LDS_FTCLEAR–AGBUK  =  <company_code>.

       LDS_FTCLEAR–XNOPS  = ‘X’.

       LDS_FTCLEAR–SELFD  = <referece_document_number>

       LDS_FTCLEAR–SELVON = <reference_field> ” SELFD is value of the filed assigned here.

       APPEND LDS_FTCLEAR TO P_LDT_FTCLEAR.

*** FTPOST sample filling data

       LDS_FTPOST–STYPE = P_LCF_STYPE.

       LDS_FTPOST–COUNT = P_LDF_COUNT.

       LDS_FTPOST–FNAM = P_LCF_FNAM.

       LDS_FTPOST–FVAL = P_FVAL.

       APPEND LDS_FTPOST TO P_LDT_FTPOST.



Call the below function modules in following order.

POSTING_INTERFACE_START
POSTING_INTERFACE_CLEARING
POSTING_INTERFACE_END
POSTING_INTERFACE_START :

CALL FUNCTION ‘POSTING_INTERFACE_START’

       EXPORTING

         I_CLIENT           = SY–MANDT

         I_FUNCTION         = ‘C’ ( Function: BDC, Call Trans. Using, internal interface)

         I_MODE             = MODE ( N – no screen, A – all screen, E – Error –> Mode we use in Call transaction)

         I_USER             = SY–UNAME

       EXCEPTIONS

         CLIENT_INCORRECT   = 1

         FUNCTION_INVALID   = 2

         GROUP_NAME_MISSING = 3

         MODE_INVALID       = 4

         UPDATE_INVALID     = 5

         OTHERS             = 6.

     IF SY–SUBRC <> 0.

       MESSAGE ID SY–MSGID TYPE SY–MSGTY NUMBER SY–MSGNO

               WITH SY–MSGV1 SY–MSGV2 SY–MSGV3 SY–MSGV4.

     ENDIF.

POSTING_INTERFACE_CLEARING:

CALL FUNCTION ‘POSTING_INTERFACE_CLEARING’

               EXPORTING

                 I_AUGLV      =      ‘AUSGZAHL’ ” Follow below mentioned table

                 I_TCODE      =     ‘FB05’

               I_SGFUNCT      =      ‘C’

            IMPORTING

              E_MSGID         =      LDS_RETURN–ID

              E_MSGNO         =      LDS_RETURN–NUMBER

              E_MSGTY         =      LDS_RETURN–TYPE

              E_MSGV1         =      LDS_RETURN–MESSAGE_V1

              E_MSGV2         =      LDS_RETURN–MESSAGE_V2

              E_MSGV3         =      LDS_RETURN–MESSAGE_V3

              E_MSGV4         =      LDS_RETURN–MESSAGE_V4

*             E_SUBRC        =      SY-SUBRC

               TABLES

                 T_BLNTAB     =      LDT_BLNTAB

                 T_FTCLEAR    =      LDT_FTCLEAR

                 T_FTPOST     =      LDT_FTPOST

                 T_FTTAX      =      LDT_FTTAX

              EXCEPTIONS

                CLEARING_PROCEDURE_INVALID       = 1

                CLEARING_PROCEDURE_MISSING       = 2

                TABLE_T041A_EMPTY                = 3

                TRANSACTION_CODE_INVALID         = 4

                AMOUNT_FORMAT_ERROR              = 5

                TOO_MANY_LINE_ITEMS              = 6

                COMPANY_CODE_INVALID             = 7

                SCREEN_NOT_FOUND                 = 8

                NO_AUTHORIZATION                 = 9

                OTHERS                           = 10.



AUGLV	Purpose
AUSGZAHL	Outgoing payment
EINGZAHL	Incoming payment
GUTSCHRI	Credit memo
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.
POSTING_INTERFACE_END:

CALL FUNCTION ‘POSTING_INTERFACE_END’

         EXPORTING

           I_BDCIMMED              = ‘X’

         EXCEPTIONS

           SESSION_NOT_PROCESSABLE = 1

           OTHERS                  = 2.

 

例2:http://blog.sina.com.cn/s/blog_69fb8eb60102w12i.html

例3:http://blog.sina.com.cn/s/blog_69fb8eb60102vx8u.html

例4:https://blog.csdn.net/weixin_34186950/article/details/93240653

 

 

标准事物码:Fcc1  中 t041a中记录了可以用哪些记帐码清帐。

### SAP 清账操作指南 #### 剩余支付清账概述 剩余支付清账是指每次清账后系统会自动计算并保留未清项的剩余金额。下次清账时,该剩余金额会被继续处理。这种方式能够实时反映某笔未清项的具体情况,特别是在客户信贷管理方面显得尤为重要[^2]。 然而,这种机制也有其局限性。生成的明细账可能无法完全展示未清项业务分批处理的历史记录,这给后续查询带来了不便。此外,如果新的未清项凭证缺乏适当控制,则可能导致账龄受到影响。 #### 实现阶段的操作准备 在SAP项目的实现阶段,当配置基本完成且自开发正在进行之时,可以利用SAP的标准功能来进行一些基础业务的前台操作测试。此时,关键用户会在外部顾问的支持下熟悉系统的具体应用,并着手编写各模块的操作手册[^1]。 对于涉及财务流程中的清账工作来说,在此期间应当特别关注如何通过有效的培训让关键用户掌握必要的技能,以便日后独立执行相关任务。 #### FB05 部分清账/剩余清账的技术细节 针对FB05事务码下的部分清账或剩余清账过程,可以通过增强点LFIPIF00来优化用户体验。具体的编程逻辑如下所示: ```abap DATA: lt_bdcdata TYPE TABLE OF bdcdata, gv_id TYPE char20. CLEAR: lt_bdcdata, gv_id. CONCATENATE sy-uname 'ADD_SCR' INTO gv_id. IMPORT lt_bdcdata = lt_bdcdata FROM MEMORY ID gv_id. IF sy-subrc = 0. APPEND LINES OF lt_bdcdata TO ft. LOOP AT ft WHERE fval = '/11'. " 将'/11'替换为'=PA' ft-fval = '=PA'. MODIFY ft. ENDLOOP. ENDIF. FREE MEMORY ID gv_id. ``` 上述代码片段展示了如何修改BDC(Batch Data Communication)数据表`lt_bdcdata`的内容,以适应特定场景的需求。特别是将原本用于跳转至下一个页面的选择键`"/11"`更改为`=PA`,从而确保程序流正确转向未清项列表界面[^3]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值