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
- 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_VIEWas an example.The tables can be in the following format:
- OT_<SOURCE_SYSTEM>_<MODULE>_STG
- OT_<SOURCE_SYSTEM>_<MODULE>_STG_TEMP
- 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_SYSDATEis 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
JOINconditions.In this scenario, the underlying table isGL_LEDGERStable and the field that needs to be added to the existing table isLEDGER_ID. The custom field is named asCX_LEDGER_ID. - Append the custom fields to all the
SELECTstatements present in the view. - Check for the conditional statements such as the
GROUP BYstatements in the view and add the custom field created from the underlying table to the conditional statement. - Add the custom fields to the
CREATEstatement at the start of the view worksheet. - Select the view and run it. The new fields are displayed upon refreshing the view.
- 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_STGandOT_EBS_AP_STG_TEMP. - (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_LOGtable.Note: The error log table must be altered to incorporate the custom fields, as it cannot be dropped and rebuilt.
- 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.
- 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_STGandOT_EBS_AP_STG_TEMPtables and select reimport. The tables updated with the custom fields are reimported. - Confirm that the tables are updated with the custom fields by accessing the temporary tables.
- 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.
- 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. - Now, map the custom fields to the
REF%fields of theFIN%tables in a similar manner. - (Optional) If the custom field that you have added is a lookup, perform the following steps:
- Right click the target mapping and select New Function Call. The Select Function window appears.
- Select Lookup Functions under Function categories. Select the lookup_ext function that appears in the Function name pane and select Next.
- Select the Lookup table dropdown and select the datastore having master lookup.
- Select the MSC_GLOBAL_LKP_CACHE table from the Input Parameter window and select OK.
- Add the input and output conditions and update the output column name with the CX_ prefix.
- A lookup function is added to the custom field as shown in the following screenshot.
- Update the
MSC_Lookup_Data.xlsxas shown in the following screenshot.
- Right click the target mapping and select New Function Call. The Select Function window appears.
- Now, open the
xmlgen_procprocedure that is available as a template at the staging database level to populate theFIN%extension tables and load the custom fields. - Add the custom fields to the
xmlgen_procprocedure as shown in the following screenshot. - Copy the updated procedure to your staging database (SQL Server or SAP HANA) and run it.
Note: If the
xmlgen_procprocedure already exists with the same name, drop it and recreate with the updated custom fields. - 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
withholdingscript, uncomment them. - Now, go back to the OT job and access the
FIN EXTtables present under the SLT workflow. TheFIN EXTtables are:- FIN_EXTENT -> /1LT/CF_E_EXTENT
- FIN_EXT_ITEM -> /1LT/CF_E_IT
- In this scenario, go to the
EBS_STG_SLTworkflow. If these tables are not present, refer to the existing workflows and add the tables as shown in the following screenshots, and run theEBS_Journals_OTjob. - Perform the steps mentioned in Steps 1 to 21, with minor adjustments, for the corresponding CDC views, tables, procedures, and ETL jobs as well.
- 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
-
Once the ABAP component (that is shipped with the product) is installed, BAdI
ES_FINS_CFIN_EX_INTFimplementation (/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_RATEGROUPCURRENCYAMOUNTRACCT_SENDER
- Enter the t-code
/MAGSW/DYN_MAP_EXTand 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.
- Save the entries.
Note: If the target fields do not match the given SAP field structure, the report will generate an error message.
- Load the documents from the source system into SAP HANA.
Note: To interface any more fields, enter the source
XMLtag 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
- Create a new custom procedure with the CX_ prefix as per the requirement.
- 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
- 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
- Comment out the existing field expression.
- Add a new field expression and include the date and remarks to provide clarity.
To customize an existing procedure
- Comment out the existing section of the script.
- At the beginning of the procedure, add the changes being performed, the date, and author details.
- 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.