User-exit to stop editing Bank data from FK02/FD02
Introduction
This document is intended to show user-exit SAPLBANK to stop editing of bank data from FK02. This is because if user changes the bank data information through FK02 then that changes will be effecting for all vendors using that house bank. If at all the user wants to change the bank data then it can be changed using FI02 transaction code.
We can achieve this by before saving vendor master user-exit as well but with this only from vendor level can be stopped, but by using Bank Data User-exit this will work for both Vendor and Customer master bank data editing stopping. And when user clicks on Bank data then T-code F102 will be called so implemented user-exit of bank will be a good idea.
Scenario
Stopping user to edit bank data from vendor master FK02/FD02.
Directions
In SMOD user-exit for bank data.
In CMOD
Creating a project in CMOD
CODE
*&———————————————————————*
*& Include ZXF12U01
*&———————————————————————*
* Bank data before change
data: wa_bbnka type bnka.
* If T-code is FI01 or FI02 only then allow Bank Data changes
if sy–tcode eq ‘FI01’
or sy–tcode eq ‘FI02’.
else.
* Fetching BANK data before changes
select single *
from bnka
into wa_bbnka
where banks = i_bnka–banks
and bankl = i_bnka–bankl.
if sy–subrc eq 0.
* Checking any info of bank data is changed
if i_bnka–mandt = wa_bbnka–mandt
and i_bnka–banks = wa_bbnka–banks
and i_bnka–bankl = wa_bbnka–bankl
and i_bnka–erdat = wa_bbnka–erdat
and i_bnka–ernam = wa_bbnka–ernam
and i_bnka–banka = wa_bbnka–banka
and i_bnka–provz = wa_bbnka–provz
and i_bnka–stras = wa_bbnka–stras
and i_bnka–ort01 = wa_bbnka–ort01
and i_bnka–swift = wa_bbnka–swift
and i_bnka–bgrup = wa_bbnka–bgrup
and i_bnka–xpgro = wa_bbnka–xpgro
and i_bnka–loevm = wa_bbnka–loevm
and i_bnka–bnklz = wa_bbnka–bnklz
and i_bnka–pskto = wa_bbnka–pskto
and i_bnka–adrnr = wa_bbnka–adrnr
and i_bnka–brnch = wa_bbnka–brnch
and i_bnka–chkme = wa_bbnka–chkme
and i_bnka–vers = wa_bbnka–vers
and i_bnka–bicky = wa_bbnka–bicky
and i_bnka–rccode = wa_bbnka–rccode.
else.
if sy–tcode eq ‘FK01’
or sy–tcode eq ‘FK02’
or sy–tcode eq ‘XK01’
or sy–tcode eq ‘XK02’.
message ‘Bank data cannot be changed or created from vendor master’ type ‘I’.
leave to transaction sy–tcode.
elseif sy–tcode eq ‘FD01’
or sy–tcode eq ‘FD02’
or sy–tcode eq ‘XD01’
or sy–tcode eq ‘XD02’.
message ‘Bank data cannot be changed or created from customer master’ type ‘I’.
leave to transaction sy–tcode.
endif.
endif.
endif.
endif.
Make sure the project is Active.
Testing
By clicking in Bank Data button.
Open the below screen and change any info and press enter then the message will be triggered as given in User-exit.
Good Luck..!!
When I used this customer-exit, I allow bank creation, and allow modification only if the bank is only linked to the current customer/vendor, prohibiting it if a personal number Infotype or another customer/vendor uses the bank.
Regards,
Raymond
Hi Raymond,
Thanks for sharing your req of implementation with the customer exit shown above.
It absolutely make sense, In our case it should not allow to edit any from vendor/customer master.
Cheers..!!
Venkat
To prevent editing bank data it works well, but how to prevent creation of bank data from FK02?
Regards,
Mart