SAP Builders Discussions
Join the discussion -- ask questions and discuss how you and fellow SAP Builders are using SAP Build, SAP Build Apps, SAP Build Process Automation, and SAP Build Work Zone.
cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Build Challenge – Week 4 – OData Services

Dan_Wroblewski
Developer Advocate
Developer Advocate
14,859

This post is part of the SAP Build Community Challenge (April 2023)

dan_wroblewski_0-1680162815071.png

We're going back to SAP Build Apps for this week's challenge.

Probably the most important thing you will do with one of your SAP Build app is to access SAP data, like in S/4HANA or SuccessFactors backends. And you will generally do this using an OData service. So we want to challenge you to use some of the OData features in the tool – for paging, filtering and sorting the data from OData calls.

2023-03-26_07-44-23.jpg

In the challenge, you will start with an app we will give you, which fetches data from Northwind, and you will have to use the OData settings to bring back a specific subset of the data.

 

Eventing

As a bonus, you will also learn about SAP Build Apps eventing, since the project we give you has eventing for retrieving the data.

Since we wanted the fetching of data to occur for a variety of events, we created our own event called GetData on the page’s logic canvas, and tied the fetching to that event. Then, the event could be called from any other logic canvas.

2023-03-22_14-20-29.jpg

To learn more, see:

 

Setup

  1. Download the skeleton project called Challenge - OData.zip.gpg.
  2. Create a new SAP Build Apps project.
  3. Import the downloaded project by selecting History > Replace in the top-right corner, and then selecting the downloaded project.

 2023-03-30_22-38-59.jpg

Out of the box if you run the app it will look like this:

2023-03-26_07-36-52.jpg

The Previous and Next buttons will not work. You will have to implement them.

We have already given you a page variable page (Number) to keep track of the current page, and a data variable Customer1 to hold the data fetched from Northwind.

 

Challenge

  1. Implement the following (note that the Get record collection flow function on which you should implement these is located on the logic canvas for the page, found by selecting Page Layout from the Component Tree (lower right corner). 
    Paging
    • Show only 5 products per page.
    • Set your page based on the page variable.
    • (Optional) Set up formulas to prevent the current page from going below 1 and above the number of pages there are.
    • (Optional) Enable/Disable the buttons based on whether there is a previous/next page.
    Filtering
    • Only show customers where ContactTitle is Owner.
    Sorting
    • Sort the records by the country and show the countries in ascending order.
    Header
    • Change the header to your name (Page name property of the page)
  2. Add logic to the Previous and Next buttons to:
    • Increment/decrement the page variable.
    • Call the GetData event to retrieve the data.
  3. When you are done, run the app, and go to Page 3, and take a screenshot. Post your screenshot.

It should look something like this (with your name, of course), but the records will be different. To accomplish the challenge, the correct records must be shown.

2023-03-22_14-37-23.jpg

Good luck!

And feel free to Kudo this post and all the challenges.

 

Bonus Question

Add in your post the name of the animated movie in which the song "Escape" (often known as the Pina Colada song) is played, and describe in 1 sentence the scene in which it appears.

Add the movie and scene description to your entry, and then go enjoy a Pina Colada (or your favorite drink). 




--------------
See all my blogs and connect with me on Twitter / LinkedIn
68 REPLIES 68

SubaR
Explorer
4,373

Hi Dan,

Thanks for this challenge, learnt a lot about Odata usage here and the concept of trigger events.

Here is the screenshot for page 3.

SubaR_0-1682874383446.png

Also applied logic for enabling/disabling the buttons based on whether there is a previous/next page.

SubaR_1-1682874491287.png

 

 

HelenaFortun
Explorer
3,863

Hello Dan,

interesting challenge again...

I didn't manage to get the number of records - that is the task for week after next.

Looking forward for the last one.

Best regards!

Helena

HelenaFortun_0-1682892158822.png

 

3,857

Glad you liked the challenge. For total count, you need to say you want the count in the paging part of the get record collection, and then you should immediately store it into a page variable. Good luck 😺




--------------
See all my blogs and connect with me on Twitter / LinkedIn

JVLebbink
Explorer
0 Kudos
3,855

I liked this challenge. For me getting the total count (although optional) was the most complicated part,.

JVLebbink_0-1683035551608.png

 

 

govardhansahil
Explorer
3,849

Hi @Dan_Wroblewski 

Thank you for the challenge! It was very interesting.

govardhansahil_1-1683048506984.png

 

0 Kudos
3,841

Thanks for joining 😺




--------------
See all my blogs and connect with me on Twitter / LinkedIn

staseeb
Active Participant
3,839

Hi @Dan_Wroblewski ,

Here is my output over challenge No. 4

Page 3.jpg

i was able to achieve optional tasks as well.

Page 1.jpg

Page 4.jpg

 

The animated movie in which the song "Escape" (often known as the Pina Colada song) is played is Shrek (2001), and it appears in a scene where Shrek and Donkey enter the castle to rescue Princess Fiona.

 

Thanks,

Taseeb Saeed

 

0 Kudos
3,836

That's a great job 😺

You had me all the way until you said the song was when Shrek and Donkey enter the castle ... I don;t remember that scene ... does it really play? The scene I know is when the Lord Farquaad chooses Fioni in the mirror. 




--------------
See all my blogs and connect with me on Twitter / LinkedIn

former_member136915
Product and Topic Expert
Product and Topic Expert
3,817

Hello Dan,

Thanks for this challenge that I could manage directly with my OData Know How and in challenge 1 and 2 acquired SAP Build knowledge.

SAP Build Challenge 4 OData 3.jpgSAP Build Challenge 4 OData 1.jpgSAP Build Challenge 4 OData 4.jpg

Regarding the movie, I am not familiar with ''Shrek'' and the Pina Colada song (but I like the cocktail) and I do not know the scene “when Lord Farquaad picks Princess Fiona from the Magic Mirror's dating game as part of his plan to marry her and become king“. Thankfully many other knew this.😊

Achim

saranraj_9021
Explorer
3,814

Hi @Dan_Wroblewski , 

 

Here is my submission for the 4th challenge, 

Page 3 : 

Screenshot_20230504_141949_com.sap.appgyver.preview.release.jpg

 

Page 1 and 4 where preview and next button is disabled respectively with formulas.

Screenshot_20230504_141940_com.sap.appgyver.preview.release.jpgScreenshot_20230504_141955_com.sap.appgyver.preview.release.jpg

Thanks for the challenge  Dan !

 

 

0 Kudos
3,730

Nice work ... thanks for joining 😺




--------------
See all my blogs and connect with me on Twitter / LinkedIn

brodierose
Explorer
3,810

Here is my Week 4 Challenge submission.

Movie: Shrek
Scene: The mirror introduces Fiona to Lord Farquaad as a princess he could marry to become a king. 

IMG_9348.jpg

Regards, Brodie.

P000636
Active Contributor
3,810

My result

P000636_0-1683200535494.png

Thx

PrashantJayaram
Product and Topic Expert
Product and Topic Expert
0 Kudos
3,791

Hi Daniel,

Please see below:

Screenshot 2023-05-04 at 3.25.46 PM.png

The animated movie where the song "Escape" appears is Shrek, specifically in the scene where Farquaad is trying to find a queen for Duloc, and chooses Fiona .

0 Kudos
3,732

"Duloc is, Duloc is, Duloc is a perfect place." 😺




--------------
See all my blogs and connect with me on Twitter / LinkedIn

Pamela
Product and Topic Expert
Product and Topic Expert
3,785

Hello Daniel,

Here is my Week 4 Challenge submission.

Pamela_0-1683267469586.png

thanks,

Pamela

0 Kudos
3,733

Thanks for participating ... which challenge did you enjoy the best? What did you think overall?




--------------
See all my blogs and connect with me on Twitter / LinkedIn

hismail
Discoverer
3,783

Hi Dan,

My submission for week 4.

Thank you for this amazing challenge.

 

hismail_0-1683271335419.png

 

0 Kudos
3,734

Thanks for the kind words 😺




--------------
See all my blogs and connect with me on Twitter / LinkedIn

KarthickD
Participant
3,780

Hi Dan,
Here is my Output for Week 4 

KarthickD_0-1683278824946.png

 

0 Kudos
3,735

Great job ... what did you think of the challenge? Hard or easy? Learned something?




--------------
See all my blogs and connect with me on Twitter / LinkedIn

TimothySanty
Participant
3,774

Hi Dan,

here you go:

TimothySanty_0-1683289891029.png

Cheers, Timothy

0 Kudos
3,736

Thanks for entering 😺




--------------
See all my blogs and connect with me on Twitter / LinkedIn

VinayKumawat
Product and Topic Expert
Product and Topic Expert
3,770

Thanks for the details in challenge steps, it became self-explanatory. I quite enjoyed it, now only one challenge left to conquer.

though I am fan of animation movies however I did not watch Sherk, not sure why 😅

VinayKumawat_0-1683296206784.png

However I cannot understand by only triggering event GetData and setting paging in Get record collection handles the request for next 5 records for each page

VinayKumawat_1-1683296356850.png

Thanks,

Vinay

0 Kudos
3,739

In the page logic canvas, I have defined an event (GetData) that will retrieve data by executing Get record collection flow function ... I did this to show you the eventing feature. Show for the Next button all you have to do is trigger GetData and the records are retrieved. Is that what you are asking?




--------------
See all my blogs and connect with me on Twitter / LinkedIn

3,765

Hi Daniel,

Thanks again!

SAP_Build_challenge_3_gabriel_ayuso.png

 

 

aonunes
Explorer
3,707

Took a while but got it!

aonunes_0-1683482850134.png

0 Kudos
3,698

Glad you stayed with it




--------------
See all my blogs and connect with me on Twitter / LinkedIn

amuktha12
Explorer
1,853

Thanks for the interesting challenge.