Adam Harkus
Adam Harkus

Reputation: 2210

SAP Gateway: How do setup a service to access an ABAP function directly, without any entities?

I'm putting together a SAPUI5 app which redirects to a 3rd Party site using an authentication token.

The token is generated in an ABAP function on the backend, so how do I call this directly via a SAP Gateway service without any structures or entities, as they aren't required.

I do however need a couple of return values passed back from the ABAP function through the Gateway service, so is this possible?

Upvotes: 3

Views: 618

Answers (2)

futu
futu

Reputation: 897

To be more specific.

In your SEGW you define a Complex Type myReturnType (it is like a structure) in the Data Model that holds the fields you want to return.

enter image description here

For the Complex Type, no CRUDQ methods are generated.

Then you define a Function Import (getAuth) with Return Type Kind Complex Type and select your created Complex Type (myRetunType) as Return Type. Cardinality probably is 1, but this is up to you.

This is a valid service without entities. And in the backend you only implement the function import

Upvotes: 1

Laurens Deprost
Laurens Deprost

Reputation: 1681

how do I call this directly via a SAP Gateway service without any structures or entities, as they aren't required.

This isn't currently possible so I'm afraid implementing an entity or structure is required.

If you don't want to use CREATE_ENTITY you could use a function import, which requires either an entity type or a complex type to be able to return your values from the backend.

I suggest just implementing a simple new entity however.
You can always build upon it in the future, for example when you need to invalidate the token.

Upvotes: 2

Related Questions