SAP SuccessFactors Employee Central Payroll

Prototype for HCM KR Year-end Data Upload Service


This blog post is for SAP partners and customers who want to adopt Year-end Data Upload Service of HCM KR, especially SAP SuccessFactors Employee Central Payroll customers.

Read More: What is SAP SuccessFactors for Employee Central Payroll Certification?

Next, I will guide you to create a prototype on SAP Cloud Platform (SCP for ease of reading), using the JAVA API provided by KR National Tax Service (NTS for ease of reading), to decrypt the PDF document downloaded from NTS website, then convert it into XML format.



As a KR employee, your year-end income & tax deductions data will be collected by NTS electronically, from banks, schools, hospitals, etc. On the other hand, you can use the self-service provided by NTS to review your data via Hometax ( You can download your own data as an electronic PDF document from Hometax, which includes your year-end income & tax deductions information applicable to the legal requirements.

The PDF document is encrypted; NTS provides APIs to decrypt and extract the income & tax deductions information from the PDF document into XML format. As SAP customers, you can download these APIs to build web service application. Then you will be able to use this web service application for your employee to upload his/her PDF document, with Year-end income & tax deductions information.


Development Environment:

  • JDK 1.4
  • Maven 3.+
  • Eclipse with Maven plugins
  • Spring Tools 4 for Eclipse
  • Cloud Foundry Command Line Interface
  • Access to Cloud Foundry environment
  • (Optional) Postman


  • Basic JAVA development
  • Basic SCP deployment experience

(Kindly understand that this development environment is not mandatory but just a reference.)

Application Development

STEP 1: Create a Spring Boot Application

1.1 Create Spring Boot project

Create a new Spring Boot project using Spring Starter project in Eclipse as below:

Select File -> New -> Project… -> Spring Boot -> Spring Starter Project. Specify Group ID, Artifact ID, Name and Description. For the other fields, you could use default values.

For example:

Group ID – com.example
Artifact ID – demo
Name – demo
Description – Demo application for PDF file parsing

(If you are using different name or ID, please also adjust the content accordingly in Step 1.3, 1.4 and 1.5)

1.2 Import NTS JAR

Access, and navigate to download the API as below:

Unpack NTS API, find JAVA API.

Create a folder ‘lib’ in the root directory, then copy below jar files into this folder:

  • bcprov-ext-jdk15-145.jar
  • exportFile-2.0.2.jar
  • itext-2.1.7.jar
  • pdfbox-1.2.1.jar

(Your downloaded files might have different version names if the NTS updates the API.)

1.3 Edit pom.xml

Delete <properties>, <dependencies> and <build> in pom.xml, then insert the content as below:

Text for copy:



		<!-- CF profile -->

(If you are using different name or ID in Step 1.1, or your downloaded files have different version names, please specify your own content in pom.xml. Here I suggest to use JAVA version 1.8, because it will fail to start the application in the SAP Cloud Platform if JAVA version is too high.)

1.4 Create Controller

Create controller – under package – com.example.demo:

Then copy and replace the source code in as below:

package com.example.demo;

import com.epapyrus.api.ExportCustomFile;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

public class FileServiceImpl {

	@PostMapping(value= {"/fileParsing","/fileParsing/{pwd}",}, produces = "multipart/form-data")
	public String fileParsing(@PathVariable(value = "pwd", required = false) String password, @RequestBody byte[] pdfBytes) {
		String strXml = ""; // return value
		String key = "XML"; // key
		try {                          
			ExportCustomFile pdf = new ExportCustomFile();

			// Data Transfer
			byte[] buf = pdf.NTS_GetFileBufEx(pdfBytes, password, key, false);
			int v_ret = pdf.NTS_GetLastError(); 

			if (v_ret == 1) {
				strXml = new String(buf, "UTF-8");
			} else if (v_ret == 0) {
				strXml = "<!-- It is an invalid file. -->";
			} else if (v_ret == -1) {
				strXml = "<!-- Invalid password. -->";
			} else if (v_ret == -2) {
				strXml = "<!-- It is not a PDF file or the file is damaged. ->";
			} else {
				strXml = "<!-- Failure to output data. -->";

		} catch (Exception e) {
			strXml = "Failure to output data"+e.toString();
		return strXml;

(If you are using different name or ID in Step 1.1, please specify your own Source path and package accordingly)

1.5 Create Manifest.yml

Create a new file Manifest.yml under the root directory.

Copy the content into Manifest.yml as below:

- name: demo
  memory: 1G
  timeout: 360
  path: target/demo.jar

(If you are using different name or ID in Step 1.1, please specify your own folder and name.)

STEP 2 : Deploy the Application

2.1 Build the JAR file

Before this step, please check the Properties of your project and copy the Location:

Make sure your maven is working fine. Open Command Prompt, try the command as below:

mvn -v

Let’s build the jar file of the project. Redirect to the folder of your project, replace {location} with the location of your project as below:

cd {location}

Use the maven command line tool with the following command:

mvn clean install -P cf

Wait until BUILD SUCCESS displays.

2.2 Login to SAP Cloud Platform

First find the proper API endpoint for you.

Replace {endpoint} with your own endpoint if necessary.

Set up the API endpoint:

cf api {endpoint}

Then login:

cf login

Input your Email and Password. Check your org and space.

(Specify org and space when necessary.)

2.3 Push the application

After logging in, now you can push your application to SAP Cloud Platform. use command as below:

cf push

Wait for the web service application to start:

STEP 3: Call the API

Now the application is deployed. Check Application Routes of your prototype in SAP Cloud Platform cockpit.

For example, the Application Routes is:

You can now use the link to call the API:

3.1 (Optional test) POST {Application Routes}/fileParsing

You can use Postman to check the link of the web service application.

Convert the PDF (without password) file into XML format.

Then you can confirm the XML format content of the PDF document in the Body

3.2 (Optional test) POST {Application Routes}/fileParsing/{password}

Check the password for the PDF document. Convert the PDF (with password) file into XML format.

Further Actions

Now you can consume the web service application via the request to build a complete solution for KR employee to upload his/her Year-end income & tax deductions information.

However, this prototype can only help us to make sure the process works. Please notice that there are more you should do to make this prototype into a complete solution, like security, performance, etc. You should also pay attention how you call this web service application and consume the xml format information, like data protection, virus attack, xml bomb, etc.

Leave a Reply

Your email address will not be published. Required fields are marked *