pfx-odata2:create

Creates a single entity in the external system.

Properties

Option

Type

Default

Description

connection

String


Defines a connection to the target system. Another way to define the connection is to specify the serviceUrl, username and password options (see below).

serviceUrl

String


Defines the URL of the target system. Use if the connection is not specified.

username

String


Defines the username for authentication. Use if the connection is not specified.

password

String


Defines the password for authentication. Use if the connection is not specified.

entity

String


Defines the entity type.

id

String


Defines the entity identifier. Mandatory for the update/delete methods. Optional for the read method.

$select

String

*

Specifies a subset of the entity properties that should be returned back. If not specified, all properties are selected. It is a comma-separated list. E.g. $select=Id,ProductName,NetPrice

$filter

String


A predicate expression that selects only entities which match the expression. E.g. $filter=NetPrice le 200 and NetPrice gt 3.5

  • Logical operators: eq, ne, gt, ge, lt, le, and, or, not

  • Arithmetic operators: add, sub, mul, div, mod

  • Grouping operators: ()

$orderby

String


Determines what values are used to order a collection of selected entities. E.g. $orderby=NetPrice asc,ProductName desc

$skip

Integer


Defines the number of records to skip (from the beginning). If defined, the selected collection skips the first N entities and returns just the remaining subset.

$top

Integer


Defines the number of records to include (from the beginning). If defined, just the first N entities from the selected collection are selected.

$inlinecount

String

none

Supported values are:

  • allpages – The response must contain the count of all selected entities after applying the $filter option. The count is returned as a header with the key PfxOpenData2.$inlinecount.

  • none – The response must not contain the count in the response. 

Examples

Create an entity with multiple IDs: A_CreditMemoRequestItems(CreditMemoRequest='60000001',CreditMemoRequestItem='10')

XML
<route id="sap4hana-create-credit-memo-item" autoStartup="false">
 
    <from uri="timer:in?repeatCount=1&delay=5000"/>
    <setBody>
        <groovy>
            [
            "CreditMemoRequest":"60000001",
            "CreditMemoRequestItem":"10",
            "CreditMemoRequestItemCategory":"G2N",
            "CreditMemoRequestItemText":"Computer",
            "TotalNetAmount":new BigDecimal("500.00"),
            "TransactionCurrency":"USD",
            "RequestedQuantity":"10"
            ]
        </groovy>
    </setBody>
 
    <to uri="pfx-odata2://create?entity=A_CreditMemoRequestItem&connection=cognitus"/>
    <log message="Created ${body}"/>
 
</route>