The following example illustrates how customer data can be retrieved using the SAP function module SD_RFC_CUSTOMER_GET. For this purpose, ERPConnect Services provides the REST operations CreateFunction and ExecuteFunction / ExecuteFunctionAsXml .
Javascript.
Initially, a function object (JS) for the REST operation CreateFunction with the parameter name SD_RFC_CUSTOMER_GET is created using the jQuery method $.getJSON.
The function object contains the typical parameters of an SAP function module, for example the Export parameters. This example assigns the value T* to export parameter NAME1, to return all customer records where the name begins with T.
After successful execution, the data will be returned as a list which can be accessed in the Tables parameter CUSTOMER_T.
For a function module sample with more parameters or with a connection scope refer to How to use ConnectionScope.
Use of a specific ECS Application
If the program should access a specific ERPConnect Services Application, please use the parameter applicationName.
Creating an SAP Purchase Order via BAPI (using structures and tables)
The following sample shows how to create a purchase order in SAP. We will use the function module BAPI_PO_CREATE BAPI and fill the required header structure and tables.