user6412004
user6412004

Reputation:

Can I simulate a Data Transfer Object in RAP application?

I'm trying to use the Restful ABAP Programming model (RAP) to cover the following use-case:

  1. Data is received with field a, field b, field c and field d
  2. Logic is executed to transform the inbound structure to the db structure (field x and y)
  3. Data is saved
  4. After save further actions are executed

Is this even possible? Seems like the projection view must be a subset of the db fields. I couldn't find a way to define additional inbound fields, or even map one field name to another.

Is it correct that RAP can only really expose CRUD for the very same CDS fields that are refering to DB fields?

Upvotes: 1

Views: 207

Answers (1)

vivekanandasr
vivekanandasr

Reputation: 34

did you try adding dummy fields which you want to inbound ?

{
   key a, b, c, d,
   cast(' ' as abap.char(n)) as x,
   cast(' ' as abap.char(n)) as y
 }

so you can retrieve a,b,c,d and process the logic and send back x,y and do the rest of the action in behaviour implementation.

Is it correct that RAP can only really expose CRUD for the very same CDS fields that are refering to DB fields?- Yes that is understanding in terms of payload but in ABAP layer you can determine few other fields any ways.

Upvotes: 1

Related Questions