You are on page 1of 9

Contents

Introduction ............................................................................................................................................. 2
Basics steps to follow ............................................................................................................................... 2
Example................................................................................................................................................ 2
Steps to follow...................................................................................................................................... 3
Have the values ready for posting..................................................................................................... 3
Call the function module POSTING_INTERFACE_START ..................................................................... 3
Call the function module POSTING_INTERFACE_CLEARING ............................................................... 3
Call the function module POSTING_INTERFACE_END ........................................................................ 7
Posted Document ............................................................................................................................. 8

Introduction
There are business requirements where you need to automate customer clearing process (Posting with
Clearing)
Transactions being used;
F-28

FB05

When there are large number of customer payments, it is very difficult to process and post them
manually. By automating this process, users can minimize data entry errors too.
It is important that the payment amounts, invoice amount, bank charges, service charges, etc. match in
order to do successful posting.
The function module that used to accomplish this task actually a BDC recorded using FB05.

Basics steps to follow

Have amounts ready for posting

Call FM POSTING_INTERFACE_START to initiate

Then call FM POSTING_INTERFACE_CLEARING to post

Finally call FM POSTING_INTERFACE_END to complete

Example
Customer pays 2 payments (multiple payments) for 3 invoices (multiple invoices).
Bank deducts bank charges.

Customer Invoices
Inv 123
$200
Inv 234
$300
Inv 456
$400

Customer Payment
Payment 1
Payment 2

Accounting Document Entry


Posting
Key

Account

Amount

Entry

15 Customer

-450 Customer Credit

15 Customer

-450 Customer Credit

40 Bank Account
40 Bank charge Acc

850 GL Debit
50 GL Debit

$450
$450

Bank Charges
Charge 1
$50

Steps to follow
Have the values ready for posting

Company Code
Document Date

Posting Date

Document Currency
Document type

Reference number for the accounting document


Customer number

Customer invoice document numbers to be cleared

Bank account number and the amount


Bank service charge account and the amount

Call the function module POSTING_INTERFACE_START

Call the FM with below parameters

Call the function module POSTING_INTERFACE_CLEARING

If POSTING_INTERFACE_START is successful, then start processing this function module.

Supply below importing parameters


i_auglv
i_tcode
i_sgfunct

= 'EINGZAHL'
= 'FB05'
= 'C'

Incoming payment
Transaction

Supply below values Populate internal tables for the function module
T_FTCLEAR : Clearing document details ( Invoices to be cleared )
FTCLEAR-AGKON

= CUSTOMER.

CUSTOMER NUMBER

FTCLEAR-AGBUK
FTCLEAR-XNOPS
= BELNR.
FTCLEAR-SELVON

= COMPANY_CODE.
= X.

FTCLEAR-SELBIS

= INV_NUMBER.

= INV_NUMBER.

COMPANY CODE
CONSTANT VALUE X FTCLEAR-SELFD
INVOICE NO FIELD 'BELNR'
INVOICE NUMBER
INVOICE NUMBER

Insert a record for each invoice to the T_FTCLEAR table.


The internal table will look like this.

T_FTPOST : Posting document details ( Header and Items )


o

Populate the accounting document header

lwa_ftpost-stype
= K.
lwa_ftpost-count
= 001.
lwa_ftpost-fnam
= 'BKPF-BUKRS'.
lwa_ftpost-fval
= company_code.
APPEND lwa_ftpost TO li_ftpost.

Header entry indicator


Company code field
"Company code value

Since this FM runs through a BDC, dates have to be in the format of the user profile.
lwa_ftpost-stype
= K.
lwa_ftpost-count
= 001.
lwa_ftpost-fnam
= 'BKPF-BLDAT'.
lwa_ftpost-fval
= document_date
APPEND lwa_ftpost TO li_ftpost.
lwa_ftpost-stype
lwa_ftpost-count
lwa_ftpost-fnam

= K.
= 001.
= 'BKPF-WAERS'.

Header entry indicator


Document date field
"Document date value
Header entry indicator
Document currency field

lwa_ftpost-fval
= doc_currency
APPEND lwa_ftpost TO li_ftpost.
lwa_ftpost-stype
= K.
lwa_ftpost-count
= 001.
lwa_ftpost-fnam
= 'BKPF-BLART'.
lwa_ftpost-fval
= document_type
APPEND lwa_ftpost TO li_ftpost.
lwa_ftpost-stype
lwa_ftpost-count

= K.
= 001.

lwa_ftpost-fnam
= 'BKPF-XBLNR'.
lwa_ftpost-fval
= ref_number
APPEND lwa_ftpost TO li_ftpost.

"Document currency value


Header entry indicator
Document type field
"Document type value
Header entry indicator
Reference number field
"Reference number value

Populate accounting document item details


Bank debit entry Posting Key
lwa_ftpost-stype
= P.
Item entry indicator
lwa_ftpost-count
= lwa_ftpost-count. lwa_ftpost-fnam
= RF05A-NEWBS.
lwa_ftpost-fval
= 40.
"Posting Key of Bank account line
APPEND lwa_ftpost TO li_ftpost.

Bank debit entry Account Number


lwa_ftpost-stype
= P.
Item entry indicator
lwa_ftpost-count
= lwa_ftpost-count. lwa_ftpost-fnam
= RF05A-NEWKO.
lwa_ftpost-fval
= bank_account. "Bank account value
APPEND lwa_ftpost TO li_ftpost.

Bank debit entry Amount


lwa_ftpost-stype
= P. Item entry indicator
lwa_ftpost-count
= lwa_ftpost-count.
lwa_ftpost-fnam
= BSEG-WRBTR.
lwa_ftpost-fval
= bank_amount.
"Bank debit amount
APPEND lwa_ftpost TO li_ftpost.

Bank debit entry Profit Center


lwa_ftpost-stype
= P. Item entry indicator
lwa_ftpost-count
= lwa_ftpost-count.
lwa_ftpost-fnam
= COBL-PRCTR.
lwa_ftpost-fval
= profit_center.
"Profit center value APPEND
lwa_ftpost TO li_ftpost.

Increment the count value for the next entry.


lwa_ftpost-count = lwa_ftpost-count +1.

Bank service charge debit entry Posting Key


lwa_ftpost-stype
lwa_ftpost-count

= P.
Item entry
= lwa_ftpost-count.

lwa_ftpost-fnam

= RF05A-NEWBS.

indicator

lwa_ftpost-fval
= 40.
lwa_ftpost TO li_ftpost.

"Posting Key

APPEND

Bank service charge debit entry Account Number


lwa_ftpost-stype
= P.
Item entry indicator
lwa_ftpost-count
= lwa_ftpost-count.
lwa_ftpost-fnam
= RF05A-NEWKO.
lwa_ftpost-fval
= bank_account. "Service charge account APPEND
lwa_ftpost TO li_ftpost.

Bank service charge debit entry Amount


lwa_ftpost-stype
= P.
Item entry indicator
lwa_ftpost-count
= lwa_ftpost-count.
lwa_ftpost-fnam
= BSEG-WRBTR.
lwa_ftpost-fval
= bank_amount. "Service charge amount APPEND
lwa_ftpost TO li_ftpost.

Customer credit entry will be automatically inserted by the SAP standard process and the
amount will be the total of invoices provided in the T_FTCLEAR table. (See the above
step populating T_FTCLEAR table).
The total of invoices should match the bank debit amount + bank charges.

Populated table will look like below;

Function module call will look like below;

Call the function module POSTING_INTERFACE_END

Once POSTING_INTERFACE_CLEARING is successful, call this function module to complete the processing

Posted Document

After a successful posting, the accounting document will look like this.

You can add your own entries based on your requirement as well. (I.e. Customer chargeback)

Author: Harsha Thelikorala


E-Mail: hravindra@gmail.com/ harshat@learnsaptips.com
Website: www.learnsaptips.com
LinkedIn: View my profile in LinkedIn

Disclaimer
This article is done based on my research and readings, unless otherwise stated. The views expressed are
my own and not of anyone else.
Author accepts no liability for the content of the articles in this website or for the consequences of any
actions taken on the basis of the information provided. Using this information is at the users own
discretion and responsibility.