SAP Knowledge Base Article - Public

3805312 - SF Joule Document Grounding - How to Export and Import Metadata for VectorContent MDF Data

Symptom

This KBA is relevant for:

  • Customers who wants to export and import document grounding metadata of the individual Document Grounding related features, e.g. Ask HR Policies, Agent Knowledge Sources, and Explain Pay. 
  • Customers who want to export document grounding metadata from Ask HR Policies in Customer Managed Joule (CMJ) and then import to Ask HR Policies as part of Agent Knowledge Sources in SAP Managed Joule (SMJ).
  • Customers who want to export document metadata from Explain Pay in Customer Managed Joule (CMJ) and then import to Explain Pay as part of Agent Knowledge Sources in SAP Managed Joule (SMJ).

Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.

Environment

  • SAP SuccessFactors HCM Suite
  • Joule

Resolution

Please follow below steps to export and import VectorContent Metadata for SF Manage Document Grounding.

For Technical Support team, please refer to internal memo.

Step 1: Export VectorContent data from SuccessFactors

Reference: Exporting MDF Object Data | SAP Help Portal 

  1. Go to Admin Center > Import and Export Data.
  2. Select the action to perform as Export Data, select Generic Object as VectorContent, leave the rest of the values as default.
  3. Click Export. An export job will be triggered, navigate to Scheduled Job Manager to track the status of the job. The job may take a few minutes to complete, depending on the number of objects in VectorContent.
  4. In Scheduled Job Manager, go to Job Monitor. Set Job Type filter to be MDF Data Export. When the Status column shows Completed, under the Actions column, click on View Details.
  5. Then click on Download Status to download the job response zip file. Unzip the file to obtain a folder containing the relevant MDF files.

What the folder should contain - There should be 7 files as below in the downloaded zip file:

  1. import_sequence.csv
  2. import.properties
  3. VectorContent.csv
  4. VectorContent-aiUseCases.csv
  5. VectorContent-metadatas.csv
  6. VectorContentMetadata-metadatas.csv
  7. AIUseCaseMetadata-values.csv

Please ensure to keep a copy of the original exported data before performing next steps of modifying data.

Step 2: Modify data in preparation for import

Step 2.1: import_sequence.csv - This file remains unchanged.

Step 2.2: import.properties - In line 3 of import.properties, the value for purgeType should be changed from incremental to fullPurge, and save the file without any other changes:

Step 2.3 - Remaining 5 csv files's Modification by Python
The 5 csv files form a hierarchical MDF import where objects are linked by their externalCode values. The originals had real, populated externalCodes (a number, like 775953), but the import needs them replaced with temporary numbers (#1, #2, ...) so SuccessFactors auto-assigns fresh codes. See:  Auto-Number ExternalCode for MDF Objects | SAP Help Portal  for more information on temporary numbers.

Concept of Owner and Reference columns for the 5 csv files

Every externalCode column falls into one of two roles, refer to below table further:

  • Owner column: the column where an object declares its own code. Each object type has exactly one.
  • Reference column: a column that repeats another object's code to point at it.
File NameOwner ColumnReference column(s)
VectorContent.csvexternalCodeN/A
VectorContent-aiUseCases.csvaiUseCases.externalCodeN/A
VectorContent-metadatas.csvmetadatas.externalCodeN/A
VectorContentMetadata-metadatas.csvmetadatas.metadatas.externalCodemetadatas.externalCode
AIUseCaseMetadata-values.csvmetadatas.metadatas.values.externalCodemetadatas.externalCode metadatas.metadatas.externalCode 

Guideline for replacing externalCode with temporary numbers

  • Owner columns get assigned their own independent #1, #2, ... sequence of temporary numbers.
  • Columns in other files that reference an external code (reference columns) look up the temporary number assigned to the owner external code, so owner-reference links in the hierarchical import stay intact.

We provide a Python script modify_vectorcontent.py to do the replacement. Kindly download the Python script zip file <modify_vectorcontent.zip> from the attachment section of this KBA, unzip the file to get the Python script.

Run the script using the command:  python3 modify_vectorcontent.py 

How to run this script

Step 1. Install the Python via link.

Step 2. Download the modify_vectorcontent.zip and unzip the file. Please put the Python script and the five CSV files in the same folder.

Step 3. Enter cmd in the file path address bar and press Enter. This will open the Windows terminal for the current folder.

Step 4. Type python3 modify_vectorcontent.py in the command line and hit Enter. When you see "Assigned temporary numbers to xxx distinct externalCode value(s).", the script execution is done. For each "xxx.csv" file, the original is renamed to "X-original.csv" and "X.csv" is overwritten with the modified content.

What the code does:

Pass 1 – read files and assign temporary numbers (owners only)

For each file, the code will:

  1. read all rows
  2. Find the owner column's index and every externalCode column's index
  3. Walks through the data rows, and for each new value in the owner column, assigns the next temporary number (#1, #2, ...)

Note:

  • Every owner column restarts its sequence at #1
  • Original externalCode value to temporary number mapping is shared across all files. This is what enables a reference in one file to find the temporary number an owner assigned in another.
  • Reference columns are ignored in the first pass, since they only borrow external codes.

Pass 2 – rewrite every file

For every data-row externalCode cell (owner and reference), we use the mapping to replace the original value with the temporary number. Because owners and references share the same mapping, a reference cell automatically resolves to the exact temporary number its owner got.

Step 3: Create zip file with modified VectorContent related files:

Select all 7 files that modified correctly from Step 1 and Step 2,  and compress them as a zip file.

  1. import_sequence.csv
  2. import.properties
  3. VectorContent.csv
  4. VectorContent-aiUseCases.csv
  5. VectorContent-metadatas.csv
  6. VectorContentMetadata-metadatas.csv
  7. AIUseCaseMetadata-values.csv

Step 4: Import data with created zip file

  1. Go to Admin Center > Import and Export Data.
  2. Select the action to perform as Import Data.
  3. Choose the ZIP File tab, click on Choose File and select the zip file.
  4. (Optional) Click on Validate. A validate job will be triggered, navigate to Scheduled Job Manager to track the status of the job.
  5. Click on Import. An import job will be triggered, navigate to Scheduled Job Manager to track the status of the job. The job may take a few minutes to complete, depending on the number of objects to be imported. Set Job Type filter to be MDF Data Import. When the Status column shows Completed, under the Actions column, click on View Details. Then click on Download Status to download the job response file.

If the downloaded jobResponse file is a single CSV, it means the data import has likely succeeded. The csv should resemble the jobResponse.csv table above.

If the downloaded jobResponse file is a zip file, unzip it and open the individual CSV files. On the right-most column, there is likely an error message indicating why the data import failed. Check the troubleshooting guide below.

Step 5: Troubleshooting

The import.properties file is missing or incomplete
If you get this error "The import.properties file is missing or incomplete" when validating or importing the ZIP file, it may be because the folder of the template was compressed. Do not compress the folder, instead, choose all the files and compress:

If you meet any other errors, please open a case to LOD-SF-PLT-JOU for further investigation.

Keywords

SAP SuccessFactors, SF, Joule, Agent, SAP Managed Joule, VectorContent, metadata, document grounding metadata, HR Policy Q&A, DGS, Manage Document Grounding, SMJ, export, import, customer managed Joule, CMJ, SFGAI-7861, WEF-172126, import and export , KBA , LOD-SF-PLT-JOU , Joule in SuccessFactors , How To

Product

SAP SuccessFactors HCM Suite all versions

Attachments

modify_vectorcontent.zip
Pasted image.png
Pasted image.png