cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

how to trigger handler class read method in RAP OData V4 Web API?

Chandra_S
Explorer
0 Likes
670

Dear Colleagues,

Good day.

Well, I have a requirement, existing material data coming from third party system to CPI to S/4 HANA MDG and need to create change request and approve it.

So created a RAP service, Table , CDS view , service definition with binding type OData V4 Web API along with behavior definition/implementation In the handler class, defined the methods modify and read. I just want to see if read method is called and data filled. So i would like to know how i can execute/debug the handler class read method.

How can i do the GET call using GW client?

Service URL :  /sap/opu/odata4/sap/xxx_xx_xxx_sb/srvd_a2x/sap/xxxx_xx_xxxx_s/0001/

xxx_xx_xxx_sb -  Service binding         xxxx_xx_xxxx_s  - Service definition

Chandra_S_0-1770351130965.png

Chandra_S_1-1770351210163.png

 

Chandra_S_2-1770351805805.png

 

 

regards

Chandra Kishore.

Accepted Solutions (0)

Answers (3)

Answers (3)

Chandra_S
Explorer
0 Likes

I was able to achieve this.

- In behavior handler class implementation , implemented  Create method

- In create method , looping through the entities and appending corresponding entity to CDS view and 

  appending values to the table .

- In behavior saver class implementation, implemented Save method .

- Using GET and POST HTTP method, executed the payload and breakpoint triggered in Eclipse(ADT) and can see the response.

 

regards

 

 

 

VigneshMP
Explorer
0 Likes

Hello,

Direct GET call from Gateway client is usually executed on SQL layer and won't trigger your READ implementation.
Only the EML calls will trigger the READ implementation.

Thanks

Chandra_S
Explorer
0 Likes
Hi Vignesh , I will write the EML call in handler class but how can i trigger the EML call?
junwu
SAP Champion
SAP Champion
0 Likes

you choose unmanaged implementation?

 

READ ENTITIES OF

just write a small program using eml read call to trigger your method.

odata scenario will not go to that method. 

Chandra_S
Explorer
0 Likes

Hi Junwu,

yes using unmanaged implementation.

So ,in handler class i have to define instance method

METHODS get_instance_authorizations FOR INSTANCE AUTHORIZATION

IMPORTING keys REQUEST requested_authorizations FOR cds_view RESULT result

and make call

READ ENTITIES OF cds_view in LOCAL MODE ENTITY cds_view ALL FIELDS WITH CORRESPONDING #( keys ) RESULT DATA(results).?

Also, how can i trigger(breakpoint/debugging) that method?

junwu
SAP Champion
SAP Champion
0 Likes
you didn't get the point, write a simple report or a class with code using eml read to read your BO, then your handler will be called.
Chandra_S
Explorer
0 Likes

Hi Junwu

In my current case, CPI is not sending the material data. CDS view is blank, so I would like to know if

I can pass the payload in S/4 MDG itself and test?

 

junwu
SAP Champion
SAP Champion
0 Likes
don't know what you are talking
RaminS
Active Participant
0 Likes

@junwu If you really want to help, give him a sample of this program you are suggesting, it can't take more than a minute of your time. If you don't want to help, then don't be rude to him.