cancel
Showing results for 
Search instead for 
Did you mean: 

how to make a search in sapui5 with Odata Service?

Former Member
0 Kudos

Hi,

I do not get to do a search

something is wrong with my code?

controller

view

thank you,
regards

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Your code is correct.

You need to do configuration in the DPC method in oDATA Gateway coding and activate the filter property.

The following document will be helpful. I was facing the same problem and this documentation helped me to do the same.

You need to make some modification as per your need. I followed similar process and got my result though I was facing the same problem as yours before. Please put a break-point in the DPC method of your gateway entity set and follow the logic of filtering and you will be getting your desired result.

Regards,

Subhabaha Pal

Former Member
0 Kudos

Thank you,

the search still does not work


activate the filter property

this is my code in  GET_ENTITY - is correct ?

this is my app

Regards,

Axel Matienzo

kai2015
Contributor
0 Kudos

I think you call get_entityset, when you go on search.

You need filter there your data.

And please use debugger in gateway. You would know, that he doesn't call the "get_entity" method.

Also check then with debugger, if you receive the value which you enter on your search, and if yes check if you filter your data correct by the value in the get_entityset method.

kai2015
Contributor
0 Kudos

yep as i said. Use GET_ENTITYSET in Gateway for your search.

And read carefully the link from Dr. Subhabaha Pal J

Former Member
0 Kudos

Hello,

is in GET_ENTITY check image

In my service Odata is correct

but in my app not working

please help me,

regards

ChandraMahajan
Active Contributor
0 Kudos

Hello,

looking at screenshot, you are referring my blog but please understand that when you are using search function, it actually hits get_entityset method of DPC_EXT class. I recently found out similar discussion. please refer Go through it and implement the code. Put external breakpoint in get_entityset method and debug the code to understand more.

Regards,

Chandra

Former Member
0 Kudos

Hi

thanks for your reply

It was wrong then

is in method get_entityset

ok, the code :

method EXAMPLEUI5SET_GET_ENTITYSET.

  DATA: lt_userinfo TYPE TABLE OF zexample,

         ls_userinfo LIKE LINE OF lt_userinfo,

         ls_entity   LIKE LINE OF et_entityset.

   SELECT * FROM ZEXAMPLE INTO TABLE lt_userinfo where id = lv_userid.

   BREAK-POINT.

   LOOP AT lt_userinfo INTO  ls_userinfo.

     ls_entity-ID = ls_userinfo-ID.

     ls_entity-FECHANAC = ls_userinfo-FECHANAC.

     ls_entity-NOMBRE = ls_userinfo-NOMBRE.

     ls_entity-CIUDAD = ls_userinfo-CIUDAD.

     ls_entity-TELEFONO = ls_userinfo-TELEFONO.

     APPEND ls_entity TO et_entityset.

   ENDLOOP.

endmethod.

how can I get lv userid variable?

Put external breakpoint in get_entityset method and debug the code to understand more.

how can I do that? not recognize my breakpoint

it is my table where I want to make a search for my app

thank you
regards

kai2015
Contributor
0 Kudos

Pleeeeeeeeeaaaaaaaaase read carefully the blog and comments which Chandrashekhar Mahajan has mentioned. In the comments there you will find the solution.

You can use debugger if you set an external breakpoint.

Answers (1)

Answers (1)

kai2015
Contributor
0 Kudos