on 09-11-2013 1:18 PM
Hi Hi,
how can i access the "select" options in my abap code?
SEGW-> Project-> Service implementation....
____
why do I need it? I want to optimize my SQL Selects
regards
Beni
hi
here is the right answer if somebody have the same problem.
Based of Andre's answer, I found this:
io_tech_request_context->get_select( ).
example call:
www./.../servicename/orderSet?$select=Aufnr
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I believe what Benedikt is looking for is the column list, not the search arguments. Since the full set of properties are normally read, if the entity is wide, it can be (slightly) costly to retrieve.
$select post-reduces the properties in the feed, so there is less OData throughput, on the server side it's still "all or nothing".
If you want to tune it server-side, you could align your selection logic to any "$select" in the URI and only pull the required columns; this can be determined form the technical context. I think this is what Benedikt wishes to do.
If this was a HANA service this would not be necessary anyway, due to the column-store engine.
exact, that is what i did. Here is the solution with abap code.
I`m not so good in ABAP and and SAP Selects... i choose this kind of implementation to prevent any kind sql injections.
It is much faster if the table has many columns and you want lots of records:
DATA: lv_from TYPE string.
DATA: lv_select TYPE string.
" conf
lv_from = `viaufks`.
DATA: lo_struct_type TYPE REF TO cl_abap_structdescr.
DATA: lt_comp_tab1 TYPE abap_component_tab.
DATA: lt_selects TYPE /iwbep/t_mgw_tech_field_names.
lt_selects = io_tech_request_context->get_select( ).
IF lt_selects IS NOT INITIAL.
lo_struct_type ?= cl_abap_typedescr=>describe_by_name( '' ).
lt_comp_tab1 = lo_struct_type->get_components( ).
FIELD-SYMBOLS: <ls_selects> LIKE LINE OF lt_selects.
LOOP AT lt_selects ASSIGNING <ls_selects>.
DATA ls_fieldname LIKE LINE OF lt_comp_tab1.
CLEAR ls_fieldname.
READ TABLE lt_comp_tab1 INTO ls_fieldname WITH KEY name = <ls_selects>.
IF ls_fieldname IS NOT INITIAL.
CONCATENATE lv_select ' ' ls_fieldname-name INTO lv_select.
ENDIF.
ENDLOOP.
ENDIF.
...
...
...
SELECT (lv_select)
INTO CORRESPONDING FIELDS OF TABLE lt_entityset
FROM (lv_from) ....
I am passing http://myserver/sap/opu/odata/sap/ZZTEST_PROJECT/TaskLists?$select Aenam,plnty,plnal
I am getting an empty table when i call
lt_selects = io_tech_request_context->get_select( ).
Any idea?
I am passing http://myserver/sap/opu/odata/sap/ZZTEST_PROJECT/TaskLists?$select Aenam,plnty,plnal
I am getting an empty table when i call
lt_selects = io_tech_request_context->get_select( ).
Any idea?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Beni,
I hope you are clear between $select and $filter.
$filter: Provides values for specific properties, based on which data can be filtered.
$select: List of properties (not values) to be returned back to the client.
If you want to optimize the select statements, $filter need to be considered first. These values can be used in Where condition of your Select statement.
If you have too many properties in your Entity, and you want your Select statement to access only the specific columns, then $select will help.
Thanks
Krishna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Beni,
how to handle select options is described in my whitepaper
http://scn.sap.com/docs/DOC-43000
Best Regards,
Andre
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.