Flow Builder Plus: extend standard logic for fetching bank account
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.
Hi Hongjun Qian,
Can the same solution be applied when using Flow builder lite?
Hi Hongjun Qian ,
Thanks again for a very useful blog, this solutions works fine for G/L postings!
I have a similar question regarding AP & AR postings are deriving house bank and house bank accounts for those flows in CM.
As standard, AP & AR postings (e.g. vendor & customer invoices/credit memos) do not have direct assignment to a bank account, they appear as "Unassigned" in the Cash Flow Analyzer.
This also means that these flows don't appear in the Short-Term Cash Positioning (STCP) app because this app only displays flows that are linked to a bank account.
Therefore, to get the AP&AR forecasted flows into the STCP reporting, a bank account needs to be assigned to those flows in FQM_FLOW.
This must be a need and requirement for most customers so I was wondering if you have a proposal or suggestion for how to do this? Do you expect this to be a customer specific solution also implemented using BAdI BADI_FQM_FLOW_ADJUST_CORE?
Frankly speaking, there is no standard solution for this case though we received similar requirement already.
However, there are several non-standard approaches in my mind, which approach you prefer?
Best regards, Hongjun
Hi Hongjun Qian,
I was thinking that the best way would be to derive the bank account on the flows in FQM_FLOW because this would work for both Cash Flow Analyzer (CFA) and Short-Term Cash Positioning (STCP). Do you have any experience or advice for doing this?
But I can also see an advantage of being able to displaying unassigned flows in STCP so users have the visibility and can decide what to include/exclude using the "Cash Position Profiles".
For example, add option in Cash Position Profiles to include or exclude unassigned flows. And then if unassigned flows are to be included, they could be displayed as shown in the screenshot below as an unassigned node at the bank account level.
Unassigned in STCP
The experience or advice to derive house bank is the major purpose of this blog. I think STCP is focus on the positioning therefore it skips the flows without bank account information by design.
Thank you for the inputs.
Best regards, Hongjun
Hi Hongjun Qian ,
This blog only talks about deriving the house bank from G/L account master data. The real challenge and value comes from deriving the correct bank account for AP & AR flows.
And regarding STCP, I struggle to see how there can be an accurate cash position if AP & AR flows are not included.
For example, the business needs to see AR open items in the STCP app to see how much cash is expected to be received into the bank accounts from incoming customer payments.