Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos

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

Testing individual key:

POSet/?$filter=Ebeln eq '3000000191'

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.

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

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.

Check Success status code 201.

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.

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.

Labels in this area