Like old Flow Builder, Flow Builder Plus also offer the flexibility to bring customer logic in.
I had written a post for old Flow Builder: ‘Flow Builder: Using exit to fetch HBKID/HKTID for Accounting Documents missed those information‘ which target to fulfill house bank/house bank account in flows for those accounting documents missing such information.
This post, like the old one which I wrote, will do the same. It will also update final flows for fetching house bank/house bank accounting from GL master data if the flows without bank account.
In old Flow Builder, the customer need create their own AMDP based class, and re-generate loading class for Flow Builder before the logic could be used.
In Flow Builder Plus, the whole process is simplified. What you need to do is, implement a BAdI implementation. And Flow Builder Plus support two BAdI with its initial release:
- FCLM_FB2_EXT. This new BAdI consists of five methods for customer to control the Flow Builder Plus chain tracing logic. This post won’t cover that part.
- BADI_FQM_FLOW_ADJUST_CORE. This BAdI isn’t new to SAP Cash management user as it has been used for other source applications already, like SD, BS, TRM, etc.
- ADJUST_FLOW. The only method in this BAdI interface which will be called before the flows are saved to database. This method takes only one CHANGING parameter CT_FLOWS.
New steps for Flow Builder Plus are:
- Step 1. Create a new implementation for BAdI BADI_FQM_FLOW_ADJUST_CORE.
You need maintain the filter values for your BAdI, as this BAdI was commonly used in One Exposure. Flow Builder Plus using ‘BSEGV’ (same source application as the flows).
- Step 2. Implement the logic.
Unlike old Flow Builder, the BAdI implementation logic is purely ABAP.
Method ADJUST_FLOW accepts only one CHANGING parameter ct_flows. This table will be fulfilled with the flows where Flow Builder Plus generated,
An sample code as following:
METHOD if_fqm_flow_enhancements_core~adjust_flows.
LOOP AT ct_flows ASSIGNING FIELD-SYMBOL(<fs_flow>)
WHERE house_bank IS INITIAL OR house_bank_account IS INITIAL OR bank_account_id IS INITIAL.
" Fulfill the bank account from GL
SELECT SINGLE HouseBank, HouseBankAccount FROM I_GLAccountInCompanyCode
WHERE GLAccount = @<fs_flow>-fi_account AND CompanyCode = @<fs_flow>-company_code
INTO @DATA(ls_glaccount).
IF sy-subrc EQ 0 AND ls_glaccount IS NOT INITIAL.
<fs_flow>-house_bank = ls_glaccount-HouseBank.
<fs_flow>-house_bank_account = ls_glaccount-HouseBankAccount.
ENDIF.
" Recalculate the Bank Account.
IF <fs_flow>-house_bank IS NOT INITIAL AND <fs_flow>-house_bank_account IS NOT INITIAL.
SELECT SINGLE *
FROM i_bankaccountlinkage as a
WHERE a~companycode = @<fs_flow>-company_code AND a~housebank = @<fs_flow>-house_bank
AND a~housebankaccount = @<fs_flow>-house_bank_account
AND a~validitystartdate <= @<fs_flow>-transaction_date AND a~validityenddate >= @<fs_flow>-transaction_date
INTO @DATA(ls_t012k).
IF sy-subrc EQ 0 AND ls_t012k IS NOT INITIAL AND ls_t012k-bankaccountinternalid <> <fs_flow>-bank_account_id.
<fs_flow>-bank_account_id = ls_t012k-bankaccountinternalid.
ENDIF.
ENDIF.
ENDLOOP.
ENDMETHOD.
- Step 3. Activate you codes and BAdI implementation.
Activate your codes and the BAdI implementation, you can have a try directly with Flow Builder Plus. And Flow Builder Plus shall call your logic as you wished.
* Please be aware that the information in this post is purely for OP releases.