Parallel Loading and Reprocessing of Flat File Data
This chapter contains information about the parallel loading of transaction data in flat file format from multiple source systems into SLT Replication Server.
Parallel Loading of Data from Multiple Source Systems
For better performance, Transaction supports parallel loading of transaction data from multiple source systems into SLT Replication Server. By default, you can load the flat file data from two of your source systems in parallel into SLT Replication Server. For information about adding more source systems, see Add Source Systems for Parallel Loading.
Prerequisite Tasks
Before loading the data, perform the following:
- Copy the setup files available in the following locations to your computer:
<SetupFolder>\<StagingDatabase>\Mappings<SetupFolder>\<StagingDatabase>\Sample_folder_structure-
<SetupFolder>\<StagingDatabase>\ScriptsThe supported staging databases are Microsoft SQL Server and SAP HANA.
- Create a folder named
SOURCE_FILESwith the following subfolders in your computer:Master MappingSRC1INPUTARCHIVEEXCEPTIONSRC2INPUTARCHIVEEXCEPTIONREPROCESSINPUTARCHIVEEXCEPTION
Note: During the setup, you must specify the path of these folders in the global variables of the job for parallel loading of data.
- Perform the following steps to check the documents posted in SAP S/4HANA by using document change functionality for Flat file data:
- Start transaction
/AIF/CONTENT_EXTRACTin the customizing client of your SAP S/4HANA system. - Enter the Deployment Scenario ID
SAP_AIF_0026and run the transaction by pressing F8.
- Start transaction
Set Up Objects for Parallel Loading, Reprocessing of Data
You need to create staging tables and related objects in the staging database for parallel loading and reprocessing of data. Then, you can import the .atl file available in the setup files into your SAP Data Services repository to create data load and reprocessing-related objects in SAP Data Services Designer.
To set up objects for parallel data loading
- Connect to the staging database, and run the scripts located at
<SetupFolder>\<StagingDatabase>\Scripts\Parallel_scriptsin the following order:Tables_1.sqlDecimal_Proc_2.sqlDoc_Split_Proc_Src<Source_Number>_3.sqlFin_Validation_Chk_5.sqlSummarize_Wht_6.sqlUFF_Stg_Validation_Chk_src1_7.sqlUpdate_Err_9.sqlValidation_Chk_10.sql
The staging tables, procedures, and other database objects related to the data load are created.
- In the staging database, run the scripts located at
<SetupFolder>\<StagingDatabase>\Scripts\Reprocess_scriptsin the following order:Tables_1.sqlDecimal_Proc_Rep_2.sqlDoc_Split_Proc_Rep_3.sqlFin_Validation_Chk_Rep_4.sqlSummarize_Wht_Rep_5.sqlUFF_Stg_Validation_Chk_Rep_6.sqlValidation_Chk_Rep_7.sqlLarge_Amt_Split_Proc_Rep_8.sql
- In SAP Data Services Designer, import the
UFF_Journals.atlfile located at<SetupFolder>\<StagingDatabase>\Mappingsinto your SAP Data Services repository. The following projects and jobs are created:-
UFF_Parallelproject:UFF_JournalsandUFF_Reprocess_Journalsjobs -
UFF_MasterData_Mappingproject:Master_Lookup_Loadjob -
UFF_DOCCHGjob
-
- Update the
$v_uff_emailvariable of theUFF_JournalsandUFF_Reprocess_Journalsjobs with the email address of the point of contact. The error messages are sent to the specified email address. - For the
UFF_Journalsjob, update the following global variables with the path in which you created the source-specific folders. For information about the path, see Prerequisite Tasks.-
$UFF_FILEPATH_SRC1: Indicates the path of theINPUTfolder specific to the source system, such asC:\UFF\SOURCE_FILES\SRC1\INPUTthat you created. -
$UFF_FILEPATH_SRC2: Indicates the path of theINPUTfolder specific to the source system, such asC:\UFF\SOURCE_FILES\SRC2\INPUTthat you created. -
$UFF_ARCHIVE_SRC1: Indicates the path of theARCHIVEfolder specific to the source system, such asC:\UFF\SOURCE_FILES\SRC1\ARCHIVEthat you created. -
$UFF_ARCHIVE_SRC2: Indicates the path of theARCHIVEfolder specific to the source system, such asC:\UFF\SOURCE_FILES\SRC2\ARCHIVEthat you created. -
$UFF_SRC1_EXCEPTION: Indicates the path of theEXCEPTIONfolder specific to the source system, such asC:\UFF\SOURCE_FILES\SRC1\EXCEPTIONthat you created. -
$UFF_SRC2_EXCEPTION: Indicates the path of theEXCEPTIONfolder specific to the source system, such asC:\UFF\SOURCE_FILES\SRC2\EXCEPTIONthat you created.
-
- For the
DS_UFF_MASTERdata store, provide the connection details of the staging database that contains the configuration tables. - For the
DS_UFF_SLTdata store, specify the details of the SLT Replication Server database in which the/1LT/CF_E%tables are present. - For the
DS_PSCACHEdata store, update the Cache directory field to point to the folder where you want to create the cache file.
The staging tables, procedures, and other database objects related to data reprocessing are created.
Load Data in Parallel, Reprocess Documents
Before loading the data, make sure that the previous data load is complete with no errors.
To load flat file data from two source systems in parallel, reprocess failed documents
- Place the
MSC_Lookup_Data.xlsxfile that you created during the configuration of SAP S/4HANA at the following location in your computer\\SOURCE_FILES\MasterMapping.Note: For information about the configuration, see Configuring SAP S/4HANA for Data Load in Loading Data, Reprocessing Documents.
- Place the
.csvfile containing your transaction data in theINPUTfolder specific to your source system, such as\SRC1\INPUT. - Run the
UFF_Journalsjob. The transaction data is loaded into SLT Replication Server, and then the.csvfile is moved to theARCHIVEfolder pertaining to the source system, such as\SRC1\ARCHIVE. - Run the
UFF_DOCCHGjob if you want to make document changes in the posted transactions.The source data must contain transaction type as 'C' and match the data which is already present inFIN%orSLTtables except the data which must be changed. - If any errors occur during the data load, a
<SourceSystem>_EXCEPTION_<Date>.csvfile containing the list of failed transactions is created and placed in theEXCEPTIONfolder, such as\SRC1\EXCEPTION\SRC1_EXCEPTION_18092019.csv. - Review the errors, such as
EFFECTIVE_DATE Cant Be Blankspecified in theERROR_DESCcolumn of the.csvlog file, fix the errors, and then place the corrected file in the\REPROCESS\INPUTfolder. - Run the
UFF_Reprocess_Journalsjob. The updated transaction data is loaded into SLT Replication Server, and then the.csvfile is moved to theARCHIVEfolder, such as\REPROCESS\ARCHIVE. - If any of the documents still contain errors, a
.csvfile with the failed documents are created and placed in the\REPROCESS\EXCEPTIONfolder. - Review the errors using the
ERROR_DESCcolumn in the log file, fix the errors, and then place the corrected file in the\REPROCESS\INPUTfolder. For information on the validation of transaction data inFIN%tables, see ''Validation of Transactions'' in Appendix D: Troubleshooting.Note: We recommend that you periodically remove the files that are no longer required from the
Exceptionfolder.
Add Source Systems for Parallel Loading
By default, you can load flat file data from two source systems in parallel into SAP S/4HANA. For the parallel loading of data from more than two source systems, Transaction enables you to add source systems by updating the objects in setup files and SAP Data Services Designer.
To add source systems
- In SAP Data Services Designer, open the
UFF_Parallelproject >UFF_Journalsjob. In theUFF_INITscript, perform the following: -
Copy the lines that contain a reference to
SRC1orSRC2, and paste them in the script. -
In the copied lines, replace
SRC1orSRC2with your source name. - In the
UFF_Journalsjob, create the following global variables for the new source, and then update them with the path in which you created the source-specific folders. For information about the path, see Prerequisite Tasks: $UFF_FILEPATH_<NewSource>$UFF_ARCHIVE_<NewSource>$UFF_<NewSource>_EXCEPTION- In the
UFF_Journalsjob, add a new workflow, namedWF_SCT_<NewSource>_STG, to theWF_UFF_CONTAINERworkflow. - In the
<SetupFolder>\<StagingDatabase>\Scripts\Parallel_scriptsfolder, updateTables_1.sqlwith the code for creating tables, namelyUFF_STG_<NewSource>andUFF_STG_TEMP<NewSourceNumber>by using the code for theUFF_STG_SRC1/UFF_STG_SRC2andUFF_STG_TEMP1/UFF_STG_TEMP2tables as a reference. - In the Parallel_scripts folder, perform the following:
-
Save a copy of the
Doc_Split_Proc_Src1_3.sql or Doc_Split_Proc_Src2_4.sqlscript as“Doc_Split_Proc_<NewSource>_<SequenceNumber>.sql”. -
Save a copy of the
Large_Amt_Split_Proc_Src1_11.sql or Large_Amt_Split_Proc_Src2_12.sqlscript as“Large_Amt_Split_Proc_<NewSource>_<SequenceNumber>.sql”. -
Save a copy of the
UFF_Stg_Validation_Chk_src1_7.sql or UFF_Stg_Validation_Chk_src2_8.sqlscript as“UFF_Stg_Validation_Chk_<NewSource>_<SequenceNumber>.sql”.Where
<SequenceNumber>indicates the order in which the script should be run. -
In the copied files, replace
UFF_STG_SRC1/UFF_STG_SRC2andUFF_STG_TEMP1/UFF_STG_TEMP2withUFF_STG_<NewSource>andUFF_STG_TEMP<NewSourceNumber>.
-
Save a copy of the
- In the
Parallel_scriptsfolder, in theFin_Validation_Chk_5.sqlscript, before theOPEN FIN_ERROR_DOCSline, add the following code snippet:Else if(@P_SOURCE_COLUMN='{new_source}')
BEGIN
DECLARE FIN_ERROR_DOCS CURSOR LOCAL FOR
SELECT UFF_STG_{new_source}.*, FH.ERROR_DESC
FROM UFF_STG_{new_source},FIN_HEADER FH
WHERE FH.UNIQUE_ID in (select UNIQUE_ID from FIN_HEADER where OBJECT_LOGSYS=@P_SOURCE_COLUMN)
AND 1=1 AND
SUBSTRING(UFF_STG_{new_source}.HEADER_ID+''+RIGHT(UFF_STG_{new_source}.COM PANY_CODE,4),1,20) =FH.OBJECT_KEY
AND UFF_STG_{new_source}.REFERENCE_DOCUMENT_NO=FH.REFERENCE_DOCUMENT_NO
AND COALESCE(EFFECTIVE_DATE,0) =COALESCE(DOCUMENT_DATE,0)
AND
COALESCE(UFF_STG_{new_source}.POSTED_DATE,0)=COALESCE(FH.POSTING_DATE,0)
AND FH.STATUS='E';
END
- Finally, add the new source folder, such as
SRC3, with the subfolders,INPUT,ARCHIVE, andEXCEPTIONunder the\SOURCE_FILESfolder in your computer. For information about the path in which you created other source-specific folders, see Prerequisite Tasks.
Control Tables
You can use the tables, control_table and control_table_rep in the staging database to track the status of parallel loading and reprocessing of transaction data. The tables also contain the statistics of previous job runs.
control_table
After you run the job for loading of transaction data in the flat file format, the control_table table in the staging database is populated with the following information about the job run for each source:
-
REC_ID: Indicates the unique identifier of each record. -
RUN_ID: Indicates the unique job run identifier used by different source systems for the same job. -
SOURCE: Displays the name of the source system, such asSOURCE1orSOURCE2. -
STATUS: Displays the value Y to indicate that the job is successful and E to indicate that the job failed with errors. -
PROC_RECORD_CNT: Shows the number of documents that are processed and moved from the staging table,UFF_STG_<SourceSystem>to theFIN%tables. -
HEADER_RECORD_CNT: Shows the number of documents in theFIN_HEADERtable that are ready to be moved to SLT Replication Server. -
ITEM_RECORD_CNT: Shows the number of documents in theFIN_ACCT,FIN_CREDIT,FIN_DEBIT,FIN_PRDTAX, andFIN_WHTAXtables that correspond to the documents inHEADER_RECORD_CNT. -
TRANS_CREDIT_STG: Displays the sum of credit amounts in the document currency in theUFF_STG_<SourceSystem>table. -
TRANS_DEBIT_STG: Displays the sum of debit amounts in the document currency in theUFF_STG_<SourceSystem>table. -
LOC_CREDIT_STG: Displays the sum of credit amounts in the company currency in theUFF_STG_<SourceSystem>table. -
LOC_ DEBIT_STG: Displays the sum of debit amounts in the company currency in theUFF_STG_<SourceSystem>table. -
TRANS_CREDIT_FIN: Displays the sum of credit amounts in the document currency in theFINtables. -
TRANS_DEBIT_FIN: Displays the sum of debit amounts in the document currency in theFINtables. -
LOC_CREDIT_FIN: Displays the sum of credit amounts in the company currency in theFINtables. -
LOC_DEBIT_FIN: Displays the sum of debit amounts in the company currency in theFINtables. -
ERR_CNT: Shows the error count in theUFF_STG_ERROR_LOGtable. -
TIME_STAMP: Displays the time when the job run is complete.
control_table_rep
After you run the job for reprocessing of transaction data in the flat file format, the control_table_rep table in the staging database is populated with the following statistics:
-
REC_ID: Indicates the unique identifier of each record. -
STATUS: Displays the value Y to indicate that the job is successful and E to indicate that the job failed with errors. -
PROC_RECORD_CNT: Shows the number of documents that are processed and moved from the staging table,UFF_STG_<SourceSystem>to theFIN%tables. -
HEADER_RECORD_CNT: Shows the number of documents in theFIN_HEADERtable that are ready to be moved to SLT Replication Server. -
ITEM_RECORD_CNT: Shows the number of documents in theFIN_ACCT,FIN_CREDIT,FIN_DEBIT,FIN_PRDTAX, andFIN_WHTAXtables that correspond to the documents inHEADER_RECORD_CNT. -
TRANS_CREDIT_STG: Displays the sum of credit amounts in the document currency in theUFF_STG_<SourceSystem>table. -
TRANS_DEBIT_STG: Displays the sum of debit amounts in the document currency in theUFF_STG_<SourceSystem>table. -
LOC_CREDIT_STG: Displays the sum of credit amounts in the company currency in theUFF_STG_<SourceSystem>table. -
LOC_ DEBIT_STG: Displays the sum of debit amounts in the company currency in theUFF_STG_<SourceSystem>table. -
TRANS_CREDIT_FIN: Displays the sum of credit amounts in the document currency in theFINtables. -
TRANS_DEBIT_FIN: Displays the sum of debit amounts in the document currency in theFINtables. -
LOC_CREDIT_FIN: Displays the sum of credit amounts in the company currency in theFINtables. -
LOC_DEBIT_FIN: Displays the sum of debit amounts in the company currency in theFINtables. -
ERR_CNT: Shows the error count in theUFF_STG_ERROR_LOGtable. -
TIME_STAMP: Displays the time when the job run is complete.