Symptom
You are using the SAP S/4HANA migration cockpit to migrate data to SAP S/4HANA Cloud Public Edition and want to learn more about the new feature of the Migration Cockpit: Transferring Data from CSV Template Files to Staging Tables.
Environment
You are using SAP S/4HANA Cloud Public Edition.
- SAP S/4HANA Cloud Public Edition - Migrate your Data - Migration Cockpit app
For SAP S/4HANA 2022 - Migrate your Data - Migration Cockpit app - Migrate Data Using Staging tables see KBA 3296020.
Resolution
The SAP S/4HANA migration cockpit allows users to migrate master data and transactional data to SAP S/4HANA, and it facilitates this process by providing predefined migration content and mapping. You can fill the staging tables with data either using XML templates, CSV files, manually or by using third party or SAP’s ETL tools.
You can use CSV files to populate the staging tables with data in the Migration Cockpit - Migrate Your Data app. This option also provides a more flexible approach for uploading data. For example, you can remove columns, and change the order of the columns. Note that the mandatory fields must always be present in the header row of your CSV file. For more information, see CSV Header Options | SAP Help Portal.
Note: For SAP S/4HANA and SAP S/4HANA Cloud Private Edition KBA 3296020 and User Guide - Transferring Data from CSV Template files to Staging Tables - SAP S/4HANA Migration Cockpit
General CSV upload process
The general process to upload CSV files to the SAP S/4HANA migration cockpit is as follows:
1. Verify and adjust the CSV file options available within the SAP S/4HANA migration cockpit.
2. Download the CSV template files for the relevant migration object. You can either use these CSV templates and enter data directly in the CSV files or you can use the CSV templates as a basis to populate new CSV files with data.
3. Create your CSV files. You prepare the data according to the CSV file options within the Migrate your data – Migration Cockpit and create your CSV files. You can also include all your single CSV files in one Zip file. For more details see: Filling CSV Template Files with Data | SAP Help Portal.
Note: For every data structure of a migration object, you must create a single CSV file containing the relevant data.
4. Upload your Zip or CSV files. After preparing your CSV files or your Zip file containing your single CSV files, you have two options for uploading your CSV files.
- Option A. Upload a Zip file which contains all your CSV files - standard way.
- Option B. You create a CSV folder for a migration object and then upload single CSV files or a Zip file containing your single CSV files.
5. Map your CSV file to a data structure. An automatic mapping of the CSV files to the corresponding data structure will occur if the name of the CSV file follows the naming convention for CSV files: <data structure name>#<optional user input>.csv. Otherwise, you must map each of the CSV files to the relevant data structure manually. For more details see: Naming Convention for CSV Files | SAP Help Portal or the User Guide below.
6. Validate and transfer the data to the staging tables. Once you have uploaded your single CSV files or Zip file and the mapping has been successfully completed, you can then validate and transfer the data to the staging tables. Note that if you upload a zip file that contains the CSV files the system will automatically validates the data in the CSV files and transfer the data to the staging tables.
For detailed information and steps, see the following user guide User Guide - Transferring Data from CSV Template files to Staging Tables
Tips and Recommendations for creating your CSV files:
- Before creating your CSV files, you must verify (and adjust if required) the CSV file options available within the Migrate your Data app.
- CSV files must have the extension .csv
For CSV header option “First Row is Header Row”:
- The first row in your CSV file must be a header row.
- The field names in the header row must have the same name as the fields in the header row of the CSV template file.
- The mandatory fields must always be present in the header row of your CSV file.
- The system will expect values for each mandatory field specified in the header row.
- The order of the values in each row must correspond to the order of the fields in the header row.
- In the first row of your CSV file, you can remove the indicators next to the field names if required.
- Empty values for fields at the start of a row must be separated by a delimiter.
- Empty values for fields at the end of a row do not need to be separated by a delimiter.
For CSV header options “No header row” and “Number of rows to skip”:
- The fields must appear in the same order as the staging table definition (see the screenshot below). This ensures that the fields can be mapped more easily, or even automatically by using options for mapping.
- Depending on the definition of the field in the source structure, some fields of the staging tables are defined as NOT NULL and expect a value. The database management system will not add a row to the staging table unless the row has a value for that field.
- Fields that are marked as NOT NULL in the data definition need to contain values for the corresponding columns in the file. Otherwise, the system displays an error message stating that the system cannot insert NULL or update to NULL.
- In addition, if leading zeros are required you need to add them to the relevant values in the CSV file as the ABAP database layer will not add these.
- You must include all fields of the staging table in the csv file and populate them with at least NULL values or empty data. Otherwise, you will get an error message saying that the columns do not match.
For example, for BANK CSV template file:
- CSV Template fields: BANKS(k/*),BANKL(k/*),BANKA(*),PROVZ,STRAS,ORT01, BRNCH,SWIFT,BNKLZ,BGRUP,ISNOTOVERWRITE
- Example for Mandatory and NULL data (CSV file): DE,20000016,Commerzbank,,,,,,,,
For more information about transferring data from staging tables, leading zeros, default values, and correctness of values of certain data types (for example DATE, DECIMAL, TIME, and so on), see SAP KBA 2733253 and the SAP Help Portal: SAP HANA SQL and System Views Reference for SAP HANA Platform → SQL Reference → Data Types.
Other relevant information:
- Similar to the XML file templates available within Migration Cockpit for data migration, the size limitation for CSV files is 100MB. Note that this limitation does not depend on the file format, but on SAP GUI, as NetWeaver does not allow more than 100MB. However, compared to that of the XML file templates, a CSV file can contain more migration object instances.
- Comparing CSV template files with XML template files, a single CSV file corresponds to a worksheet in the XML template file. For example, for the migration object Bank you only need to upload one mandatory CSV file for Bank Master (S_BNKA.CSV), as there is only one mandatory data structure (S_BNKA) (corresponds to one worksheet in the XML template file). Whereas the migration object Customer has multiple data structures. You need to upload one CSV file for each mandatory data structure. For example, the migration object Customer has the mandatory data structure General Data (S_CUST_GEN), as well as the data structures Additional Addresses (S_ADDRESS), Address Usages (S_ADDR_USAGE), International Address Versions (S_ADDRESS_IAV), and so on. You can find the information about mandatory and optional data structures on the SAP Help Portal (Available Migration Objects) at http://help.sap.com/S4_CE_MO. On the Migration Object Tables screen, you can also download a metadata file for each migration object. You can also find information about mandatory fields in the CSV file template files.
See Also
The Data Migration landing page on the SAP Help Portalat http://help.sap.com/S4_CE_DM
Keywords
CSV files, transfer data to staging tables using csv files, migration cockpit, CSV format, CSV upload, CSV Template Files, Migrate your Data – Migration Cockpit, Migration Cockpit Cloud, data migration, new implementation , KBA , CA-LT-MC , S/4HANA Migration Cockpit , How To