Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Task 2 - CDS View Entity Associations ( August Developer Challenge )

Shilpa_Shankar
Developer Advocate
Developer Advocate
21,672

Thanks for the enormous response and showing great enthusiasm in Task 1. Let’s continue the ABAP Developer Challenge by enhancing the CDS view entity.

Task 2 - In this task, we will explore some basic SQL function, CDS Associations and use it to enhance the CDS View entity that is created in Task 1.

Follow the instructions carefully and share with us the screenshots of the items mentioned in the ‘Validation’ section of this discussion.

Please use this separate thread to ask your questions and discuss issues.

Here you go:

  1. Create a new field in the CDS view entity created in task 1 and use String function to concatenate Total_Price and Currency_Code.
    1. https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abencds_sql_functions_char... 
  2. Since we have Status field in the CDS view entity, let us create an association with /DMO/I_Overall_Status_VH to fetch the corresponding Text field.
    1. https://help.sap.com/docs/abap-cloud/abap-data-models/cds-associations?locale=en-US&version=s4_hana
  3. Expose the Text field from the association and give a name to the newly created field. This should return the text value of the Status (Overall Status Text)

Note: For those who do not have data in the status text table, try running the data generator class /dmo/cl_flight_data_generator. This should load that table with initial data. 

Validation: Share a screenshot of the following items as a reply to this thread to gain credits:

  1. Data Preview of the CDS View Entity which contains,
    1. 1 new field with concatenated value of Total_Price and Currency_Code.
    2. 1 new field with Overall Status Text

Note: Do not post the screenshot of the CDS view entity. Just Data preview is sufficient.

Enjoy until we are back with the next task!

187 REPLIES 187

0 Kudos
3,603

Kindly post your questions related to the task in this discussion: https://community.sap.com/t5/application-development-discussions/questions-re-quot-abap-core-data-se...

The screenshot that you have posted is not related to this task. 

Srimathi
Explorer
3,576

Hi Team,

Task 2 Completed.

 

 

Srimathi_1-1724063469604.png

Thanks.

 

achal_mukaty
Explorer
3,571

Created CDS View Entity with added new concatenated field of total price and currency code and Overall status text field using Association.

achal_mukaty_1-1724064197289.png

Result :

achal_mukaty_2-1724064315342.png

Happy Learning! 😊

Thanks

 

SUNDHARRAJAN
Discoverer

Ananth27
Discoverer
3,473

Hello,
Below is the Data Preview of my CDS View Entity.

Ananth27_0-1724066450236.png

 

rdulek
Explorer

tobiasz_h
Active Participant

ThienPHAM
Participant
3,409

Thanks for designing the exciting exercises. Here is my outcome for 2nd week

ThienPHAM_0-1724079872920.png

 

kyo_choi2
Participant

rathnabalaji_rg
Discoverer

this_yash
Participant

mohit_dev
Contributor

barisguler
Participant
3,357

Hello,

Here is my second week submission.

barisguler_1-1724098557629.png
barisguler_0-1724098549206.png

 

 

maennflo
Discoverer
3,329

Hi.

Here is my result preview after adding the two new columns:

 

maennflo_0-1724112078149.png

Regards, Florian

 

Nkrish
Contributor
3,330

Hi, 

Data Preview of new created fields 

Nkrish_0-1724115529536.png

 

p215636
Explorer

maynhincaichogi
Discoverer
0 Kudos
3,275

SRIVIDYA_AVADHANI_16_0-1723810940838.png

Hi, Task 2 completed.

0 Kudos
2,607

Hi,

The above screenshot is from another participant. Kindly send the screenshot of your CDS view.

RakeshDevani
Explorer
3,278

Here is my Solution:

rakeshdevani_1-1724127061058.png

 

Kartheek
Explorer
3,245

Hello ,

Here is the data preview!!

Kartheek_0-1724131252265.png

 

Ajay19
Explorer
3,239

Hi,

Below is the data preview of Week2 CDS View

Ajay19_0-1724131928654.png

Thanks

Ajay

Akshay_Yelekar
Discoverer

babu4abap
Explorer
3,188

 

Thanks Shilpa and Sheena for this month challenge.

Task 2 is completed.

babu4abap_0-1724144894552.png

 

SingireddySunil
Explorer
3,151

Hi @Shilpa_Shankar,

Here is my submission of Week2 Challenge

SingireddySunil_0-1724149014258.png

 

 

Shky
Product and Topic Expert
Product and Topic Expert
3,149

Done!

I039810_0-1724150145358.png

I get the following warning though for the line _Status._Text.Text as StatusText
The association "_Text" can modify the cardinality of the result set ZENTITY_SHAL_TRAVEL (Data Definition) /TRL_EN/.adt/ddic/ddlsources/zentity_shal_travel line 17 ABAP Syntax Check Problem

Shilpa_Shankar
Developer Advocate
Developer Advocate
2,640

Yes, the warning comes up as there is a potential for the data to be altered like example if it has translations. To avoid this, you can filter out by specifying the language and add '1' to document the change cardinality. Check this link for more information: https://learning.sap.com/learning-journeys/acquire-core-abap-skills/using-associations-in-path-expre...

Mohammed_Nabeel
Explorer
3,124

I initially worked on these exercises in an on-premise system but couldn’t find data in the status text table /dmo/oall_stat. Later, I switched to a cloud environment to execute both Task 1 and Task 2. For Task 2, I executed the class /dmo/cl_flight_data_generator and successfully loaded data into the same status text table, achieving the desired output

1. Only data preview for task 2 

Mohammed_Nabeel_0-1724163925871.png

 

 

 

 

3,064

For those who do not have data in the status text table, try running class /dmo/cl_flight_data_generator.  This should load that table with initial data.

 

Cheers,

Rich Heilman

0 Kudos
3,024

Thank you @RichHeilman , Your suggestion worked in cloud environment.

JerryW
Explorer
3,078

Here is my submission - thanks!

JerryW_0-1724156026709.png

 

RichHeilman
Developer Advocate
Developer Advocate

miguelandher
Discoverer

Joy_Ragavie
Explorer

Joy_Ragavie
Explorer