RazorSPoint

ERPConnect Services with Nintex Forms

Sebastian SchützeSebastian Schütze
This entry is part 4 of 4 in the article series ERPConnect Services

In this part of the series I explain how to use the JavaScript library provided by Theobald Software to call their webservice. You could do that without the library, but it makes things so much easier (you will see). In the following section I show how to use Nintex and Theobald Software to get a very dynamic experience, which is much better than with the Nintex actions. This example is a real customer scenario that I implemented. The requirement was that employees should be able to purchase company internal material for private use. These materials were much cheaper than on the public market. The customer uses SharePoint as their intranet solution and they wanted to have a SharePoint list connected to the SAP system. Since the list should save the data on their own and should only synchronize on the users input, no external list was used.

The employee creates an entry in that list, which triggers an approval process in form of a Nintex workflow. After the approval the employee can go to the storage with a printed confirmation an they can collect their approved material. The cost where transmitted via scheduled workflow to the finance department, which were then charged on the salary of the employee.

No input Errors with Data from SAP

Mandatory input of product information should not be entered manually by the user. This would lead to spelling mistakes or wrong information. Below you can see the Nintex form that is used. For the identification of the product, the SAP material number is used. This number is unique.

Nintex-Form for buying products

Two Possibilities to Fill Your Form

Since inputs like price or technical data of the product can lead to errors, two different methods can be used to get the data directly from SAP. On one hand you can use ERPConnect Services Nintex workflow actions.

possible Nintex actions shipped with ERPConnect Services

Those can be used to call SAP tables or BAPI functions. This possibility has one disadvantage. Due to the nature of workflows, data will be filled after saving the form. In this case the employee does not get any feedback. He will not be able to see if the material number was correct or what the price is. This can only happen with delay, which is not very comfortable. On the other hand, the second and more suitable method is using Theobald Software JavaScript library in the Nintex form. This enables you to load data directly into the form. In this case, after entering the material number a green hook is shown. If the entry is wrong a red cross is shown. This makes it possible to give immediate feedback.

successfully filled Nintex form for the product purchase

 More Precise: A Code Sample

To access the SAP data from the form, you just need a short JavaScript snippet. Besides code to access the form control itself, we can do the SAP query with the shipped ECS (ERPConnect Services) JavaScript library with the name „theobald.ecs.micro.min.js“. This can be downloaded from the Theobald Software website. The query is shown below

tEcs.executeFunction({
    name: 'Z_ECS_PRODUCT_GET_LIST',
    data: {
        exports: {
            SEARCH_PRODTYPE: '',
            SEARCH_PRODUCTNR: metarialNumberInput.val()
        }
    },
    done: function (data) {
        var charValRows = data.table.T_PRODUCTS.rows[0];
        for (var id in charValRows) {
            console.log(idx + ': ' + charValRows[idx])
        }
    },
    fail: function (data) {
        console.log('something went wrong');
        console.log(JSON.stringify(data));
    }
});

In line 1 the executFunction method is called to call a RFC enabled building block. Additionally the function to call is named in line 2 together with the parameters in line 3 to 8. In this query the product is searched my the material number. In lines 9 to 14 the return data on sucess are proceeded and from line 15 to 19 when the request failed. You can go much more wild with the library and Nintex forms. But to get started is pretty easy!



Sebastian is an Azure Nerd with focus on DevOps and Azure DevOps (formerly VSTS) that converted from the big world of SharePoint and O365. He was working with O365 since 2013 and loved it ever since. As his focus shifted in 2017 to more DevOps related topics in the Microsoft Stack. He learned to love the possibilities of automation. Besides writing articles in his blog and German magazines, he is still contributing to the SharePoint Developer Community (and PnP SharePoint) to help to make the ALM part a smoother place to live in.

Comments 0
There are currently no comments.

This site uses Akismet to reduce spam. Learn how your comment data is processed.