Flow Builder: Exclude certain accounting documents from the beginning
One Exposure is the central storage which targets to all actual and forecast operational business transactions, it plays as the single source of truth for all financial risks from operations. Flow Builder is the kernel program which One Exposure integrated with Accounting and Material Management.
One Exposure already provides the properly way to integrate the necessary data. For the accounting part, the following setting will help to restrict the integrate:
- Activation of Company Code and Source application. To integrate with One Exposure, the relevant company code and source application shall be activated.
- Flow type in accounting document item level. Flow type derivation logic will be applied via RWIN during document posting. You can find the detail information regarding flow type derivation logic in official help document. In case, all items inside one accounting document have no flow type, it will be ignored by One Exposure automatically.
Though the mechanisms above provided above offers the flexibility to handle the necessary data, we think you know your data (in this case accounting documents) better than anyone else. We opened another exit in Flow Builder which allows you exclude certain accounting documents from the beginning of the Flow Builder.
Please be aware that this exit only exist in several releases, like OP 1809.
Let’s take an example to demonstrate this new exit: you need exclude all documents with document type ZZ.
A new method SEL_REL_DOC has been added to our standard exit interface IF_FCLM_HADI_APAR.
methods sel_rel_doc amdp options cds session client iv_mandt importing value(IV_MANDT) type MANDT value(IT_DOCS) type ty_doc_rel exporting value(ET_DOCS) type ty_doc_rel.
The type TY_DOC_REL was defined as public in the same interface:
types: BEGIN OF ts_doc_rel, bukrs TYPE bukrs, gjahr TYPE gjahr, belnr TYPE belnr_d, END OF ts_doc_rel . types: ty_doc_rel TYPE STANDARD TABLE OF ts_doc_rel WITH DEFAULT KEY.
So, it is clear that Flow Builder will pass the documents it picked from the document chain (based on the inputted chain step parameter) to this method via inputting parameter IT_DOCS, and after the filtering, you return the documents via exporting parameter ET_DOCS.
To exclude the documents with document type ZZ, an easy way is read it from BKPF. Add the logic to your method SEL_REL_DOC:
select a.bukrs, a.gjahr, a.belnr from :it_docs as a inner join bkpf as b on a.bukrs = b.bukrs and a.gjahr = b.gjahr and a.belnr = b.belnr and b.mandt = :iv_mandt and b.blart <> 'ZZ'
After you regenerate your loading class by using the new exit class, and assign your loading class to Flow Builder, Flow Builder won’t process the document with document type ZZ.
Hope the code snippets help.