cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to add extra fields as editable fields to a RAP BO?

bdrv
Explorer
0 Kudos
185

Hi experts,

I'm looking for a way to add additional fields to the behavior definition of a RAP BO so that we can change those fields from inside that object. To simply display data we have virtual elements in the projection layer, but in this case we want the fields to be editable. The changes could be saved to an external table via an additional save or unmanaged save, but the tricky thing here seems to be how to add these extra fields to the behavior definition?

Why this question: for example, why I'm looking into this, in HR some long texts are stored as HRPxxxx TLINE tables. Since we don't want to have the user edit these texts, truncated line per line in a table, we need to have a string field in our BO which contains the concatenated version of the HR table data.  In addition it might also be necessary to introduce an etag field for existing tables without admin data, if we want to make that BO draft enabled.

Some approaches I've been looking into so far:

- Use a custom entity as behavior definition entity: unfortunately no draft nor projection layer available with this approach and unmanaged scenario

- Do an outer join with an (empty) z-table which contains the additional fields in the view that is used by the behavior definition: this can actually work but it feels a bit creative. By implementing an edit with additional implementation (here we read the HR table, convert from TLINE tab to string, and set that value in our draft) + an additional/unmanaged save to write back the updated string as TLINE tab in the HR table.

So since my field does not literally exist in any db table, even via the full unmanaged scenario I didn't find a way to solve it in an elegant way. What I'm looking for is a recommended approach to have virtual (changeable) fields in the definition layer instead of the available read-only ones in the projection layer.

Any advice? 🙂

Thanks in advance!

KR,

Bjorn

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
SAP Champion
SAP Champion
0 Kudos

you should try unmanaged bo