cancel
Showing results for 
Search instead for 
Did you mean: 

How to debug the code of odata services

soumya_nandi
Participant
0 Kudos

Hi Everyone,

I have written the code of "Read Service" in the Get_Entity method from the below link but I want to debug the code.

I want to know the technique to debug the code to see which data is coming when and where. Because I am not able to do the read service operation.

Kindly help me to debug the code.

Regards,

Soumya

Accepted Solutions (1)

Accepted Solutions (1)

former_member184867
Active Contributor
0 Kudos

You can directly try with transaction /IWFND/GW_CLIENT also known as Gateway Client.

Or if you are familiar with service builder, You need to go to Service Maintenance node, then you need to click on the Maintain Service button. A new screen will popup . There you can see a button for Gateway Client.

This is a test client provided by Gateway to simulate browser behaviour. Using this client you can directly call your OData service and check the result.

To Debug a READ

1. you need to set a session breakpoint in method GET_ENTITY of your Data Provider class,

2. Next you need to to call the READ URL with HTTP method 'GET' in the  Gateway Client. The READ URI will look like

/sap/opu/odata/IWBEP/<SERVICE NAME>/ENTITYSETNAME(KEY1=value1, KEY2= value2 )

If everything is fine so far , control will hit the break point.

Also you can use chrome extension like Postman or Advanced Rest Client to test your OData service.

The Advantage of Gateway Rest Client over these browser extension is , you do not need to pass X-CSRF-Token for PUT-POST-DELETE kind of operations, Gateway Client can take of these out of the box.

Answers (3)

Answers (3)

ugurkaya
Active Participant
0 Kudos

This message was moderated.

Former Member
0 Kudos

This message was moderated.

denis_tislenko
Explorer
0 Kudos

This message was moderated.

joao_sousa2
Active Contributor
0 Kudos

To debug a Odata Service, just put a breakpoint inside the GET_ENTITY method, and keep SAP GUI open. When you make the request in the browser, the debugger will open (if it reached your code).

mike_reader3
Active Participant
0 Kudos

I agree with Joao ... I have done something similar and it works fine.

-Mike

soumya_nandi
Participant
0 Kudos

Hi all,

I am giving this below URI,

/sap/opu/odata/sap/ZGW638785_EMPLOYEE_TEST_SRV/EmployeeCollection(Mandt = XXX, EmployeeId = XXXXXX)

But it is giving the below error,

Am I writing the URI correctly i.e. the format of the URI is correct?

Regards,

Soumya

ChandraMahajan
Active Contributor
0 Kudos

Hi,

do you have Mandt and EmployeeId both as key properties or only EmployeeId. if it is just employee id then try /sap/opu/odata/sap/ZGW638785_EMPLOYEE_TEST_SRV/EmployeeCollection( EmployeeId = XXXXXX)

also check if the spelling of the keys are correct.

Regards,

Chandra

soumya_nandi
Participant
0 Kudos

Hi Chandra,

I have both has key and in the error itself it is showing that what is expected in the URI. But I am giving that only.

For two key do I need to change the code in the Get_Entity?

And if I have wo key then what will be the correct URI?

Regards,

Soumya

joao_sousa2
Active Contributor
0 Kudos

It's EmployeeID, you wrote in the URL EmployeeId. OData is case sensitive in the property names.

soumya_nandi
Participant
0 Kudos

Hi Joao,

Even if I give EmployeeID then also the same error is coming.

Regards,

Soumya