cancel
Showing results for 
Search instead for 
Did you mean: 

(RAP) Annotation ObjectModel Text Association not replacing the ID with the Text field

ruchirsaxena
Participant
0 Kudos

Hi, In my RAP ABAP Cloud Project, as per the business requirement, I need to fetch the user input from the provided dropdown of the IDs, but since the ID field is not relevant to the business users, I need to replace it with its text field.

I used the following documentation for the same:

Getting Text Through Text Associations (sap.com)

However, it does not seem to work.

Following are the relevant screenshots:

Is there something that I am doing wrong, overlooking, or missing out on? Or is there something I need to add in the i18 of the BAS App for Fiori Elements, which I deployed to the fiori launchpad built upon the objects shown in the screenshots, as I vaguely described in some of the other posts? If at all possible, I would like to do the same using ABAP only.

Thanks in Advance.

View Entire Topic
JessieCheah
Product and Topic Expert
Product and Topic Expert

Hi Ruchir,

you use text association when you have 1 CDS view for value and another CDS view for text. Your example looks like you want the text to be shown in the drop down for your value help and your text is in the same (VH) view, so you can use @ObjectModel.text.element: ['Status'] at your key StatusId . Check the documentation below:

https://github.com/SAP-samples/abap-platform-fiori-feature-showcase/wiki/Feature-Showcase-App-Guide#...

https://help.sap.com/docs/btp/sap-abap-restful-application-programming-model/providing-text-by-text-...

Regards,

Jessie

ruchirsaxena
Participant
0 Kudos

Hi Jes,

Thanks fr your response. Actually I want the text to be displayed not in the VH, but rather on the screen after the value is selected.

For example, If I select Status as 'A', then after selecting A from the dropdown, it should display as Active on the screen (also when viewing a saved record).

I tried using the text.element as well in my consumption as well as info view, but it did not help either.

I am still getting used to the annotations, and in the above example, @ObjectModel.text.element does not seem to work

Is this the right way?

Best Regards,

Ruchir

JessieCheah
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Ruchir,

try this. In your base view ZI_G_E2E

@ObjectModel.foreignKey.association: '_E2EStatus'
Status,

In ZI_X_E2E_STATUS

@ObjectModel.text.element: ['Status']
key status_id as StatusId,
...
status as Status

Regards,

Jessie

ruchirsaxena
Participant
0 Kudos

Hi Jes,

I tried this. But looks like this method is only good for the Value Help.

But on selecting the value, it shows still the ID.

ruchirsaxena
Participant
0 Kudos

I tried this as well, but in vain:

ruchirsaxena
Participant
0 Kudos

But then I changed Status field name to the more accurate StatusId, and added a new Status field for the text, filled it with the text from the other View using Side Effects, and then tried this in my consumption view, and it worked.

Thanks for your help. 🙂

Best Regards,

Ruchir