on 09-29-2014 3:06 PM
Hi Experts,
I need to define an OData GET_ENITITYSET Method in the SEGW.
I created a Datamodel from the GET_GPU_ALL function and the stub could generate the classes without error.
How can I get the Information from the Table.
I know I need to use SQL.
I tried SELECT * FROM OSMON into
CORRESPONDING FIELDS OF TABLE et_entityset.
But the system is not able to find all of the data. I´m getting some JSON Response but not all of the data I`ll consume.
I know the data from the function group GET_CPU_ALL are stored in Table TF_CPU_ALL but when I am trying
SELECT * FROM TF_CPU_ALL I am getting an errror says no such TABLE defined.
Moreover I know that there are no really innter tables in SAP there like JOINS....
But I connot figure out which SQL Phrase I have to use to get the data from the TF_CPU_ALL (Table).
I would really appreciate if someone could suggest me a solution or give me an hint to sove the problem.
Thank you.
Joe
Thread Locked. Cross posting.
See Ron's reply/link for the detailed answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Joe D,
Are u not sending any inputs to ur query ?
Do u know which table u need to query ?
The inputs which u send from URL as filter parameters, extract them and use it in ur Query to get the matching results.
The below would be just an sample how u can Query in your Get_EntitySet method.
Please note that only Query is shown here.
Sample Query ->
TYPES : BEGIN OF ls_range_id,
sign TYPE sign,
option TYPE option,
userid TYPE c LENGTH 5,
high TYPE c LENGTH 5,
END OF ls_range_id.
TYPES : lt_range_id TYPE TABLE OF ls_range_id.
TYPES : BEGIN OF ls_range_name,
sign TYPE sign,
option TYPE option,
name TYPE c LENGTH 30,
high TYPE c LENGTH 30,
END OF ls_range_name.
TYPES : lt_range_name TYPE TABLE OF ls_range_name.
DATA: ls_id TYPE ls_range_id.
DATA: lt_id TYPE lt_range_id.
DATA: ls_name TYPE ls_range_name.
DATA: lt_name TYPE lt_range_name.
DATA: lt_wa TYPE TABLE OF zash_emp_tab.
" Write logic to extract the filter parameters and store in local variables
" you will get the filter values in the method parameter IT_FILTER_SELECT_OPTIONS.
IF userid IS NOT INITIAL.
IF userid CA '*' .
ls_id-sign = 'I'.
ls_id-option = 'CP'.
ls_id-userid = userid.
ls_id-high = ''.
APPEND ls_id TO lt_id.
ELSE.
ls_id-sign = 'I'.
ls_id-option = 'EQ'.
ls_id-userid = userid.
ls_id-high = ''.
APPEND ls_id TO lt_id.
ENDIF.
ENDIF.
IF name IS NOT INITIAL.
IF name CA '*'.
ls_name-sign = 'I'.
ls_name-option = 'CP'.
ls_name-name = name.
ls_name-high = ''.
APPEND ls_name TO lt_name.
ELSE.
ls_name-sign = 'I'.
ls_name-option = 'EQ'.
ls_name-name = name.
ls_name-high = ''.
APPEND ls_name TO lt_name.
ENDIF.
ENDIF.
SELECT * FROM zash_emp_tab INTO CORRESPONDING FIELDS OF TABLE lt_wa WHERE userid IN lt_id AND name IN lt_name.
IF sy-subrc EQ 0.
" Code to send back the response to GW
ENDIF.
Hoping this might help u.
Regards,
Ashwin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.