SAP RAP Function DDIC Type as Import Parameter

627 views Asked by At

I am trying to create a OData function import via RAP.

When I use an abstract CDS view to define my parameter like this it works just fine:

static function XXX parameter YYY result [0..*] $self;
define abstract entity YYY
{
  importParameter: abap.string;

}

But since I only want a single importing parameter I thought about using a DDIC Type like it is implied in the Cloud ABAP documentation of CDS BDL - InputParameter:

The input parameter entity ParameterEntity can be a CDS abstract entity or a classic DDIC type

When I use DDIC Types, the metadata shows that there are no importing parameters. I tried data elements, domains and primitive types, but even though all of them get through the syntax check with none of them the metadata of my service has a importing parameter.

Structures work again, but then again, I would have a structure with only a single attribute to which I would prefer the abstract CDS view.

Is it not possible the use singular DDIC types as parameter? And if it is possible, how is it possible?

1

There are 1 answers

3
foo On

Try this out, In behavior definition,

static function [fName] parameter [inputParam] result[0..*] [outputParam];

eg:

static function getUserContactInfo parameter userMasterData result[0..*] userContactInfo ;

userMasterData is a structure which might contains userId, UserName or some other keys, userContactInfo is also a structure, might contains email-addr, telephone, fax no, etc...

and in your inmplementation class,

METHODS getUserContactInfo FOR READ IMPORTING userMasterData FOR FUNCTION 
[your rap bo name]~getUserContactInfo RESULT userContactInfo.