How To Implement The API For Real-Time InfoCubes (NW7.0)
How To Implement The API For Real-Time InfoCubes (NW7.0)
How To Implement The API For Real-Time InfoCubes (NW7.0)
How To
implement the
API for RealTime InfoCubes
Version 1.00 May 2006
Applicable Releases:
SAP NetWeaver 2004s
(Business Information Management - Enterprise
Data Warehousing)
1 Scenario
You want to test your queries or authorization concept and therefore need to write test
data to an InfoCube without using the Data Transfer Process (DTP). This is necessary
since your development system is not connected to a productive source system and
hence it is very difficult to use the existing data flow to load feasible test data.
Result:
2 Introduction
You have an ABAP routine to generate test data and you want to store the results
directly in an InfoCube without using the normal data flow.
The Application Programming Interface (API) RSDRI_CUBE_WRITE_PACKAGE_RFC
can be used to write data per Request into a Real-Time InfoCube.
This interface has the following properties:
Write interface
Programming language is ABAP
Mass data is supported
Execution in background (no high frequency, for example, per minute)
Programming proficiency is required
Data is updated in an InfoCube
This API is a not released BAPI. Please note that for each call a new Request is created
and therefore it is not recommended to write data with high frequency to an InfoCube.
This can result in heavy performance problems in the data load process, and it will
decrease the Request Administration Performance.
Note: This program is not supported by SAP.
-1-
3.1
-2-
-3-
3.2
API description
************************************
* API call
*
* Write generated data to InfoCube *
************************************
CALL FUNCTION 'RSDRI_CUBE_WRITE_PACKAGE_RFC'
DESTINATION I_RFCDEST
EXPORTING
I_INFOCUBE
= l_INFOCUBE
I_CURR_CONVERSION
= ' '
I_RFCDATA_UC
= L_XSTR
TABLES
I_T_RFCDATA = I_T_RFCDATA
EXCEPTIONS
COMMUNICATION_FAILURE = 1
SYSTEM_FAILURE
= 2
NOT_TRANSACTIONAL
= 3.
-4-
ZHOWTO_API_TCUBE.
****************************************
* Data Types
*
****************************************
TYPE-POOLS: rsd, rssb, rssg, rs.
FIELD-SYMBOLS:
<g_t_data>
TYPE STANDARD TABLE.
DATA:
DATA:
DATA:
DATA:
****************************************
* Selection Screen
*
****************************************
SELECTION-SCREEN BEGIN OF SCREEN 500.
PARAMETERS p_infoc type RSINFOCUBE default 'BINFOC'.
PARAMETERS p_size type i default 10.
SELECTION-SCREEN END OF SCREEN 500.
CALL SELECTION-SCREEN 500.
* end selection screen
check p_infoc is not initial.
check p_size is not initial.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TEXT_QUESTION
= 'Are you certain ... ?'
TEXT_BUTTON_1
= 'YES'(001)
TEXT_BUTTON_2
= 'NO'(002)
IMPORTING
ANSWER
= w_answer
EXCEPTIONS
TEXT_NOT_FOUND
= 1
OTHERS
= 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
-5-
space.
TO l_t_code.
TO
TO
TO
TO
l_t_code.
l_t_code.
l_t_code.
l_t_code.
-6-
APPEND '
CHANGING E_REF_TO_CHAVLTAB TYPE REF TO DATA.' TO l_t_code.
APPEND ' CREATE DATA E_REF_TO_CHAVLTAB TYPE L_T_DATA.'
TO l_t_code.
APPEND 'ENDFORM.'
TO l_t_code.
INSERT REPORT l_repid FROM l_t_code.
PERFORM create_table_types IN PROGRAM (l_repid)
CHANGING g_ref_to_data.
* get the columns-haedlines
ASSIGN g_ref_to_data->* TO <g_t_data>.
DELETE REPORT l_repid.
CLEAR l_t_code.
************************************
* create random key figures
*
* and characteristics
*
************************************
* create random key figures and characteristics
CALL FUNCTION 'RSSAMPLE_CUBE_SAMPLE_CREATE'
EXPORTING
i_infocube
= l_infocube
i_samplesize
= l_samplesize
i_use_masterdata = 'X'
i_random_seed
= 0
i_modus
= 3
IMPORTING
e_t_data
= <g_t_data>
EXCEPTIONS
illegal_input
= 1
inherited_error = 2
OTHERS
= 3.
IF sy-subrc <> 0.
MESSAGE ID 'BRAIN' TYPE 'E' NUMBER '332'.
ENDIF.
* Send the data using compressed XSTRING via RFC
EXPORT RSDRI = <g_t_data> TO DATA BUFFER L_XSTR
COMPRESSION ON.
FREE <g_t_data>.
DATA: I_T_RFCDATA TYPE
RSDRI_T_RFCDATA.
************************************
* API call
*
* Write generated data to InfoCube *
************************************
CALL FUNCTION 'RSDRI_CUBE_WRITE_PACKAGE_RFC'
DESTINATION I_RFCDEST
EXPORTING
I_INFOCUBE
= l_INFOCUBE
I_CURR_CONVERSION
= ' '
I_RFCDATA_UC
= L_XSTR
TABLES
I_T_RFCDATA = I_T_RFCDATA
EXCEPTIONS
COMMUNICATION_FAILURE = 1
SYSTEM_FAILURE
= 2
NOT_TRANSACTIONAL
= 3.
*---------------------------------------------------------------------*
*
FORM get_report_name
*
-7-
*---------------------------------------------------------------------*
*
........
*
*---------------------------------------------------------------------*
* --> E_REPID
*
*---------------------------------------------------------------------*
FORM get_report_name
CHANGING e_repid LIKE sy-repid.
DATA:
l_uniqueid
TYPE rssg_uni_idc25.
"get_report_name
-8-
http://www.sdn.sap.com/irj/sdn/howtoguides