on 09-09-2019 8:41 PM
I've followed the excellent blog from Andre Fischer (https://blogs.sap.com/2019/03/01/how-to-implement-a-custom-entity-in-the-abap-restful-programming-mo.../) and want to know if it is possible to have associations with a Custom Entity CDS view?
I want to have a root custom entity that is tied to another view in an association. Is this possible? I couldn't find where this was documented and all attempts to get it to work lead to a syntax error.
This needs to be an unmanaged query since I am calling BAPI's in S/4HANA.
Hi Sarah,
yes it is possible.
However the association has to be defined within the select list.
Unfortunately I have not been able to update my blog post with simple example yet.
But here is a code snippet that might be helpful.
define root custom entity SADL_SO_CUSTOM_ENTITY
{
key id : abap.char(20);
seller_id : abap.char(20);
buyer_id : abap.char(20);
act_indicator : abap.char( 1 );
type_code : abap.char( 5 );
_type_code_texts : association [0..*] to Sadl_V_Rs_Type_Code_Text
on _type_code_texts.TypeCode = SADL_SO_CUSTOM_ENTITY.type_code;
}
The syntax is also described in the online help
https://help.sap.com/viewer/c0d02c4330c34b3abca88bdd57eaccfc/Cloud/en-US/e4fcfd77dcec48fbb361d7193f6... --> Unmanaged Query.
but without an example.
Hope this helps.
Best Regards,
Andre
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is it possible to go other way around,
Associate a custom entity to a DDL CDS view
Hello andre.fischer thanks for the example. If the association requires a parameter how is it possible to pass the value in this case in a custom entity?
Is it possible make other way association.?
In abap cds i want add association to Custom Entity, and use fields from Custom Entity in CDS View
Hello andre.fischer ,
it is great, that it is possible to have associations between custom entities, but this approach apparently fails when combining it with unmanaged behavior definitions which need composition trees, right?
The following blogs with identical problems
https://answers.sap.com/questions/13533252/custom-entity-association-and-their-behavior-defin.html
and
https://answers.sap.com/questions/13286489/abap-in-btp-custom-entity-association-composition.html
remain unanswered.
We have the same problem: Trying to combine associated custom entities with composition and parent associations. Is this possible at all and if yes could you please elaborate a little and tell us the release in which this works.
Thank you so much
Hi Andre,
thanks for providing the code snippet.
Unfortunately, we are now facing the problem of using the association.
We want to use the association to show a text instead of the value.
We tried several annotations such as:
@ObjectModel.text: { element: ['<association>.text'] }
@ObjectModel.text.association:
Especially the latter caused the app to crash.
Do you have any further suggestions we could try?
Best Regards,
Jannis
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.