cancel
Showing results for 
Search instead for 
Did you mean: 

Is this the correct log entry .

BODHISATTWA__20
Participant
0 Kudos

Hello All

I created a Event Mesh to capture sales order that was getting created in S/4 HANA on-Prem System .

The event is getting captured properly .

But now i connected the Event Mesh Queue to a BTP Kyma Serverless Runtime .

Every time I create a sales order , the log gets updated , But it shows some Random value rather than

Expected Code :-

   "type": "sap.s4.beh.salesorder.v1.SalesOrder.Changed.v1",
    "specversion": "1.0",
    "source": "*/EMB1/s4h",
    "id": "ASGSSFSFSFDFDFD==",
    "time": "2021-10-05T21:25:36Z",
    "datacontenttype": "application/json",
    "data": {
        "SalesOrder": "2398"
    }

  1. Instead of the above being captured in the log , the below random numbers are getting captured in the log

Is ths expected

Marco_Dorn
Advisor
Advisor
0 Kudos

Hello bodhisattwa.pal2,

How did you setup the trigger for a Kyma function? My colleague gabbi describes how to send events from SAP Event Mesh to a Kyma function in this blog.

Best regards,
Marco

Accepted Solutions (0)

Answers (4)

Answers (4)

Tobias_Griebe
Advisor
Advisor

Hi bodhisattwa.pal2,

according to the documentation the "data" attribute of an event is coming as a Buffer: https://kyma-project-old.netlify.app/docs/components/serverless/#details-function-s-specification-ev...

Depending on the used language you need to convert this to a readable string.

Best regards,
Tobias

BODHISATTWA__20
Participant

Thanks tobias.griebe

Thanks for all your help .

That said it would be really kind of you and marco.dorn if you guys can guide me through this POC from time to time .

I don't have any other language experience other than ABAP , Hence not able to relate to lot of stuff and facing issue .

Marco_Dorn
Advisor
Advisor
0 Kudos

Hello bodhisattwa.pal2 ,

Sure, feel free to add questions and send them my way. Here is a small link collection on Kyma Runtime:

Blogs for Kyma:More related blogs

SAP Help Portal, Learning Journey

SAP Discovery Center mission

Developer missions: teaser | intermediate

SAP Samples on GitHub.com

Video series by christian.lechner : https://github.com/lechnerc77/learningKyma/

Best regards,
Marco

BODHISATTWA__20
Participant
0 Kudos

Hello tobias.griebe

I am trying to add the axios dependency to package ,json .

But the in extension center the package.json file is not editable .

Any idea how do i add the dependency .This is in reference to your above

comments

https://answers.sap.com/comments/13500505/view.html

gabbi tobias.griebe It would be really helpful if you can give some idea .

We are trying to call an OData in our on premise system .

Tobias_Griebe
Advisor
Advisor
0 Kudos

Hi bodhisattwa.pal2,

the Extension Center functionality is limited to very basic tasks.

There is a great blog post series by carlos.roggan describing the different ways how to write your own serverless function. Check the section: https://blogs.sap.com/2020/06/24/writing-function-as-a-service-2-local-development/

You could also use the Business Application Studio to create/deploy/debug your serverless functions: https://blogs.sap.com/2020/08/18/develop-sap-cloud-platform-extension-factory-serverless-runtime-app...

Best regards,
Tobias

BODHISATTWA__20
Participant
0 Kudos

Hello tobias.griebe and marco.dorn

We are having some trouble connecting Kyma with our S/4 on Prem system .

So we are planning to shift over to BAS Serverless runtime .

Do you see any limitation from BAS Serverless runtime .

We are basically looking for 3 main functionalities

  • Consume event in a queue
  • Call make a GET call to S/4 HANA on Prem.
  • Produce an event and send it to another queue
Tobias_Griebe
Advisor
Advisor
0 Kudos

Hi bodhisattwa.pal2,

there has just been a new blog released about the future of the Serverless Runtime: SAP BTP, Serverless Runtime to be discontinued and replaced by SAP BTP, Kyma Runtime and SAP Integra...

Best regards,
Tobias

BODHISATTWA__20
Participant
0 Kudos

Hello tobias.griebe and marco.dorn

Thanksa lot for the guidance I was able to proceed to quite some extend and segregate the data from the captured payload @2nd Screenshot .

But the moment I try to call an odata API it fails

How to call an OData service from Kyma serverless Runtime

Tobias_Griebe
Advisor
Advisor

Hi bodhisattwa.pal2,

there are many ways and supportive modules to call an oData API from node.js function.
A pretty detailed description is available in gabbi's blog post here.

At first sight I would say, you are missing an authentication to call the API and you need to wait for the call complete.

Regards,
Tobias

Just copying over the interesting part:

/**
 * Add this to dependencies
{
  "name": "call-mktng-api",
  "version": "1.0.0",
  "dependencies": {
      "axios": "latest"
  }
}
 */
const axios = require("axios");
const baseURI = `${process.env['MKTNG_URL']}/sap/opu/odata/SAP/API_MKT_CAMPAIGN_SRV;v=2`
console.log(`baseURI is-- ${baseURI}`);

module.exports = {
    main: async function (event, context) {
        try {
            const response = await axios({
                method: 'get',
                url: `${baseURI}/Campaigns?$top=2`,
                auth: {
                    username: process.env['MKTNG_User'],
                    password: process.env['MKTNG_Password']
                  }
            });
            console.log(response.data.d.results);
            return response.data.d.results
        } catch (error) {
            console.log(error);
            event.extensions.response.status(500).send("Error");
        }
    }
}