Blog > CPI challenge from SAP Mentor

CPI challenge from SAP Mentor

Michał Krawczyk SAP Mentor, SAP Press Author
icon__calendar 2020-04-03

Introduction

In conjunction with Education & Sharing Day which falls on 5th April 2020 this year, In4 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 ones (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. 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.

querying-mechanism-HTTP-OData

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.

OData processing CPI

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

Table query parameters and filter criteia

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

Michał Krawczyk SAP Mentor, SAP Press Author
SAP integration consultant since 2004. He has been recognized by SAP included becoming an SAP Mentor in 2007 and winning the top contributor/topic leader award from SDN (SAP Developer Network portal) in SAP PO/PI eight times. Michal is the author many SAP integration related books: Mastering idoc business scenarios with SAP XI , Mastering idoc business scenarios with SAP PI (second edition).