Skip to Content

In Part1 Custom Gateway service with CRUD Operations and Android application through Eclipse Part 1 I discussed :

1. RFC function module with PO Number,Creation Date & PO Release indicator as input parameters.

2. Create service in Gateway system with all the CRUD operations.(Create Read Update Delete)

In Part2 & Part3 Custom Gateway service with CRUD Operations and Android application through Eclipse Part 3 I will be discussing how to :

3. Test our service in ‘Service Explorer’ (Various filter options along with CRUD operations).

4. Create Application in Eclipse and test it on Simulator.

3. Test our service in ‘Service Explorer’ (Various filter options along with CRUD operations).

In Transaction: /IWFND/MAINT_SERVICE  goto Service Explorer.

Also we can test in Gateway Client: Tcode /IWFND/GW_CLIENT

/wp-content/uploads/2013/11/4_325303.jpg

/wp-content/uploads/2013/11/5_325316.jpg

Testing individual key:

POSet/?$filter=Ebeln eq ‘3000000191’

/wp-content/uploads/2013/11/6_325317.jpg

/wp-content/uploads/2013/11/7_325675.jpg

Likewise below are other individual filter options:

POSet/?$filter=Aedat eq datetime’2001-07-16T00:00:00′

POSet/?$filter=Frgke eq ‘R’

Lets see how to test for multiple fields in filter options:

Get PO’s in a given range:

POSet/?$filter=Ebeln ge ‘3000000191’ and Ebeln le ‘3000000199’

Get PO with release indicator eq ‘R’

POSet/?$filter=Ebeln eq ‘4500004858’ and Frgke eq ‘R’

Testing Associations:

For below filter we will get 3000000191 PO and also corresponding Items (In Association we mapped header & items entity sets).

POSet/?$filter=(Ebeln eq ‘3000000191’)&$expand=PONav

Other filter options:

POSet/?$top=2&$filter=(Ebeln ge ‘3000000191’ and Ebeln le ‘3000000199’)

Will return only top 2 records in given condition

POSet/?$skip=2&$filter=(Ebeln ge ‘3000000191’ and Ebeln le ‘3000000199’)

Will skip first 2 records in given condition and returns rest of the records

Likewise we have many other filter conditions. (You can check URI conventions http://www.odata.org/documentation/odata-v2-documentation/uri-conventions/ )

Testing CRUD Operations: (Gateway Client: Tcode /IWFND/GW_CLIENT)

Read:  (GET)

http://<host name >/sap/opu/odata/sap/ZBPS_PO_DEMO_SRV/POSet/?$filter=(Ebeln eq ‘3000000004’)

Update: (PUT)

As PUT is to update a record, we should not use Filter in URL.   

First we need to READ(GET).

http://<host name>/sap/opu/odata/sap/ZBPS_PO_DEMO_SRV/POSet(Frgke=”,Ebeln=’3000000004′,Aedat=datetime’0000-00-00T00:00:00′)

Above URI without filter and also, as FRGKE and date are my key fields I am passing initial values.

/wp-content/uploads/2013/11/1_328680.jpg

Then, ‘Use as Request’ button and then use HTTP Method ‘PUT’ to update. I am trying to update Inco2 (Incoterm) field.

/wp-content/uploads/2013/11/3_328705.jpg

Create: (POST)

After read operation , ‘Use as Request’ and ‘POST’ the request to create new PO (I hardcoded PO item details). For creating PO with multiple items we need to implement CREATE_DEEP_ENTITY method.

/wp-content/uploads/2013/11/1_328680.jpg

Check Success status code 201.

/wp-content/uploads/2013/11/12_325673.jpg

Delete: Similar to Update operation.

First we need to READ(GET). Then, ‘Use as Request’ button and then use HTTP Method ‘DELETE’ to set flag for deletion.

/wp-content/uploads/2013/11/13_325674.jpg

In my next blog Custom Gateway service with CRUD Operations and Android application through Eclipse Part 3 I will discuss how to create Android application in Eclipse using our service.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply