SAP LOAN_REVERSE Function Module for Reverse the Loan Postings
LOAN_REVERSE is a standard loan reverse SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Reverse the Loan Postings processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for loan reverse FM, simply by entering the name LOAN_REVERSE into the relevant SAP transaction such as SE37 or SE38.
Function Group: TRDB
Program Name: SAPLTRDB
Main Program: SAPLTRDB
Appliation area: F
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function LOAN_REVERSE pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'LOAN_REVERSE'"Reverse the Loan Postings.
EXPORTING
* I_BKTXT = ' ' "Posting Text
* I_CLEAR_OP_BUFFERS = ' ' "initialisiert interne OP-Fortschreibung in BSS
* I_POST_ONLY = ' ' "Vorgangsklammern werden inaktiv gesetzt
* I_REVACCOUNT_PAYED_DISB = "Buchung bei abgeführten Auszahlungen auf Stornokonto
* I_REVACCOUNT_CLEARED_POST = "Buchung bei ausgeglichener Habenstellung auf Stornokonto
* I_CLEAR_LOANREF_V = ' ' "Initialisiert Puffer valutarischen Klammer in BSS
* I_FLG_NO_FI_DOC = ' ' "
* I_REVACC_CLEARED_POST_NO_POPUP = "Select Reversal Account or Acc. receivable. Overrides I_REVACCOUNT_CLEARED_POST
* I_FLG_PREP_NEGATIVE_POSTINGS = ' ' "Characteristics of Negative Postings
* I_PROTOCOL = 3 "Protokoll erzeugen und/oder schreiben
* I_SIMULATION = ' ' "Nur Simulation der Buchungen
I_PRIMANOTA = "Primanota der Buchungen
I_SUPERPRIMANOTA = "Superprimanota der Buchungen
* I_PROTOCOL_TEXT = ' ' "Text des Protokolls
* I_OMIT_CHECKS = ' ' "Prüfungen der Buchungsschnittstelle übergehen
* I_INSERT_ACTUAL = 'X' "erzeugte BEKI/BEPI-Sätze auf DB schreiben
* I_ONLY_PLAN_ITEMS = ' ' "nur Plansätze werden zurückgegeben
IMPORTING
ET_LOANREF_DEL = "Table Type LOANREF (Sorted)
ET_BSEG_OP = "Table Type for BSEG
ET_VDBEKI_REV_ALL = "von Stornierung erfassten Belege
TABLES
XT_BEKI_REV = "Documents to Reverse
ET_VDBEKI = "erzeugte VDBEKI-Sätze
ET_VDBEPI = "erzeugte VDBEPI-Sätze
ET_VDBEPP = "erzeugte Plansätze
EXCEPTIONS
POSTING_IMPOSSIBLE = 1 CANCEL_BUTTON_ON_ACCOUNT_SEL = 2
Customer Function user exits
Below is a list of CUSTOMER FUNCTION exit user exits that are available within this program and maybe relevant for this FM.EXIT_SAPLTRDB_001 User-Exit segement text for transfer in FI documents
IMPORTING Parameters details for LOAN_REVERSE
I_BKTXT - Posting Text
Data type: BKPF-BKTXTDefault: SPACE
Optional: Yes
Call by Reference: Yes
I_CLEAR_OP_BUFFERS - initialisiert interne OP-Fortschreibung in BSS
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_POST_ONLY - Vorgangsklammern werden inaktiv gesetzt
Data type:Default: SPACE
Optional: No
Call by Reference: Yes
I_REVACCOUNT_PAYED_DISB - Buchung bei abgeführten Auszahlungen auf Stornokonto
Data type: TRUEOptional: Yes
Call by Reference: Yes
I_REVACCOUNT_CLEARED_POST - Buchung bei ausgeglichener Habenstellung auf Stornokonto
Data type: TRUEOptional: Yes
Call by Reference: Yes
I_CLEAR_LOANREF_V - Initialisiert Puffer valutarischen Klammer in BSS
Data type: XFLAGDefault: SPACE
Optional: Yes
Call by Reference: Yes
I_FLG_NO_FI_DOC -
Data type: XFELDDefault: SPACE
Optional: Yes
Call by Reference: Yes
I_REVACC_CLEARED_POST_NO_POPUP - Select Reversal Account or Acc. receivable. Overrides I_REVACCOUNT_CLEARED_POST
Data type: TB_REVACC_CLEARED_POSTOptional: Yes
Call by Reference: Yes
I_FLG_PREP_NEGATIVE_POSTINGS - Characteristics of Negative Postings
Data type: TB_CTRL_4_NEGATIVE_POSTINGSDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_PROTOCOL - Protokoll erzeugen und/oder schreiben
Data type:Default: 3
Optional: Yes
Call by Reference: Yes
I_SIMULATION - Nur Simulation der Buchungen
Data type:Default: SPACE
Optional: Yes
Call by Reference: Yes
I_PRIMANOTA - Primanota der Buchungen
Data type: VDBEKI-RPNNROptional: No
Call by Reference: Yes
I_SUPERPRIMANOTA - Superprimanota der Buchungen
Data type: VDBEKI-RPNSUPOptional: No
Call by Reference: Yes
I_PROTOCOL_TEXT - Text des Protokolls
Data type:Default: SPACE
Optional: Yes
Call by Reference: Yes
I_OMIT_CHECKS - Prüfungen der Buchungsschnittstelle übergehen
Data type:Default: SPACE
Optional: Yes
Call by Reference: Yes
I_INSERT_ACTUAL - erzeugte BEKI/BEPI-Sätze auf DB schreiben
Data type:Default: 'X'
Optional: Yes
Call by Reference: Yes
I_ONLY_PLAN_ITEMS - nur Plansätze werden zurückgegeben
Data type:Default: SPACE
Optional: Yes
Call by Reference: Yes
EXPORTING Parameters details for LOAN_REVERSE
ET_LOANREF_DEL - Table Type LOANREF (Sorted)
Data type: TRTY_LOANREFOptional: No
Call by Reference: Yes
ET_BSEG_OP - Table Type for BSEG
Data type: TRTY_BSEGOptional: No
Call by Reference: Yes
ET_VDBEKI_REV_ALL - von Stornierung erfassten Belege
Data type: TRTY_VDBEKIOptional: No
Call by Reference: Yes
TABLES Parameters details for LOAN_REVERSE
XT_BEKI_REV - Documents to Reverse
Data type: VDBEKI_REVOptional: No
Call by Reference: No ( called with pass by value option)
ET_VDBEKI - erzeugte VDBEKI-Sätze
Data type: VDBEKIOptional: No
Call by Reference: No ( called with pass by value option)
ET_VDBEPI - erzeugte VDBEPI-Sätze
Data type: VDBEPIOptional: No
Call by Reference: No ( called with pass by value option)
ET_VDBEPP - erzeugte Plansätze
Data type: VDBEPPOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
POSTING_IMPOSSIBLE - Buchungen konnten nicht durchgeführt werden
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
CANCEL_BUTTON_ON_ACCOUNT_SEL - Bei Auswahl des Sto.kto. wurde 'Cancel' gedrückt
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for LOAN_REVERSE Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_i_bktxt | TYPE BKPF-BKTXT, " SPACE | |||
| lt_xt_beki_rev | TYPE STANDARD TABLE OF VDBEKI_REV, " | |||
| lv_et_loanref_del | TYPE TRTY_LOANREF, " | |||
| lv_posting_impossible | TYPE TRTY_LOANREF, " | |||
| lv_i_clear_op_buffers | TYPE TRTY_LOANREF, " SPACE | |||
| lv_i_post_only | TYPE TRTY_LOANREF, " SPACE | |||
| lv_i_revaccount_payed_disb | TYPE TRUE, " | |||
| lv_i_revaccount_cleared_post | TYPE TRUE, " | |||
| lv_i_clear_loanref_v | TYPE XFLAG, " SPACE | |||
| lv_i_flg_no_fi_doc | TYPE XFELD, " SPACE | |||
| lv_i_revacc_cleared_post_no_popup | TYPE TB_REVACC_CLEARED_POST, " | |||
| lv_i_flg_prep_negative_postings | TYPE TB_CTRL_4_NEGATIVE_POSTINGS, " SPACE | |||
| lt_et_vdbeki | TYPE STANDARD TABLE OF VDBEKI, " | |||
| lv_et_bseg_op | TYPE TRTY_BSEG, " | |||
| lv_i_protocol | TYPE TRTY_BSEG, " 3 | |||
| lv_cancel_button_on_account_sel | TYPE TRTY_BSEG, " | |||
| lt_et_vdbepi | TYPE STANDARD TABLE OF VDBEPI, " | |||
| lv_i_simulation | TYPE VDBEPI, " SPACE | |||
| lv_et_vdbeki_rev_all | TYPE TRTY_VDBEKI, " | |||
| lt_et_vdbepp | TYPE STANDARD TABLE OF VDBEPP, " | |||
| lv_i_primanota | TYPE VDBEKI-RPNNR, " | |||
| lv_i_superprimanota | TYPE VDBEKI-RPNSUP, " | |||
| lv_i_protocol_text | TYPE VDBEKI, " SPACE | |||
| lv_i_omit_checks | TYPE VDBEKI, " SPACE | |||
| lv_i_insert_actual | TYPE VDBEKI, " 'X' | |||
| lv_i_only_plan_items | TYPE VDBEKI. " SPACE |
|   CALL FUNCTION 'LOAN_REVERSE' "Reverse the Loan Postings |
| EXPORTING | ||
| I_BKTXT | = lv_i_bktxt | |
| I_CLEAR_OP_BUFFERS | = lv_i_clear_op_buffers | |
| I_POST_ONLY | = lv_i_post_only | |
| I_REVACCOUNT_PAYED_DISB | = lv_i_revaccount_payed_disb | |
| I_REVACCOUNT_CLEARED_POST | = lv_i_revaccount_cleared_post | |
| I_CLEAR_LOANREF_V | = lv_i_clear_loanref_v | |
| I_FLG_NO_FI_DOC | = lv_i_flg_no_fi_doc | |
| I_REVACC_CLEARED_POST_NO_POPUP | = lv_i_revacc_cleared_post_no_popup | |
| I_FLG_PREP_NEGATIVE_POSTINGS | = lv_i_flg_prep_negative_postings | |
| I_PROTOCOL | = lv_i_protocol | |
| I_SIMULATION | = lv_i_simulation | |
| I_PRIMANOTA | = lv_i_primanota | |
| I_SUPERPRIMANOTA | = lv_i_superprimanota | |
| I_PROTOCOL_TEXT | = lv_i_protocol_text | |
| I_OMIT_CHECKS | = lv_i_omit_checks | |
| I_INSERT_ACTUAL | = lv_i_insert_actual | |
| I_ONLY_PLAN_ITEMS | = lv_i_only_plan_items | |
| IMPORTING | ||
| ET_LOANREF_DEL | = lv_et_loanref_del | |
| ET_BSEG_OP | = lv_et_bseg_op | |
| ET_VDBEKI_REV_ALL | = lv_et_vdbeki_rev_all | |
| TABLES | ||
| XT_BEKI_REV | = lt_xt_beki_rev | |
| ET_VDBEKI | = lt_et_vdbeki | |
| ET_VDBEPI | = lt_et_vdbepi | |
| ET_VDBEPP | = lt_et_vdbepp | |
| EXCEPTIONS | ||
| POSTING_IMPOSSIBLE = 1 | ||
| CANCEL_BUTTON_ON_ACCOUNT_SEL = 2 | ||
| . " LOAN_REVERSE | ||
ABAP code using 7.40 inline data declarations to call FM LOAN_REVERSE
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single BKTXT FROM BKPF INTO @DATA(ld_i_bktxt). | ||||
| DATA(ld_i_bktxt) | = ' '. | |||
| DATA(ld_i_clear_op_buffers) | = ' '. | |||
| DATA(ld_i_post_only) | = ' '. | |||
| DATA(ld_i_clear_loanref_v) | = ' '. | |||
| DATA(ld_i_flg_no_fi_doc) | = ' '. | |||
| DATA(ld_i_flg_prep_negative_postings) | = ' '. | |||
| DATA(ld_i_protocol) | = 3. | |||
| DATA(ld_i_simulation) | = ' '. | |||
| "SELECT single RPNNR FROM VDBEKI INTO @DATA(ld_i_primanota). | ||||
| "SELECT single RPNSUP FROM VDBEKI INTO @DATA(ld_i_superprimanota). | ||||
| DATA(ld_i_protocol_text) | = ' '. | |||
| DATA(ld_i_omit_checks) | = ' '. | |||
| DATA(ld_i_insert_actual) | = 'X'. | |||
| DATA(ld_i_only_plan_items) | = ' '. | |||
Search for further information about these or an SAP related objects