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

RAP Model insert text via text association in managed scenario

SchinniC
Explorer
3,838

Hello experts,

we are currently trying to create an managed application via RAP which involves a text table. The two tables are connected via association/composition and we guessed that the creation would be handled through the behavior definition and this statement:

We have two primary keys for the master data table and the description which should be inserted into the text table with the logon language.

When we enter a text and save the entry the application will only create the master data entry, not the text table entry. Now the question, is it possible to archive this in a managed scenario? Or do we have to use unmanaged approach for this?

Thanks and best regards!

Accepted Solutions (1)

Accepted Solutions (1)

SchinniC
Explorer

Hello,

we kinda went the wrong way here, but now we managed to integrate the texts into this managed scenario.

We added the @ ObjectModel text element Annotation and referenced it to the description field.

Also we added the association for creation and switched to a draft-system (OData v4 requires drafts)

Thanks!

Answers (3)

Answers (3)

juliandanho
Participant

Hi christian.schinner ,


one possible solution would be to use the unmanaged save scenario:

[...]

define behavior for ZP4_I_PLANT_MAINT alias PlaintMaintenance with unmanaged save
[...]


In this scenario, you have the opportunity to effortlessly generate via quick fix a new method that allows you to store the texts within the text tables. Regrettably, I do not have visibility into your CDS data model, but it will be necessary for you to establish associations/joins between the text fields and the root model. This can be accomplished as follows:

[...]<br>define root view entity ZP4_I_PLANT_MAINT as select from <dtab> as dtab
left outer join <dtab_t> as _TextDE on  _TextDE.ID = dtab.ID and _TextDE.spras = 'D'
left outer join <dtab_t> as _TextIT on  _TextIT.ID = dtab.ID and _TextIT.spras = 'I'
left outer join <dtab_t> as _TextEN on  _TextEN.ID = dtab.ID and _TextEN.spras = 'E'
[...]
_TextDE.text as TextDE,<br>_TextIT.text as TextIT,
_TextEN.text as TextEN

I hope that this guidance will prove beneficial to you.

Kind regards

Julian Danho

SchinniC
Explorer

Hello Julian,

thank you for the answer! Sure, here are the snippets:

I-View for the header entity

-View for the description entity

Consumption view for the header entity

Consumption view for the description entity

Behavior definition header entity

Behavior definition description entity

EDIT: Updated the screenshots to reflect current reality.

Thanks and best regards!

former_member295131
Discoverer
0 Kudos

Hey christian.schinner,

first of all thank you very much for providing us your solution. Unfortunately, the first four screenshots are not shown anymore. May I kindly ask you to upload them again?

Thank you very much in advance.

Best regards,

Andreas

DanielPoenaru
Newcomer
0 Kudos

Hi Christian,

Can you please show the snippet of your CDS and BDEF? for which version of S4hana ?

Kind regards,

Daniel

juliandanho
Participant

Hi Christian,
can you please show the snippet of your CDS and BDEF?

Kind regards

Julian