Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
Product and Topic Expert
Product and Topic Expert
Currently I need to block a supplier's invoice if some situatin like GR/IR Deviation Exceeds Threshold happened , I investiage  nodejs soap to realize this .  Let me share the step by step process for this which maybe helpful for you in your project :


  • You have installed nodejs. Make sure you run the latest long-term support (LTS) version of Node.js with an even number like 16. Refrain from using odd versions, for which some modules with native parts will have no support and thus might even fail to install.

  • You have installed the latest version of Visual Studio Code.


Step 1:  Check the Journal Entry - Change in API hub and download the api specificaiton .

Step 2: Configure communication arrangement in S/4 Hana cloud :

Step 3: create node project to call the soap api in S/4 Hana Cloud to block supplier invoices with following command :

mkdir  sdkforsoap

cd  sdkforsoap

mkdir external

copy the downloaded API specification to folder external

npm  init

code .


Step 4: adjust packge.json and index.js


"name": "sdkforsoap",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"author": "",
"license": "ISC",
"dependencies": {
"soap": "^0.43.0",
"short-uuid": "^4.2.0",
"uuid": "^8.3.2"

const soap = require('soap');

const short = require('short-uuid');
const uuid = require('uuid');

var sid =short.generate();
var id = uuid.v1();

var options = {
forceSoap12Headers: true
var date1 =new Date().toISOString();

var args = {'MessageHeader':{'ID':sid,'UUID':id,'CreationDateTime':date1},'JournalEntryHeader':{'MessageHeader':{'ID':sid,'CreationDateTime':date1},'HeaderKey':{'AccountingDocument':'5100000050','CompanyCode':'1310','FiscalYear':'2022'},'DocumentHeaderTextChange':{'DocumentHeaderText':'hello1','FieldValueChangeIsRequested':true}},'JournalEntryDebtorCreditorItem':{'MessageHeader':{'ID':sid,'CreationDateTime':date1},'ItemKey':{'AccountingDocument':'5100000050','CompanyCode':'1310','FiscalYear':'2022','AccountingDocumentItemID':'1'},'PaymentBlockingReasonCodeChange':{'PaymentBlockingReasonCode':'A','FieldValueChangeIsRequested':true}}};

client.setSecurity(new soap.BasicAuthSecurity('username','password'));
// client.addSoapHeader('MessageID',id,'Action','')






Step 5: run the application .

Step 6, check the result in s/4 hana cloud


To be continue , I will adjust code to be deployed on BTP cloud foundry runtime and share  the steps


Best regards!

Jacky Liu