Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

code example RSDRI_INFOPROV_READ for different infocubes

Former Member
0 Likes
4,269

Hello,

I'd like to use FM RSDRI_INFOPROV_READ to read time characteristics of an infocube. I found the report RSDRI_INFOPROV_READ_DEMO but this is designed only for one infocube. I'd like to modify this example so that I can use it for different infocubes.

Are any code examples how I could do this? I use the search but can't find a useful result.

Thanks in advance

Best regards

Ella

Hello,

I'd like to use FM RSDRI_INFOPROV_READ to read time characteristics of an infocube. I found the report RSDRI_INFOPROV_READ_DEMO but this is designed only for one infocube. I'd like to modify this example so that I can use it for different infocubes.

Are any code examples how I could do this? I use the search but can't find a useful result.

Thanks in advance

Best regards

Ella

4 REPLIES 4
Read only

Former Member
0 Likes
2,164

I solved the problem.

Read only

0 Likes
2,164

Hi Ella

Can you please document here how did you solve the problem so that some one else can use it

Nabheet

Read only

2,164

No one cares if you solved the problem or not. Just post the solution if you have.

Read only

Former Member
0 Likes
2,164

This is my solution: At the end <fs_table> contains the data of selected InfoCube.

DATA: l_t_dime_iobj         TYPE rsd_t_dime_iobj,
      l_s_dime_iobj        
LIKE LINE OF l_t_dime_iobj,
            
l_t_sfc               TYPE rsdri_th_sfc,
      l_s_sfc              
TYPE rsdri_s_sfc,
      l_t_sfk              
TYPE rsdri_th_sfk,
      l_t_tot_comp         
TYPE cl_abap_structdescr=>component_table,
      l_t_comp             
TYPE cl_abap_structdescr=>component_table,
      l_s_comp             
LIKE LINE OF l_t_comp,

      v_iobnm               TYPE char30,
      v_end_of_data        
TYPE rs_bool,
      v_first_call         
TYPE rs_bool.

FIELD-SYMBOLS: <fs_table>   TYPE ANY TABLE,
               <fs_line>   
TYPE ANY,
               <fs_field>
.

 

* Select all InfoObjects of InfoCube
 
CALL FUNCTION 'RSD_CUBE_GET'
   
EXPORTING
      i_infocube        
= 'Z_TEST'
      i_objvers         
= 'A'
   
IMPORTING
      e_t_dime_iobj     
= l_t_dime_iobj
   
EXCEPTIONS
      infocube_not_found
= 1
      illegal_input     
= 2
     
OTHERS             = 3.

LOOP AT l_t_dime_iobj INTO l_s_dime_iobj

*   Techn. name of characteristic
      l_s_sfc
-chanm = l_s_dime_iobj-iobjnm.
*   Name of corresponding column in <lt_table>
      l_s_sfc
-chaalias = l_s_dime_iobj-iobjnm+1.
*   no ORDER-BY
      l_s_sfc
-orderby = '0'.
*   Add entry to list of characteristics
     
INSERT l_s_sfc INTO TABLE l_t_sfc.

     CONCATENATE '/BI0/OI' l_s_dime_iobj-iobjnm+1 INTO v_iobnm.

*   Get every components of InfoObject
      ref_descr
= cl_abap_typedescr=>describe_by_name( v_iobnm ).


     
CASE ref_descr->type_kind.
       
WHEN 'STRING'ref_w_typ = cl_abap_elemdescr=>get_string( ).
       
WHEN 'XSTRING'. ref_w_typ = cl_abap_elemdescr=>get_xstring( ).
       
WHEN 'I'.       ref_w_typ = cl_abap_elemdescr=>get_i( ).
       
WHEN 'F'.       ref_w_typ = cl_abap_elemdescr=>get_f( ).
       
WHEN 'D'.       ref_w_typ = cl_abap_elemdescr=>get_d( ).
       
WHEN 'T'.       ref_w_typ = cl_abap_elemdescr=>get_t(  ).
       
WHEN 'C'.       ref_w_typ = cl_abap_elemdescr=>get_c( p_length = ref_descr->length / 2 ).
       
WHEN 'N'.       ref_w_typ = cl_abap_elemdescr=>get_n( p_length = ref_descr->length / 2 ).
       
WHEN 'X'.       ref_w_typ = cl_abap_elemdescr=>get_x( p_length = ref_descr->length / 2 ).
       
WHEN 'P'.       ref_w_typ = cl_abap_elemdescr=>get_p( p_length = ref_descr->length / 2 p_decimals = '0' ).
     
ENDCASE.


* Field type
      l_s_comp
-type = ref_w_typ.
* Field name
      l_s_comp
-name = l_s_dime_iobj-iobjnm+1.
* Add entry to component table
     
APPEND l_s_comp TO l_t_tot_comp.


 
ENDLOOP.

* Create new type from component table
  ref_obj_struc
= cl_abap_structdescr=>create( l_t_tot_comp ).
* Create new table type
  ref_obj_table ?= cl_abap_tabledescr
=>create( ref_obj_struc ).
* Create internal table and assign to Field Symbol
 
CREATE DATA ref_obj_data TYPE HANDLE ref_obj_table.
 
ASSIGN ref_obj_data->* TO <fs_table>.

  v_end_of_data = rs_c_false.
  v_first_call 
= rs_c_true.

  WHILE v_end_of_data = rs_c_false.

   
CALL FUNCTION 'RSDRI_INFOPROV_READ'
     
EXPORTING
        i_infoprov            
= 'Z_TEST'
        i_th_sfc              
= l_t_sfc
        i_th_sfk              
= l_t_sfk
     
IMPORTING
        e_t_data              
= <fs_table>
        e_end_of_data         
= v_end_of_data
     
CHANGING
        c_first_call          
= v_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.