From time to time we need to check what data is entered in our transaction/deal. But Financial Validation instrument (tr. OB28) is not working here.
So what do we have?
BADI FTR_TR_GENERIC have 2 methods which will help us to fulfill the task.
- Method EVT_TRANSACTION_CHECK – it starts when we press “Check” button inside our transaction/deal
- Method EVT_TRANSACTION_SAVE_CHECK – method starts when we press “Save” button and before database update take place.
Scenario: Let’s say, we have Credit line. Start date: 01.07.2014. End date: 30.06.2016. And we have term of the tranche (ZZSROK field at custom tab): 01.07.2015. After this date we are not able to get new tranche. When we create new tranche we have to check start date, if it is later then term of the tranche. If it is, set an error message to prevent creation of new tranche.
METHOD if_ex_ftr_tr_generic~evt_transaction_check. IF pi_proxy_transaction->a_transaction-sgsart = 'ZTR' . IF pi_proxy_transaction->a_transaction-zzsrok IS NOT INITIAL AND pi_proxy_transaction->a_transaction-zzsrok < pi_proxy_transaction->a_activity-dblfz . CALL METHOD pi_proxy_messages->set_message EXPORTING pi_message_id = 'ZTR' pi_message_number = '002' pi_message_severity = 'E' EXCEPTIONS OTHERS = 4. ENDIF . ENDIF. ENDMETHOD.
This code we have to enter in both methods.
Inside these methods we can use the following data:
pi_proxy_messages->set_message or pi_proxy_messages->set_messages – to set message/messages.
pi_proxy_transaction->a_transaction – the same as VTBFHA table
pi_proxy_transaction->a_activity – VTBFHAZU table
pi_proxy_transaction->a_tab_cashflow – VTBFHAPO table
pi_proxy_transaction->a_tab_conditions – VTBFINKO table
pi_proxy_transaction->a_messages – internal table which store our messages