Education & Sharing Day 2020 – SAP CPI Programming Challenge

This post was first posted at Int4.

Update 15 May 2020 – The results of the challenge can be found here.

Introduction

In conjunction with Education & Sharing Day which falls on 5th April 2020 this year, Int4 is running a programming challenge as part of our ongoing initiative, #Int4Education, to promote knowledge sharing and lifelong learning.

 

It is my pleasure to present to all you CPI enthusiasts the programming challenge we have for SAP CPI. The idea is simple – in this blog post I will describe the programming challenge related to CPI, participants submit their solution, and the most creative (voted by us internally) will receive a prize – an SAP Press book authored by our Int4 team member(s).

 

While there is a tinge of competition involved, remember that at the end of the day, the main goals of the challenge are to promote learning and fun 😉

 

Let the Games Begin!

Background

In our integration scenario, we are integrating with the public Northwind OData service (https://services.odata.org/V2/Northwind/Northwind.svc/). We would like to provide a plain REST service to query the orders from the OData service.

Following is the CPI iFlow that is used in this scenario. A version of it can be downloaded here.

To achieve the querying mechanism, the HTTP query parameters from the sender needs to be converted into the corresponding OData filter criteria. The iFlow accepts dynamic key-value pairs used for querying which should be stored in the property filterCrit used in the OData receiver channel as shown below.

The Challenge

Develop a Groovy script to generate the OData filter criteria from the HTTP query parameters. Some of the key aspects of the script should be as follows:

  • Extract HTTP query parameter from header CamelHttpQuery, build the OData filter criteria and store it in property filterCrit. Below are some examples:-
Input – HTTP Query Parameters Output – OData filter criteria 
ShipCountry=Sweden ShipCountry eq ‘Sweden’
ShipCity=Stuttgart&ShipCountry=Germany ShipCity eq ‘Stuttgart’ and ShipCountry eq ‘Germany’
  • Handle dynamically the different fields available in the Orders entity set
  • Handle different field types, e.g. numbers, String.
  • Each parameter can contain only single values, and the parameters cannot be repeated.
  • Only equality operator for the OData filter criteria is required.

 

Submission

Following are the details for submission:

Email: academy@int4.com

Deadline: 30 April 2020 – all time zones 😉

 

The results of the challenge will be published by 15 May 2020 in a subsequent blog post, and we will contact the winners directly to arrange for delivery of their prize.

 

Original Article:
https://blogs.sap.com/2020/04/09/education-sharing-day-2020-sap-cpi-programming-challenge/

ASK SAP EXPERTS ONLINE
Related blogs

LEAVE A REPLY

Please enter your comment!
Please enter your name here