头图

The Open Data Protocol (OData) includes standard CRUD (create, retrieve, update, and delete) operations that map to the POST, GET, PUT/MERGE, and Delete classes of HTTP methods.

In addition, OData supports further service operations: Function Import , which can be invoked by the HTTP methods GET or POST for processing anything that cannot be mapped to standard CRUD operations.

Such additional service operations can be implemented in the service Builder by creating Function Import in the data model.

For example, you can create function imports for the following custom actions:

  • Work Item confirmation
  • Check flight availability

While it is simple to create a new function import to call a custom operation, you should try to avoid the creation of a function import if you can use standard CRUD operations to call the operation you want to use. That is, function imports should only be created for custom actions that cannot be called using standard actions.

An example of Function import is as follows:

Function Import has the following properties to maintain:

  • Return Type Kind:

You can choose between Complex Type and Entity Type, or you can choose not to return any results. In this case, it can be understood as the execution of a function that produces a side effect, such as approving a work item.

  • Return Type: Enter the name of the complex type or entity type you want the function import to return. Existing complex types or entity types can be selected from the project using the input help. If the input help is empty, the relevant complex type or entity type must first be created in the project. If No Return is selected, this field is not editable.
  • Return Cardinality:

If the return type of Function Import is an entity type and:

If the key attribute of the entity type is the core type Edm.DateTime , Edm.DateTimeoffset or Edm.Guid , then the return radix selection is not allowed as 0..1 Because the initial ABAP value is not a valid edm value for these core types, it may cause runtime exceptions. So 0..1 cannot be selected.

如果实体类型的关键属性不是Edm.DateTime , Edm.DateTimeoffset Edm.Guid --- ,并返回基数---1b5eaeb510e92bebff4cb786599601ee--- , 此时0..1消息。 Because according to the OData standard, 0..1 is not recommended for any core type.

When upgrading, if your project contains Function Import, its return type is an entity type, a key field of the core type Edm. DateTime, EDM. DateTimeoffset or EDM. Guid, you will get an error message.

Select the HTTP method to invoke the function import. If the HTTP method is not selected, the function import must be invoked using the GET or POST method.


注销
1k 声望1.6k 粉丝

invalid