EasyQuery, What is it?
To put it simply, it is an automated process by which SAP system generates all necessary backend objects so that one can consume the data output from a normal query in BW, programatically from a (local or remote)/(SAP or Non-SAP system) by calling an RFC enabled autogenerated FM.
How to?
Just tick the EasyQuery check box in the properties of a normal query in query designer and execute the query and all backend FM and structures are autogenerated. All you need to do is to declare a variable by the type of autogenerated structure and pass it in to the autogenerated FM.
Transport issues
Here we reach the crux of this post. The standard method of transporting an EasyQuery is to simply collect the original query and transport it and then check the EasyQuery checkbox again in the target client and execute again. The issue here is there is no guarantee that the autogenerated objects will have the same names in the target client as they had in source client. This creates problems in code for consumption especially when its consumed from SAP systems. You will have a piece of code which addressed the autogenerated FM correctly in one client and after transport it will obviously error in new client if the autogenerated FM name is different.
Below fixes are possible.
1. One Option is to open each client and correct the code so that it matches the autogenerated objects. This not recommended at all as this will mean opening the production client too.
data: t_grid_data type /bic/ne_4 “number 4 in this type will have to be
"edited according to what number got
“generated after transport in the target
call function /BIC/NF_4 “same number above will have to be
“updated for function name too
exporting
i_s_var_02ix_asondat = wa_l_r_asondate
tables
e_t_grid_data = t_grid_data
e_t_column_description = t_col_desc
e_t_row_description = t_row_desc
e_t_message_log = t_message_log.
2. Second option is to use the FM : RSEQ_GET_EQRFC_NAME to fetch the autogenerated FM name for a particular EasyQuery name passed. You will still have to provide the custom structure as input to the autogenerated FM which can be accomplished by using a CASE..WHEN loop to check the nomenclature of the FM name returned below and declare the custom structure according to that. This works because both the autogenerated FM and structure use the same matching numbers as differentiators.
lv_eq_name = 'IHRPA_C01_Q0013'.
call function 'RSEQ_GET_EQRFC_NAME'exporting
I_QUERY = lv_eq_name
importing
E_RFCNAME = lv_fm_name. “Get the substring from this variable after
“first 3 characters and use that in a CASE
*Example – CASE lv_substring.
* WHEN ‘4’
* t_grid_data type /bic/ne_4
* WHEN ‘5’
* t_grid_data type /bic/ne_5
call function lv_fm_name
exporting
i_s_var_02ix_asondat = wa_l_r_asondate
tables
e_t_grid_data = t_grid_data
e_t_column_description = t_col_desc
e_t_row_description = t_row_desc
e_t_message_log = t_message_log.
3. The third and seemingly both logical and clean method would be to take these autogenerated objects as a template and create custom Z objects and use them in the code for consumption. We can have a single custom FM for all easyqueries created and this custom FM will replicate the functionality inside the autogenerated FM minus some security checks (example: a date check which is there to make sure autogenerated FM matches the latest changes to the query). This custom FM can be made to accept the EasyQuery name, Custom structure(which will have to be created taking the autogenerated structure as sample for each EasyQuery created, seperately) and ASONDATE
data: t_grid_data type z_Query_Name_Struct. “created using /bic/ne_4 as template.
"Will have to be repeated for each separate EasyQuery and also
"regenerated easyquery.
call function z_Query_Name_Function “created using /BIC/NF_4 as “template, but can be used for any
"EasyQuery going forward
exporting
i_s_var_02ix_asondat = wa_l_r_asondate
i_s_var_eq_name = 'IHRPA_C01_Q0013'
tables
e_t_grid_data = t_grid_data
e_t_column_description = t_col_desc
e_t_row_description = t_row_desc
e_t_message_log = t_message_log.
I will be back with implemantation code for z_Query_Name_Function and steps for z_Query_Name_Struct
Hope the information provided above is useful. Please suggest further as you see fit, on the subject.
Regards
Darshan Suku
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
11 | |
7 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |