Application Development and Automation 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: 
Read only

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

Shilpa_Shankar
Developer Advocate
Developer Advocate
49,366

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
Read only

0 Likes
9,644

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. 

Read only

namshagiri_s1
Discoverer
Read only

Srimathi
Explorer
9,617

Hi Team,

Task 2 Completed.

 

 

Srimathi_1-1724063469604.png

Thanks.

 

Read only

achal_mukaty
Explorer
9,612

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

 

Read only

SUNDHARRAJAN
Discoverer
Read only

Srinath_Mareedu
Discoverer
Read only

Ananth27
Discoverer
9,514

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

Ananth27_0-1724066450236.png

 

Read only

rdulek
Explorer
Read only

tobiasz_h
Active Participant
Read only

ThienPHAM
Participant
9,450

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

ThienPHAM_0-1724079872920.png

 

Read only

kyo_choi73
Active Participant
Read only

rathnabalaji_rg
Discoverer
Read only

Read only

this_yash
Participant
Read only

mohit_dev
Contributor
Read only

barisguler
Participant
9,398

Hello,

Here is my second week submission.

barisguler_1-1724098557629.png
barisguler_0-1724098549206.png

 

 

Read only

Bharath369
Explorer
Read only

maennflo
Discoverer
9,370

Hi.

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

 

maennflo_0-1724112078149.png

Regards, Florian

 

Read only

Nkrish
Contributor
9,371

Hi, 

Data Preview of new created fields 

Nkrish_0-1724115529536.png

 

Read only

p215636
Explorer
Read only

maynhincaichogi
Discoverer
0 Likes
9,316

SRIVIDYA_AVADHANI_16_0-1723810940838.png

Hi, Task 2 completed.

Read only

0 Likes
8,648

Hi,

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

Read only

RakeshDevani
Explorer
9,316

Here is my Solution:

rakeshdevani_1-1724127061058.png

 

Read only

Kartheek
Explorer
9,283

Hello ,

Here is the data preview!!

Kartheek_0-1724131252265.png

 

Read only

Ajay19
Explorer
9,277

Hi,

Below is the data preview of Week2 CDS View

Ajay19_0-1724131928654.png

Thanks

Ajay

Read only

Akshay_Yelekar
Discoverer
Read only

babu4abap
Explorer
9,226

 

Thanks Shilpa and Sheena for this month challenge.

Task 2 is completed.

babu4abap_0-1724144894552.png

 

Read only

Read only

SingireddySunil
Explorer
9,189

Hi @Shilpa_Shankar,

Here is my submission of Week2 Challenge

SingireddySunil_0-1724149014258.png

 

 

Read only

Shky
Product and Topic Expert
Product and Topic Expert
9,198

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

Read only

Shilpa_Shankar
Developer Advocate
Developer Advocate
8,689

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...

Read only

Mohammed_Nabeel
Explorer
9,173

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

 

 

 

 

Read only

9,113

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

Read only

0 Likes
9,073

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

Read only

JerryW
Explorer
9,127

Here is my submission - thanks!

JerryW_0-1724156026709.png

 

Read only

RichHeilman
Developer Advocate
Developer Advocate
Read only

miguelandher
Discoverer
Read only

Joy_Ragavie
Explorer
Read only

Joy_Ragavie
Explorer
Read only

Jay_Dalsaniya
Participant