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: 
sreeramg
Explorer
44,973
Hello everyone,

This blog is only for beginners not for experts.

some one may be confused to get these simple operations like filter,orderby,$inline count,etc..

you can follow these document step by step procedure for creating the service and also we can get

all these below operations.

I would like to explain about $count,$orderby,$skip,$filter,$top and $inline count operations.

we can get easily all these operations by using single database table.

Note:For beginners this document also very usefull to learn how to create the service.

 

Follow these below steps:

1.Go to T-code 'SEGW' and click on create an icon.Give the 'Project name' and 'Description'.



2.Right click on Data model-->Import-->DDIC structure



3.Give the Entity type name and ABAP structure name as below and click on next icon.



4. what we want to require choose those the fields and click on next button.



5.Give the key field as below



6.The choosen fields in the entity type as below



7.Go to the Runtime affairs and double click on it



8.Redefine the Get entityset method and write the logic as below

 



 

method deliveryset_get_entityset.

Data declarations

DATA:ls_data TYPE /IWBEP/t_MGW_SELECT_OPTION,
ls_entityset type zcl_zlikp_delivery8_mpc=>ts_delivery.

clear ls_entityset.
refresh et_entityset.

Extracting the data

select vbeln
ernam
erzet
vkorg
lfart
from likp
into CORRESPONDING FIELDS OF TABLE et_entityset up to 60 rows.

** $inlinecount query option for all count entries.
IF io_tech_request_context->has_inlinecount( ) = abap_true.
DESCRIBE TABLE et_entityset LINES es_response_context-inlinecount.
ELSE.
CLEAR es_response_context-inlinecount.
ENDIF.

***The function module for Filter conditons
CALL METHOD /IWBEP/CL_MGW_DATA_UTIL=>FILTERING
EXPORTING
IT_SELECT_OPTIONS = IT_FILTER_SELECT_OPTIONS
CHANGING
CT_DATA = ET_ENTITYSET.

 

*** The function module for $top and $skip Query Options
CALL METHOD /IWBEP/CL_MGW_DATA_UTIL=>PAGING
EXPORTING
IS_PAGING = IS_PAGING
CHANGING
CT_DATA = ET_ENTITYSET.

 

****The function module for Orderby condition
CALL METHOD /IWBEP/CL_MGW_DATA_UTIL=>orderby
EXPORTING
IT_ORDER = IT_ORDER
CHANGING
CT_DATA = ET_ENTITYSET.

endmethod.

 

9.Save and Activate the entity sets.

Add and Maintain the service:

Go for the t-code  ' /IWFND/MAINT_SERVICE' to add  the service.

Click on 'Add service' to add service.



10.Go to the SAP Gateway Client



11.Give entityset name in URI and click on 'Get' radiobutton.

Count:

It gets all the records count



Orderby:

Displays data either Ascending or Descending order



Filter:

It is used for display custom between records as below



Skip,Top and Inline count:

It means skip=2 is skips the 2 records and display top=5 means first 5 records will be displayed and also Inline count means it displays the data with count as below



Note:My next  blog will be about the how to display the errors messages or exceptions using BAPI in

Odata services.

 

 

Thank you,

Sreeram.
6 Comments
Labels in this area