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: 

SAP Developer Challenge - SAP Cloud Application Programming Model (Week 1)

nicoschoenteich
Developer Advocate
Developer Advocate
Please note that this challenge is closed. The deadline for receiving a badge upon successful completion has passed. Check out this new challenge for the month of August.
 
Welcome to the first week of this month's SAP Developer Challenge. This week we are going to learn how to get started with the SAP Cloud Application Programming Model (CAP) and domain modeling. If you haven't read the announcement blog post for this challenge, please head over and do so.
 

The Challenge

 
The objective this week is to build a CAP service, that can track golf rounds. Yes, you read that right – golf rounds ️🏌🏽‍. This is a completely artificial scenario that we made up, but it lends itself pretty well to practice a few basic CAP features.
We have prepared a starter project (link to CodeSandbox below) that already contains the entity "Rounds" and exposes it via a service. It is your job to enrich this existing service.

This is what you have to do to successfully complete this week's challenge:
  1.  Go to the CodeSandbox and fork it. You have to have an account with CodeSandbox and be be signed in to be able to do that.
  2. Work on the project so it represents the following relationships:
        1. The service should track who entered a new round and when it was entered (hint: managed entities).
        2. A round consists of multiple holes. No hole can exists without its "parent" round (hint: compositions vs. associations).
        3. Each hole has a score, representing the number of shots it took a player to get the ball into the hole.
        4. Similarly, each hole has a par of 3, 4, or 5, representing the average amount of shots it takes a professional golfer to get the ball into the hole.
        5. Each hole consists of one or more shots. Similar to rounds and holes, no shot can exists without its "parent" hole (hint: compositions vs. associations).
        6. (Feel free to add more fields to the entities as you see fit.)
  3. Run the dev server using the predefined "dev" task. To do so, click on the little plus icon (+) to open the dev tools and click on "Tasks > dev".
  4. Wait for the server to start. Once done, click on "http://localhost:4004".
  5. Open the metadata of the "browse" service.
  6. Take a screen shot of the metadata and post it into this discussion thread. Hopefully it looks something like this (a few sections collapsed in the screen shot):

metadata.png

 

Resources

 
We have gathered a few helpful resources to get started. Also make sure to inspect the existing code in the starter project and try to understand what it does.


Note: If you encounter issues with your dev server not starting properly, check your cds syntax. Unfortunately, the CodeSandbox doesn't have syntax highlighting for cds and it may not provide clear error messages. One useful approach is to comment out sections of code until the server starts, then gradually uncomment to isolate the problematic line.

Good luck and happy learning!
168 REPLIES 168

GRABLERE
Product and Topic Expert
Product and Topic Expert

@nicoschoenteich Thanks for this month challenge:)

GRABLERE_0-1689335640444.png

 

Well done Does Rounds have a composition of many Holes?

Indeed forgot this one. 

Thanks a lot for checking!

Tobias_Berger_0-1689575861219.png

 

satya-dev
Participant

MioYasutake
Active Contributor

My week 1 submission

miyasuta_0-1689455523688.png

 

MarcelloUrbani
Active Contributor

 

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
<edmx:Reference Uri="https://sap.github.io/odata-vocabularies/vocabularies/Common.xml">
<edmx:Include Alias="Common" Namespace="com.sap.vocabularies.Common.v1"/>
</edmx:Reference>
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.xml">
<edmx:Include Alias="Core" Namespace="Org.OData.Core.V1"/>
</edmx:Reference>
<edmx:Reference Uri="https://sap.github.io/odata-vocabularies/vocabularies/UI.xml">
<edmx:Include Alias="UI" Namespace="com.sap.vocabularies.UI.v1"/>
</edmx:Reference>
<edmx:DataServices>
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="CatalogService">
<EntityContainer Name="EntityContainer">
<EntitySet Name="Rounds" EntityType="CatalogService.Rounds">
<NavigationPropertyBinding Path="holes" Target="Holes"/>
</EntitySet>
<EntitySet Name="Holes" EntityType="CatalogService.Holes">
<NavigationPropertyBinding Path="round" Target="Rounds"/>
<NavigationPropertyBinding Path="shots" Target="Shots"/>
</EntitySet>
<EntitySet Name="Shots" EntityType="CatalogService.Shots">
<NavigationPropertyBinding Path="hole" Target="Holes"/>
</EntitySet>
</EntityContainer>
<EntityType Name="Rounds">
<Key>
<PropertyRef Name="ID"/>
</Key>
<Property Name="createdAt" Type="Edm.DateTimeOffset" Precision="7"/>
<Property Name="createdBy" Type="Edm.String" MaxLength="255"/>
<Property Name="modifiedAt" Type="Edm.DateTimeOffset" Precision="7"/>
<Property Name="modifiedBy" Type="Edm.String" MaxLength="255"/>
<Property Name="ID" Type="Edm.Guid" Nullable="false"/>
<Property Name="title" Type="Edm.String" MaxLength="111"/>
<NavigationProperty Name="holes" Type="Collection(CatalogService.Holes)" Partner="round">
<OnDelete Action="Cascade"/>
</NavigationProperty>
</EntityType>
<EntityType Name="Holes">
<Key>
<PropertyRef Name="pos"/>
<PropertyRef Name="round_ID"/>
</Key>
<Property Name="pos" Type="Edm.Int32" Nullable="false"/>
<NavigationProperty Name="round" Type="CatalogService.Rounds" Partner="holes">
<ReferentialConstraint Property="round_ID" ReferencedProperty="ID"/>
</NavigationProperty>
<Property Name="round_ID" Type="Edm.Guid" Nullable="false"/>
<Property Name="score" Type="Edm.Int32"/>
<Property Name="par" Type="Edm.Int32"/>
<NavigationProperty Name="shots" Type="Collection(CatalogService.Shots)" Partner="hole">
<OnDelete Action="Cascade"/>
</NavigationProperty>
</EntityType>
<EntityType Name="Shots">
<Key>
<PropertyRef Name="pos"/>
<PropertyRef Name="hole_pos"/>
<PropertyRef Name="hole_round_ID"/>
</Key>
<Property Name="pos" Type="Edm.Int32" Nullable="false"/>
<NavigationProperty Name="hole" Type="CatalogService.Holes" Partner="shots">
<ReferentialConstraint Property="hole_pos" ReferencedProperty="pos"/>
<ReferentialConstraint Property="hole_round_ID" ReferencedProperty="round_ID"/>
</NavigationProperty>
<Property Name="hole_pos" Type="Edm.Int32" Nullable="false"/>
<Property Name="hole_round_ID" Type="Edm.Guid" Nullable="false"/>
<Property Name="length" Type="Edm.Double"/>
</EntityType>
<Annotations Target="CatalogService.Rounds/createdAt">
<Annotation Term="UI.HiddenFilter" Bool="true"/>
<Annotation Term="Core.Immutable" Bool="true"/>
<Annotation Term="Core.Computed" Bool="true"/>
<Annotation Term="Common.Label" String="Created On"/>
</Annotations>
<Annotations Target="CatalogService.Rounds/createdBy">
<Annotation Term="UI.HiddenFilter" Bool="true"/>
<Annotation Term="Core.Immutable" Bool="true"/>
<Annotation Term="Core.Computed" Bool="true"/>
<Annotation Term="Core.Description" String="User's unique ID"/>
<Annotation Term="Common.Label" String="Created By"/>
</Annotations>
<Annotations Target="CatalogService.Rounds/modifiedAt">
<Annotation Term="UI.HiddenFilter" Bool="true"/>
<Annotation Term="Core.Computed" Bool="true"/>
<Annotation Term="Common.Label" String="Changed On"/>
</Annotations>
<Annotations Target="CatalogService.Rounds/modifiedBy">
<Annotation Term="UI.HiddenFilter" Bool="true"/>
<Annotation Term="Core.Computed" Bool="true"/>
<Annotation Term="Core.Description" String="User's unique ID"/>
<Annotation Term="Common.Label" String="Changed By"/>
</Annotations>
</Schema>
</edmx:DataServices>
</edmx:Edmx>

 

hcordeiro
Explorer

VijayCR
Active Contributor

Hello @nicoschoenteich - Week 1 challenge completed, Could you check ?

Capture.PNG

0 Kudos

Well done

Ruthiel
Product and Topic Expert
Product and Topic Expert

Hello Nico!

Thanks for this challenge:

Ruthiel_0-1689629462455.png

 

0 Kudos

Well done

Does Shots have an association back to a hole?

HappyGirl
Associate
Associate

My submission for week 1

Screenshot 2023-07-18 at 11.02.48 AM.png

0 Kudos

Well done

geek
Participant

Late to the party...

geek_0-1689667961793.png

 

0 Kudos

Well done  

Better late than never 😉

jschallenberger
Explorer

0 Kudos

Well done

dinah
Product and Topic Expert
Product and Topic Expert

0 Kudos

Well done Dinah

andrew_mak
Explorer

 

Hello Nico,

Thanks for the challenge!
2023-07-20 16_11_29-Week-1.png

0 Kudos

Well done

antothomasraja
Explorer

Hi @nicoschoenteich

Below is my submission for Week 1,

antothomasraja_0-1690109883517.png

 

 

Thank you!

 

0 Kudos

Well done

steph_senita
Explorer

Hi @nicoschoenteich , 

Please find below my submission for Week1

stephanie_senit_0-1690110136848.png

Thanks & regards

Stephanie

 

0 Kudos

Well done

VenugopalA
Explorer

Hi @nicoschoenteich ,

week one task,

VenugopalA_0-1690197395693.png

 

thank you.

0 Kudos

Well done

Ashok459
Participant

Hello,

My submission for week 1

Ashok_Easa_0-1690236915150.png

 

0 Kudos

Well done

Geeth
Product and Topic Expert
Product and Topic Expert

Hi Nicolai,

Please find the screenshot

Geeth_0-1690362240902.png

 

0 Kudos

Well done

Cmdd
Participant

Hi! This is my approach using managed composition of aspects

Cmdd_0-1690367580124.png

 

0 Kudos

Well done

harsh_itaverma
Participant

I hope its not too late 🙂

verma_0-1690874757675.png