2007 Aug 20 3:33 PM
hallow
i wont to have an example how to read data from BW CUBE
any sample will help
i reward
Regards
2007 Aug 20 3:45 PM
REPORT ZTEST_READ_CUBE1.
*2.G_END_OF_DATA Once the FM is executed successfully, this output
*parameter will hold the value X, means extraction completed
*successfully.
TYPES:
BEGIN OF ET_LINE,
0G_CWWTER TYPE /BI0/OIG_CWWTER,
ZOCBRDMAJ TYPE /BIC/OIZOCBRDMAJ,
ZOCBTIER TYPE /BIC/OIZOCBTIER,
END OF ET_LINE,
ET_DATA TYPE ET_LINE.
DATA: TAB_ET TYPE STANDARD TABLE OF ET_LINE
WITH DEFAULT KEY INITIAL SIZE 10.
DATA: TAB_SFC TYPE RSDRI_TH_SFC.
DATA: REC_SFC TYPE RSDRI_S_SFC.
REC_SFC-CHANM = '0G_CWWTER'.
INSERT REC_SFC INTO TABLE TAB_SFC.
REC_SFC-CHANM = 'ZOCBRDMAJ'.
INSERT REC_SFC INTO TABLE TAB_SFC.
REC_SFC-CHANM = 'ZOCBTIER'.
INSERT REC_SFC INTO TABLE TAB_SFC.
WHAT KEY FIGURES YOU WANT RETURNED
DATA: TAB_SFK TYPE RSDRI_TH_SFK.
DATA: REC_SFK TYPE RSDRI_S_SFK.
*REC_SFK-KYFNM = 'ZOKCOUNT'.
*INSERT REC_SFK INTO TABLE TAB_SFK.
WHERE YOU SET THE PARAMETERS/FILTERS.
DATA: REC_RANGE TYPE RSDRI_S_RANGE.
DATA: TAB_RANGE TYPE RSDRI_T_RANGE.
CLEAR REC_RANGE.
REC_RANGE-CHANM = '0G_CWWTER'.
REC_RANGE-SIGN = 'I'.
REC_RANGE-COMPOP = 'EQ'.
REC_RANGE-LOW = '1560'.
*REC_RANGE-HIGH = '1700'.
APPEND REC_RANGE TO TAB_RANGE.
CLEAR REC_RANGE.
REC_RANGE-CHANM = 'ZOCBRDMAJ'.
REC_RANGE-SIGN = 'I'.
REC_RANGE-COMPOP = 'BT'.
REC_RANGE-LOW = '423'.
REC_RANGE-HIGH = '520'.
APPEND REC_RANGE TO TAB_RANGE.
DATA: LIN_COUNT TYPE I.
DATA: FIRST_CALL TYPE RS_BOOL.
FIRST_CALL = 'X'.
CALL FUNCTION 'RSDRI_INFOPROV_READ'
EXPORTING
I_INFOPROV = 'ZCBMDREL'
I_TH_SFC = TAB_SFC
I_TH_SFK = TAB_SFK
I_T_RANGE = TAB_RANGE
I_TH_TABLESEL =
I_T_RTIME =
I_REFERENCE_DATE = SY-DATUM
I_ROLLUP_ONLY = RS_C_TRUE
I_T_REQUID =
I_SAVE_IN_TABLE = ' '
I_TABLENAME =
I_SAVE_IN_FILE = ' '
I_FILENAME =
I_PACKAGESIZE = 1000
I_MAXROWS = 0
I_AUTHORITY_CHECK = RSDRC_C_AUTHCHK-READ
I_CURRENCY_CONVERSION = 'X'
I_USE_DB_AGGREGATION = RS_C_TRUE
I_USE_AGGREGATES = RS_C_TRUE
I_READ_ODS_DELTA = RS_C_FALSE
I_CALLER = RSDRS_C_CALLER-RSDRI
I_DEBUG = RS_C_FALSE
I_CLEAR = RS_C_FALSE
IMPORTING
E_T_DATA = TAB_ET
E_END_OF_DATA =
E_AGGREGATE =
E_SPLIT_OCCURRED =
E_T_MSG =
CHANGING
C_FIRST_CALL = 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 = 7
ILLEGAL_TABLENAME = 8
TRANS_NO_WRITE_MODE = 9
INHERITED_ERROR = 10
X_MESSAGE = 11
OTHERS = 12
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DESCRIBE TABLE TAB_ET LINES LIN_COUNT.
WRITE : LIN_COUNT.
Thanks
Mahesh
2007 Aug 20 3:34 PM
2007 Aug 20 3:37 PM
You could use either RSDRI_INFOPROV_READ_RFC or use the standard methods via BAPI object MDDataSetBW. Other ideas are to use Open Hub and write your own RFC to read the db table. The BAPI is the official way but as I said it's a bit difficult to use. It has the advantage to not only extract cube data but also extract query results so if your data is in multiple cubes you might want to use XML/A on queries on multiproviders. The XML/A statement is normally the way to handle this situation.
regards,
srinivas
<b>*reward for useful answers*</b>
2007 Aug 20 3:45 PM
hi srinivas
u can give my example of code how to do that ,simple one will help.
Regards
2007 Aug 20 3:45 PM
REPORT ZTEST_READ_CUBE1.
*2.G_END_OF_DATA Once the FM is executed successfully, this output
*parameter will hold the value X, means extraction completed
*successfully.
TYPES:
BEGIN OF ET_LINE,
0G_CWWTER TYPE /BI0/OIG_CWWTER,
ZOCBRDMAJ TYPE /BIC/OIZOCBRDMAJ,
ZOCBTIER TYPE /BIC/OIZOCBTIER,
END OF ET_LINE,
ET_DATA TYPE ET_LINE.
DATA: TAB_ET TYPE STANDARD TABLE OF ET_LINE
WITH DEFAULT KEY INITIAL SIZE 10.
DATA: TAB_SFC TYPE RSDRI_TH_SFC.
DATA: REC_SFC TYPE RSDRI_S_SFC.
REC_SFC-CHANM = '0G_CWWTER'.
INSERT REC_SFC INTO TABLE TAB_SFC.
REC_SFC-CHANM = 'ZOCBRDMAJ'.
INSERT REC_SFC INTO TABLE TAB_SFC.
REC_SFC-CHANM = 'ZOCBTIER'.
INSERT REC_SFC INTO TABLE TAB_SFC.
WHAT KEY FIGURES YOU WANT RETURNED
DATA: TAB_SFK TYPE RSDRI_TH_SFK.
DATA: REC_SFK TYPE RSDRI_S_SFK.
*REC_SFK-KYFNM = 'ZOKCOUNT'.
*INSERT REC_SFK INTO TABLE TAB_SFK.
WHERE YOU SET THE PARAMETERS/FILTERS.
DATA: REC_RANGE TYPE RSDRI_S_RANGE.
DATA: TAB_RANGE TYPE RSDRI_T_RANGE.
CLEAR REC_RANGE.
REC_RANGE-CHANM = '0G_CWWTER'.
REC_RANGE-SIGN = 'I'.
REC_RANGE-COMPOP = 'EQ'.
REC_RANGE-LOW = '1560'.
*REC_RANGE-HIGH = '1700'.
APPEND REC_RANGE TO TAB_RANGE.
CLEAR REC_RANGE.
REC_RANGE-CHANM = 'ZOCBRDMAJ'.
REC_RANGE-SIGN = 'I'.
REC_RANGE-COMPOP = 'BT'.
REC_RANGE-LOW = '423'.
REC_RANGE-HIGH = '520'.
APPEND REC_RANGE TO TAB_RANGE.
DATA: LIN_COUNT TYPE I.
DATA: FIRST_CALL TYPE RS_BOOL.
FIRST_CALL = 'X'.
CALL FUNCTION 'RSDRI_INFOPROV_READ'
EXPORTING
I_INFOPROV = 'ZCBMDREL'
I_TH_SFC = TAB_SFC
I_TH_SFK = TAB_SFK
I_T_RANGE = TAB_RANGE
I_TH_TABLESEL =
I_T_RTIME =
I_REFERENCE_DATE = SY-DATUM
I_ROLLUP_ONLY = RS_C_TRUE
I_T_REQUID =
I_SAVE_IN_TABLE = ' '
I_TABLENAME =
I_SAVE_IN_FILE = ' '
I_FILENAME =
I_PACKAGESIZE = 1000
I_MAXROWS = 0
I_AUTHORITY_CHECK = RSDRC_C_AUTHCHK-READ
I_CURRENCY_CONVERSION = 'X'
I_USE_DB_AGGREGATION = RS_C_TRUE
I_USE_AGGREGATES = RS_C_TRUE
I_READ_ODS_DELTA = RS_C_FALSE
I_CALLER = RSDRS_C_CALLER-RSDRI
I_DEBUG = RS_C_FALSE
I_CLEAR = RS_C_FALSE
IMPORTING
E_T_DATA = TAB_ET
E_END_OF_DATA =
E_AGGREGATE =
E_SPLIT_OCCURRED =
E_T_MSG =
CHANGING
C_FIRST_CALL = 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 = 7
ILLEGAL_TABLENAME = 8
TRANS_NO_WRITE_MODE = 9
INHERITED_ERROR = 10
X_MESSAGE = 11
OTHERS = 12
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DESCRIBE TABLE TAB_ET LINES LIN_COUNT.
WRITE : LIN_COUNT.
Thanks
Mahesh