Hello Experts,
Posting the documents with Clearing open items and doing the transfer postings is a very common requirement in most of the SAP implementation FICO based projects.
Clearing can be done in multiple ways
-
G/L posting with clearing
-
Customer - Customer Posting with clearing
-
Vendor- vendor Posting with Clearing
Till today for the custom based requirements, we are using either BDC on the transactions F-30 or FB05 with Transfer posting with clearing options or using the below three function modules which are detailed out in the below blog.
-
POSTING_INTERFACE_START
-
POSTING_INTERFACE_CLEARING
-
POSTING_INTERFACE_END
https://blogs.sap.com/2016/10/04/fb05-or-f-30-using-a-standard-sap-fm/
However, with the ABAP cloud and Fiori apps coming into the picture, there was an alternative approach required to perform the transfer postings.
New Approach for the Transfer postings:
During the analysis to find a new class or function module to avoid the BDC coding and perform the above activity, the below applications Upload Journal Entry app F2548
https://fioriappslibrary.hana.ondemand.com/sap/fix/externalViewer/#/detail/Apps('F2548')/S24OPand
the SOAP-based Interface
https://api.sap.com/api/OP_JOURNALENTRYBULKCLEARINGREQUEST_IN/overview
which is posting the Journal Entries is evaluated and realized the class CL_FDC_ACCDOC_POST=> ACCDOC_POST is used in the same.
Before Moving into the technical solution, let us understand what is the Transfer posting with Clearing:
Lets say customer 1 has total open items of 2000 Eur and out of that he wants to transfer 1500 to another customer and clear the original posting we can use any of the transaction FB05 or F-30 to do the same using the options
-
Open Transaction F-30 provide the customer1 details to be cleared and posted
F-30 Transaction
Enter the amount to be transferred from Customer 1
Transfer Amount
Now click on the Process Open Items buttons and check the list of open items
Now click on the Charge Off Difference to charge the remaining amounts to Customer 2 for Clearing as shown below enter amount as *
On Click of back button the posting will be seen as below with the customer line items and the amounts to be transferred,
Thus, you can do the postings and clear the Customer 1. When you open the Open items again for the Customer 1, 1500 will be cleared.
Find the below reference code for the reference for Customer - Customer Transfer posting scenario.
-
Fill the Header structure
-
Fill the Item Table with the line items for the Customer 1 to be transferred
-
Fill the Item table to be cleared structure with the Customer 2 number
-
Simulate using the class method
cl_fdc_accdoc_post
=>
accdoc_simulate to check for any errors
-
In case of no errors use the class
cl_fdc_accdoc_post
=>
accdoc_post or wrap the class inside an RFC Function module for RAP based scenarios and call the function module with Destination 'NONE' to avoid the commit dumps.
NOTE: The below code will help to start with the postings with clearing, but it might not