Skip to Content

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.

6 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) 
  2. Adriana Boiero

    Hi Hongjun Qian,

    Thanks in advance for this detailed explanation, i am facing the problem that i need to complete always the fields HBKID/HKTID with the GL account Master Data. We did all the configuration but it seems the method is not being called. (tested by debug)

    there is any additional activation that should i have to do?

    Thanks a lot.

     

    (0) 
    1. Hongjun Qian Post author

      Hi Andiran Boiero,

      The sample code I provided here, will fetch the HBKID/HKTID during Flow Builder building flows from accounting documents (BKPF/BSEG).

      Once you implemented the exit, you need:

      1. Re-generate the loading class
      2. Re-assign the loading class, it’s optional if the loading class already assigned;

      And then you need rebuild the flows to make the exit work.

      Hope the answer above helps.

       

      (0) 

Leave a Reply