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

Among all those checks I provided in that blog, I think it’s a 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 the 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 = '' then coalesce(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.

 

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.

 

 

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Alvarez Victor

    Amazing and very instructive job. I am facing some problems due to the standard derivation in FQM_FLOW using Bill of Exchange functionality and for sure your post will help me a lot.

    Keep on with the good work!

    (0) 

Leave a Reply