...
The E2E RESTifier provides a REST interface. The supported content type for results and requests is JSON (application/json).
Execute BAPI function
Code Block |
---|
|
GET /sap/:functionName?parameter1=value1[&...][&callback=clientCallback]
POST /sap/:functionName?[callback=clientCallback] |
...
Parameter | Description |
---|
functionName | BAPI function name. Slash (/) must be encoded as tilde (~). |
parameter1 | BAPI function parameters with value. The parameters names and types can be explored with /sap/:functionName/metadata. |
callback | JSON-P callback |
Example for executing a BAPI
The BAPI function is called with GET
.
...
Code Block |
---|
|
curl -X POST -H "Content-Type: application/json" -d '{"PARTNERNUMBER":"0000008889"}' 'http://localhost:3000/sap/ZGETCUSTOMERDETAILS' |
Response
Code Block |
---|
|
{
"result": {
"CITY": "SPRINGFIELD 07081",
"COUNTRY": "US",
"DISTRICT": "UNION",
"HOUSENUMBERSTREET": "12 BROADWAY",
"NAME": "John Taylor",
"POSTALCODE": "07081",
"PARTNERNUMBER": "0000008889"
},
"self_url": "http://localhost:3000/sap/ZGETCUSTOMERDETAILS?PARTNERNUMBER=0000008889"
} |
...
Code Block |
---|
|
curl -X POST -H "Content-Type: application/json" -d '{"PARTNERNUMBER":"0000008889"}' 'http://localhost:3000/sap/ZGETCUSTOMERDETAILS?~noclean=whitespace,empty-values' |
Exception
If you call a RFC function instead of a BAPI, an exception on the SAP server can happen. In this case you get HTTP status 502 and the following response:
...
Code Block |
---|
{
"error": 502,
"message": " Number:000",
"rfcErrorInfo": {
"code": 5,
"group": 1,
"key": "DIV_BY_ZERO",
"abapMsgType": "",
"abapMsgNumber": "000"
},
"self_url": "http://sap.e2e.ch/sap/Z_TEST_EXCEPTION"
} |
Get BAPI function signature
Code Block |
---|
|
GET /sap/:functionName/metadata |
...
Property | JavaScript Type | Description |
---|
title | String | Name of the object or property. |
type | String | JavaScript type. |
length | Number | Length of a simple type or structure. |
description | String | Description of parameters from SAP. Can be empty. |
sapType | String | Native SAP type. |
sapDirection | String | Input or output parameter. RFC_IMPORT | RFC_EXPORT | RFC_CHANGING | RFC_TABLES |
sapTypeName | String | Name of a structure or name of a structure of a table. |
dbTable | String | Name of the SAP database table |
dbTableField | String | Field of the SAP database table |
label | String | Short description |
Get description of BAPI function STFC_STRING.
...
Code Block |
---|
|
{
"error": null,
"metadata": {
"title": "Signature of SAP RFC function ZGETCUSTOMERDETAILS",
"type": "object",
"properties": {
"PARTNERNUMBER": {
"type": "string",
"length": "10",
"sapType": "RFCTYPE_CHAR",
"description": "Character Field Length = 10",
"sapDirection": "RFC_IMPORT",
"label": "Character Field Length = 10",
"title": "PARTNERNUMBER"
}
}
},
"functionName": "ZGETCUSTOMERDETAILS",
"exec_url": "http://localhost:3000/sap/ZGETCUSTOMERDETAILS{?callback}",
"self_url": "http://localhost:3000/sap/ZGETCUSTOMERDETAILS/metadata"
} |
Find BAPI function /sap/functions
Code Block |
---|
|
GET /sap/functions/:searchTerms[/:pageNumber]&[description=1] |
...
Property | JavaScript Type | Description |
---|
FUNCNAME | String | Function name |
GROUPNAME | String | Group name |
APPL | String | Application to which function module is assigned |
HOST | String | Remote host (CPIC) |
STEXT | String | Function description |
Example /sap/functions
Search for customer and get the first 25 functions.
...
Code Block |
---|
|
{
"functionList": [
{
"FUNCNAME": "BAPI_CUSTOMEREXPINV_GETLIST",
"GROUPNAME": "2144",
"APPL": "W",
"HOST": "",
"STEXT": "Agency Business: BAPI - Determine Detailed Data for Expenses Settlement"
},
// ... cut of functions
{
"FUNCNAME": "BAPI_SERVICENOTIFICAT_GETLIST",
"GROUPNAME": "IWWW",
"APPL": "I",
"HOST": "",
"STEXT": "Select service notifications according to customer or contact person"
}
],
"error": null,
"self_url": "http://localhost:3000/sap/functions/customer%20get/2?description=1",
"next_url": "http://localhost:3000/sap/functions/customer%20get/3?description=1",
"previous_url": "http://localhost:3000/sap/functions/customer%20get/1?description=1",
"first_url": "http://localhost:3000/sap/functions/customer%20get?description=1",
"last_url": "http://localhost:3000/sap/functions/customer%20get/5?description=1"
} |
Migrating from version 0.3.2 and below
Change in endpoints:
Old endpoint | New endpoint |
---|
/sap/exec/:functionName | /sap/:functionName |
/sap/metadata/:functionName | /sap/:functionName/metadata |
/sap/findFunction/:searchTerms | /sap/functions/:searchTerms |
...