Skip to main content

Appendix E: Extensibility Guidelines

You can extend or customize SAP Central Finance Transaction Replication by insightsoftware for SAP S/4HANA either by adding new custom fields and procedures or by extending the existing fields and procedures.

The need for extensibility or customization arises when the required fields and procedures are not present in the SLT tables and hence, cannot be mapped to the fields and procedures of the cFIN tables.

Adding Custom Fields

The steps to add new custom fields to the extraction views are explained in this document.

Note: This procedure is applicable for all the source systems except Flat file.

To add a custom field

  1. Identify the view or table and open it in the SQL Developer. The views can be one-time or CDC at the AP, AR, or GL module level in the following format:
    • OT_<SOURCE_SYSTEM>_<MODULE>_VIEW
    • CDC_<SOURCE_SYSTEM>_<MODULE>_VIEW
    • Let’s take OT_EBS_AP_VIEW as an example.

    The tables can be in the following format:

    • OT_<SOURCE_SYSTEM>_<MODULE>_STG
    • OT_<SOURCE_SYSTEM>_<MODULE>_STG_TEMP
  2. Create a new field with the prefix "CX_". You can either add a new hardcoded field or add a field from one of the underlying tables. For example, CX_SYSDATE is the new hardcoded field added after the last existing field in the view.

    To add a field from an underlying or a new table, use the command as shown in the following screenshot. Also, for the new table, add the required JOIN conditions.

    In this scenario, the underlying table is GL_LEDGERS table and the field that needs to be added to the existing table is LEDGER_ID. The custom field is named as CX_LEDGER_ID.
  3. Append the custom fields to all the SELECT statements present in the view.
  4. Check for the conditional statements such as the GROUP BY statements in the view and add the custom field created from the underlying table to the conditional statement.
  5. Add the custom fields to the CREATE statement at the start of the view worksheet.
  6. Select the view and run it. The new fields are displayed upon refreshing the view.
  7. Add these custom fields to the temporary or cache tables that are created for the view. You can either drop the table and recreate it with the new fields, or you can simply alter the existing table by adding the new fields.
    In this scenario, the tables are OT_EBS_AP_STG and OT_EBS_AP_STG_TEMP.
  8. (Optional) To display the custom fields in the error log, add them to the error log table. In this scenario, it is the EBS_STG_ERROR_LOG table.

    Note: The error log table must be altered to incorporate the custom fields, as it cannot be dropped and rebuilt.

  9. Incorporate the custom fields into every procedure associated with the updated view. If you have made the custom fields mandatory, add them to the procedures performing validation checks.
  10. Now, go to SAP Data Services Designer><Source System>_Journals><Datastore>, right click, and reimport the updated temporary tables. In this scenario, go to EBS_Journals > DS_EBS_MASTER, right click the OT_EBS_AP_STG and OT_EBS_AP_STG_TEMP tables and select reimport. The tables updated with the custom fields are reimported.
  11. Confirm that the tables are updated with the custom fields by accessing the temporary tables.
  12. Go to <Source System_OT> job > OT_<Source System> <Module>STG. In this scenario, go to EBS_OT > OT_EBS_APSTG, map all the underlying queries to the custom fields, and save them.
  13. Similarly, go to the staging data flow, here, it is EBS_MAG_APSTG. Map the custom fields with the existing unmapped REF% fields of the staging tables (MAGNITUDE_STG_ONE and MAGNITUDE_STG_ONE_TEMP) as shown in the following screenshots.
  14. Now, map the custom fields to the REF% fields of the FIN% tables in a similar manner.
  15. (Optional) If the custom field that you have added is a lookup, perform the following steps:
    1. Right click the target mapping and select New Function Call. The Select Function window appears.
    2. Select Lookup Functions under Function categories. Select the lookup_ext function that appears in the Function name pane and select Next
    3. Select the Lookup table dropdown and select the datastore having master lookup. 
    4.  Select the MSC_GLOBAL_LKP_CACHE table from the Input Parameter window and select OK.
    5.  Add the input and output conditions and update the output column name with the CX_ prefix.
    6.  A lookup function is added to the custom field as shown in the following screenshot.
    7. Update the MSC_Lookup_Data.xlsx as shown in the following screenshot.
  16. Now, open the xmlgen_proc procedure that is available as a template at the staging database level to populate the FIN% extension tables and load the custom fields.
  17. Add the custom fields to the xmlgen_proc procedure as shown in the following screenshot.
  18. Copy the updated procedure to your staging database (SQL Server or SAP HANA) and run it.

    Note: If the xmlgen_proc procedure already exists with the same name, drop it and recreate with the updated custom fields.

  19. Upon successful execution, go to SAP Data Services Designer > <Source System>_OT job > withholding script, enter the following commands, and validate the script:
    For SAP HANA as the staging database:
    print('XML Generation For Custom Columns..');
    sql ('DS_Source System_STG','CALL xmlgen_proc({$Source_System})');
    print('XML Generation For Custom Columns Completed');
    For SQL Server as the staging database:
    print('XML Generation For Custom Columns..');
    sql('DS_Source System_STG','EXEC xmlgen_proc {$Source_System} ');
    print('XML Generation For Custom Columns Completed');

    Note: If the commands are already present and commented in the withholding script, uncomment them.

  20. Now, go back to the OT job and access the FIN EXT tables present under the SLT workflow. The FIN EXT tables are:
    • FIN_EXTENT -> /1LT/CF_E_EXTENT
    • FIN_EXT_ITEM -> /1LT/CF_E_IT
  21. In this scenario, go to the EBS_STG_SLT workflow. If these tables are not present, refer to the existing workflows and add the tables as shown in the following screenshots, and run the EBS_Journals_OT job.
  22. Perform the steps mentioned in Steps 1 to 21, with minor adjustments, for the corresponding CDC views, tables, procedures, and ETL jobs as well.
  23. Add the custom field to the Reconciliation report if required.

    Note: You must have the necessary ABAP knowledge to perform this step.

To configure BAdI and interface new custom fields at cFIN

  1. Once the ABAP component (that is shipped with the product) is installed, BAdI ES_FINS_CFIN_EX_INTF implementation (/MAGSW/FINS_CFIN_BADI_IMP) is enabled. The BadI code provides the option to extend the custom fields. Few examples of custom fields are:

    • EXCHANGE_RATE
    • GROUPCURRENCYAMOUNT
    • RACCT_SENDER
  2. Enter the t-code /MAGSW/DYN_MAP_EXT and maintain the fields that needs to be extended. Save the details as displayed in the following image.

    Enter the Target Field (SAP fields in the ACCHD, ACCIT, and ACCCR structure) against the Source Fields (third-party sources) which will be generated and passed in the XML procedure for BAdI during document posting.

  3. Save the entries.

    Note: If the target fields do not match the given SAP field structure, the report will generate an error message.

  4. Load the documents from the source system into SAP HANA.

    Note: To interface any more fields, enter the source XML tag information in the Source Field and Target Field columns. It is not required to add any code to BAdI as long as the mapping is directly from the source field value to the target field value.

To add a new procedure

  1. Create a new custom procedure with the CX_ prefix as per the requirement.
  2. At the source level, either SQL Server or SAP HANA, enter the following commands with the appropriate values in the place of <variables>.

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    CREATE PROCEDURE [CX_CUSTOM_FIELDS_SPN] (<Argument1>, <Argument2>)

    AS

    DECLARE

    <VARIABLES>

    begin

    begin

    <STATEMENTS>

    end

    <Logic towards custom field tax update>

    end

    GO

  3. Save and run the procedure from SAP Data Services Designer.

Adding Extensibility to Existing Fields and Procedures

The steps to add extensibility to the existing fields and procedures are as follows.

To customize an existing field

  1. Comment out the existing field expression.
  2. Add a new field expression and include the date and remarks to provide clarity.

To customize an existing procedure

  1. Comment out the existing section of the script.
  2. At the beginning of the procedure, add the changes being performed, the date, and author details.
  3. Enter the reason for change in the comment.

To add customization in the ETL

  • Create new ETL objects namely, jobs, workflows, dataflow, and fields by adding the prefix “CX_”.
  • Customize the existing field mapping by commenting the existing field, and adding a new mapping. Comment the changes being performed, author, and date information at the flow level.

Was this article helpful?

We're sorry to hear that.