Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
Hongjun_Qian
Product and Topic Expert
Product and Topic Expert
This post is targeted for Flow Builder 1.0, which still using HAdI as the extensibility. If you already run with Flow Builder Plus, please refer to new post where provides you the same logic for Flow Builder Plus <Flow Builder Plus: extend standard logic for fetching bank account | SAP Blogs>.

 

 

As pointed out in the previous blog <One Exposure: Check Data Quality as the first step>, the storage in One Exposure may contain the data which brings the inconsistent figure in Cash relevant apps, like Cash Position.

Among all those checks I provided in that blog, I think it's the most common case that flows coming from Accounting documents lack of bank account relevant information. In detail, the table BSEG lack of HBKID/HKTID.

The Flow Builder provides the mechanism to extend our standard logic, which we called it "exit". Via implemented the exit, we can solve the case above: flows from Accounting documents missing bank account information. In this post, I would like to provide a way to fetch the bank account information from General Ledger (GL) account master data.

First of all, copy the standard sample class CL_FCLM_APAR_HADI_SAMPLE to local namespace one, such as ZCL_FCLM_APAR_HADI_SAMPLE.

Second, copy the codes below to that clas (You shall use ABAP Development Tool instead of the SAPGUI transaction SE24 because it ships the ADMP codes):
class ZCL_FCLM_APAR_HADI_SAMPLE definition
public
final
create public .

public section.

interfaces IF_AMDP_MARKER_HDB .
interfaces IF_FCLM_HADI_APAR .
protected section.
private section.
ENDCLASS.

CLASS ZCL_FCLM_APAR_HADI_SAMPLE IMPLEMENTATION.

METHOD IF_FCLM_HADI_APAR~FLOW_ADJUST BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT USING
SKB1
vfclmbamaclvw.

et_flows = select
ORIGIN_TRANS_QUALIFIER,
FI_DOCUMENT_NUMBER,
COMPANY_CODE,
FI_DOCUMENT_LINE_ITEM,
PLANNING_GROUP,
PLANNING_LEVEL,
FI_FISCAL_YEAR,
FI_ACCOUNT,
DOCUMENT_DATE,
BASE_CURRENCY,
c.CURRENCY,
CASH_DISCOUNT_PERCENT1,
CASH_DISCOUNT_DAYS1,
CASH_DISCOUNT_PERCENT2,
CASH_DISCOUNT_DAYS2,
DAYS_DUE,
BASELINE_DATE,
PAYMENT_METHOD,
PAYMENT_BLOCK,
ASSIGNMENT,
case when BANK_ACCOUNT_ID <> d.acc_id then d.acc_id
else BANK_ACCOUNT_ID end as BANK_ACCOUNT_ID,
ASSIGNED_COMPANY_CODE,
CERTAINTY_LEVEL,
FLOW_TYPE,
ORIGIN_DOCUMENT_ID_RL,
CLEARED,
ORIGIN_TRANSACTION_ID_RL,
ORIGIN_DOCUMENT_ID,
ORIGIN_FLOW_ID,
BASE_AMOUNT,
AMOUNT,
ORIGIN_TRANSACTION_ID,
TRANSACTION_DATE,
FI_PURCHSE_DOCUMENT_NUMBER,
FI_PURCHSE_LINE_ITEM,
FI_SEQUENTIAL_NUMBER,
BUSINESS_AREA,
HOUSE_BANK,
HOUSE_BANK_ACCOUNT,
COST_CENTER,
CUSTOMER_NUMBER,
VENDOR_NUMBER,
LIQUIDITY_ITEM,
MATERIAL,
PROFIT_CENTER,
PROJECT,
c.SEGMENT,
TRADING_PARTNER,
CONTRACT_NUMBER,
CONTRACT_TYPE
from ( select
ORIGIN_TRANS_QUALIFIER,
FI_DOCUMENT_NUMBER,
COMPANY_CODE,
FI_DOCUMENT_LINE_ITEM,
PLANNING_GROUP,
PLANNING_LEVEL,
FI_FISCAL_YEAR,
FI_ACCOUNT,
DOCUMENT_DATE,
BASE_CURRENCY,
CURRENCY,
CASH_DISCOUNT_PERCENT1,
CASH_DISCOUNT_DAYS1,
CASH_DISCOUNT_PERCENT2,
CASH_DISCOUNT_DAYS2,
DAYS_DUE,
BASELINE_DATE,
PAYMENT_METHOD,
PAYMENT_BLOCK,
ASSIGNMENT,
BANK_ACCOUNT_ID,
ASSIGNED_COMPANY_CODE,
CERTAINTY_LEVEL,
FLOW_TYPE,
ORIGIN_DOCUMENT_ID_RL,
CLEARED,
ORIGIN_TRANSACTION_ID_RL,
ORIGIN_DOCUMENT_ID,
ORIGIN_FLOW_ID,
BASE_AMOUNT,
AMOUNT,
ORIGIN_TRANSACTION_ID,
TRANSACTION_DATE,
FI_PURCHSE_DOCUMENT_NUMBER,
FI_PURCHSE_LINE_ITEM,
FI_SEQUENTIAL_NUMBER,
BUSINESS_AREA,
case when HOUSE_BANK = '' then coalesce(b.hbkid, '') else HOUSE_BANK end as HOUSE_BANK,
case when HOUSE_BANK_ACCOUNT = '' then coalesce(b.hktid, '') else HOUSE_BANK_ACCOUNT end as HOUSE_BANK_ACCOUNT,
COST_CENTER,
CUSTOMER_NUMBER,
VENDOR_NUMBER,
LIQUIDITY_ITEM,
MATERIAL,
PROFIT_CENTER,
PROJECT,
SEGMENT,
TRADING_PARTNER,
CONTRACT_NUMBER,
CONTRACT_TYPE
from :it_flows as a
inner join skb1 as b
on b.mandt = :iv_mandt
and a.company_code = b.bukrs
and a.fi_account = b.saknr) as c
left outer join vfclmbamaclvw as d
on d.mandt = :iv_mandt
and d.linkage_bukrs = c.company_code
and d.linkage_hbkid = c.house_bank
and d.linkage_hktid = c.house_bank_account
and c.transaction_date >= d.linkage_valid_from
and c.transaction_date <= d.linkage_valid_to;

ENDMETHOD.
ENDCLASS.

The sample code snippets show you the way to fetch bank account based on house bank/house bank account which defined in GL master data, and it will use the newly found bank account to overwrite the existing bank account if there is a mismatch.

 

After the activation of this class, you need re-generate the loading class for Flow Builder, using t-code: FCLM_FB_UTIL, input the following parameter and press F8 to regenerate the loading class.



 

 
10 Comments