cancel
Showing results for 
Search instead for 
Did you mean: 

API to POST to SAP | RAP | SEGW | if_http_extension~handle_request

Sathya_Gunasekaran
Active Participant
490

Hello experts,

We have a requirement for a non-SAP cloud system to POST a simple JSON paylod to SAP S/4 and the schema is something similar to

{
	"event": "initiated",
	"date": "2021-10-12T19:26:01Z",
	"data": {
		"id": "MMM12345678",
		"amount": "100",
		"currency": "GBP",
		"payment_method": {
			"type": "card"
		},
		"fields": {
			"reference": "REF-1234",
			"id": "123456789"
		},
		"payer": {
			"first_name": "TEST",
			"last_name": "TESTL",
			"email": "Test.Test@Test.com"
		}
	}
}

No GET needed. What is the best way to handle this? REST handler class or an ODATA  service using SEGW or ODATA service using RAP. If RAP is the reommended way, how to define the nested json structure as custom entity for the above payload please?

Thank you.

Sathya

 

 

View Entire Topic
ArunJacob
Active Participant
0 Kudos

root:-

@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Event Root'
@ObjectModel.compositionRoot: true
define view entity ZI_Event
  as select from zevent
{
  key id    as EventId,
      event,
      @ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
      _Payer
}

Thanks

Sathya_Gunasekaran
Active Participant
0 Kudos
and create a z table called zevent?
ArunJacob
Active Participant
yes I hope for storing(Post) , a custom table required Sathya
Sathya_Gunasekaran
Active Participant
Thanks Arun. No, I have to write logic/use BAPIs to update some standard tables. The JSON payload doesn't link to any table in the DB. It will be a lot tidier with SEGW/HTTP Handler. 😞