‎2010 Oct 11 5:06 AM
Hi,
I have to utilise the function module (FM) 'RSDRI_INFOPROV_READ'. The kind of structure for which the data to be fetched from infoprovider is generated dynamically.
In the FM lets assume,
Import parameters are;
g_th_sfc - Characteristics That Are to Be Returned
g_th_sfk - Key Figures That Are to Be Returned
g_t_range - Selection Conditions Connected with AND
and in export parameters;
g_t_data - Internal Table with Query Result
Now i can build/assign the rows to the import parameters dynamically through a look up on certain transparent table, but g_t_data needs to have a predefined structure declared.
I know, to do above, the concept of dynamic internal table exists, but I am not familiar with coding/syntax conventions.
Please help.
Regards,
Pankaj
‎2010 Oct 11 8:07 AM
Hi Pankay.
I've found a code sample, maybe it will help you:
DATA: w_structref TYPE REF TO cl_abap_structdescr,
it_comptab TYPE abap_compdescr_tab,
w_comptab TYPE abap_compdescr. ...
ASSIGN (g_t_data) TO <fs_line>.
w_structref ?= cl_abap_structdescr=>describe_by_data( <fs_line> ).
it_comptab = w_structref->components.Regards,
Klaus
‎2010 Oct 11 8:17 AM
Your exporting parameter simply should be either of type ANY TABLE (so you can assign any TABLE back to it) or should be any data reference ( type REF TO DATA ). Please refer for the second approach.
Regards
Marcin
Also you migh be interested with RTTS approach as an alternative to two above. /people/marcin.pciak/blog/2010/09/09/do-you-really-know-everything-about-typing--part-2
Edited by: Marcin Pciak on Oct 11, 2010 9:17 AM
‎2010 Oct 11 2:10 PM
Hello,
I have created a certain field catalog with dynamic internal table. Following is the code snippet:
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcat
IMPORTING
ep_table = new_table.
ASSIGN new_table->* TO <l_table>.
Now I want to populate the <l_table> through function module RSDRI_INFOPROV_READ.
How do I do it?
Regards,
Pankaj
‎2010 Oct 11 2:18 PM
Where is the problem then? You can pass <l_table> to parameter E_T_DATA which expects any standard table (without particular structure).
Regards
Marcin
‎2010 Oct 11 2:22 PM
Yes I did the same thing. Please see below the code.
CALL FUNCTION 'RSDRI_INFOPROV_READ'
EXPORTING
i_infoprov = l_infoprov
i_th_sfc = g_th_sfc
i_th_sfk = g_th_sfk
i_t_range = g_t_range
i_reference_date = sy-datum
i_packagesize = 1000
IMPORTING
e_t_data = <l_table>
e_end_of_data = g_end_of_data
CHANGING
c_first_call = g_first_call
EXCEPTIONS
illegal_input = 1
illegal_input_sfc = 2
illegal_input_sfk = 3
illegal_input_range = 4
illegal_input_tablesel = 5
no_authorization = 6
illegal_download = 8
illegal_tablename = 9
OTHERS = 11.
though i have the data in infoprovider i do not get data in <l_table>.
‎2010 Oct 11 2:26 PM
So this might be a data issue not an ABAP one. To ensure please go to se37 and test this FM giving same values for input parameters. You shall see then if the result is as expected or not.
Regards
Marcin
‎2010 Oct 11 3:22 PM
When I try doing it through SE37, i get the information pop up of "Error generating the test frame".
Also when I debug all the input parameters they are restricted to correct values, but the sy-subrc for the function module is set to 11.
Regards,
Pankaj
‎2010 Oct 12 8:43 AM
Hi Marcin,
I have some records in the infoprovider that follow data from g_t_range restrictions. But the data some how disappears from table <l_table>.
Any suggestion?
Regards,
Pankaj
‎2010 Oct 12 4:50 PM
I gave description instead of technical name in the ALIAS component of g_th_sfc internal table.
It is working correctly.
Thanks for the time.
Regards,
Pankaj