




已阅读5页,还剩1页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1. First call to BAPI_CUBE_GETDETAIL, to get all infoobjects of a cube, it returns a list of infoobjects in INFOOBJECTS parameter. 2. Then built an internal table with all the characteristics required from INFOOBJECTS table. and an internal table with all the key figures. In INFOOBJECTS table there is a field which indicates the infoobject type. 3. Call to RSDPL_CUBE_DATA_READ function call, filling in I_T_CHA the list of characteristics, and I_T_KYF the list of key figures. The function returns in tablename a dictionary table that has all the information. 4. Make a select to the (tablename) table and get all contents. This is the content of the infocube.(http:/www.web-dreamer.de/blog/2009/04/reading-on-sap-bi-infocubes-via-rsdri_infoprov_read.html)As you SAP Gurus out there knew, it is quite hard to read directly from InfoProviders. One of the reasons why you create DatastorageObjects is to have the possibility to read on it via SELECT.Thus, my dear friends, has not to be.The nice people of SAP has produced a function method which allows you, with proper use to read directly in your InfoProviders and select as simple as you like. You may wonder what im talking about. I talk about the function RSDRI_INFOPROV_READ. Many good men and women had try to solve the use of this freakin module and has suffered from it.I hope that the followin code examples will light your days as it has mine. Thanks, rewards, updates, comments are very welcome.*Copyright (c) 2009, J.Rumpf, www.web-dreamer.de / BSD Licence*All rights reserved.*Redistribution and use in source and binary forms, with or without modification*are permitted provided that the following conditions are met:* * Redistributions of source code must retain the above copyright notice, th* is list of conditions and the following disclaimer.* * Redistributions in binary form must reproduce the above copyright notice,* this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution.* * Neither the name of the owner nor the names of its contributors may be used* to endorse or promote products derived from this software without specific * prior written permission.*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND*ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL *DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR *SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER *CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, *OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.TYPE-POOLS: rsdrc. CONSTANTS: cube TYPE rsinfoprov VALUE ZYOURINFOPROVIDER. DATA: cube_struct TYPE string, fact_struct TYPE string. generic structure with ALL Characteristics and Keyfigures of the Cube CONCATENATE /bic/v cube j INTO cube_struct. * cube_struct = YOUR_STRUCTURE. Facttable of the Cube - be carfull in Big Cubes - there is an f and an g CONCATENATE /bic/v cube f INTO fact_struct. TYPES: t_cube_struct TYPE TABLE OF ( cube_struct ) = Set on YOUR Target Structure or the content of cube_struct ! WITH DEFAULT KEY INITIAL SIZE 0. DATA: e_th_sfc TYPE rsdri_th_sfc, Characteristics of the Cube e_th_sfk TYPE rsdri_th_sfk, Keyfigures of the cube line_of_e_th_sfc TYPE rsdri_s_sfc, line_of_e_th_sfk TYPE rsdri_s_sfk, ddic TYPE dd_x031l_table, Datadictonary for later use ldic LIKE LINE OF ddic, Ddic row fact_ddic TYPE dd_x031l_table, fact_ddic my_structure TYPE REF TO data, Structure of DDIC g_t_data TYPE t_cube_struct, table-typ of return-table t_all_data TYPE t_cube_struct, Table-type of return-table c_first_call TYPE rs_bool, First-call r_seloption TYPE rsdri_t_range, Selection-Table w_seloption TYPE LINE OF rsdri_t_range, Selection-Row end_of_data TYPE rs_bool, Last Call infoprov TYPE rsinfoprov Infoprovider = cube .* Sometimes your Structure has Columns you dont have in your Cube Here you can add this columns to be ignored by the cube. ! Please note - the function will aggregate on its standard key figure behaviour if you dont add all relevant primary keys! DATA: ignore_list TYPE STANDARD TABLE OF fieldname. ldic-fieldname = MY_IGNORE_COLUMN_NAME. APPEND ldic-fieldname TO ignore_list. * From here you go with your selection on your cube - for each selection you need to copy the following linesdata: Z_INFOOBJEKT type /BIC/OIZ_INFOOBJEKT. = Important because of the selection-type Selection-Condition: Z_INFOOBJEKT = my_selection. w_seloption-chanm = Z_INFOOBJEKT. technical name of InfoObjekt w_seloption-sign = I. Include w_seloption-compop = EQ. EQUAL w_seloption-low = Z_INFOOBJEKT. APPEND w_seloption TO r_seloption. * No change from here necessary. FIELD-SYMBOLS: TYPE ANY. DATA: fact_ref TYPE REF TO cl_abap_structdescr. CREATE DATA my_structure TYPE (fact_struct). Struktur-Objekt der Faktentabelle lesen fact_ref ?= cl_abap_tabledescr=describe_by_data_ref( my_structure ). CALL METHOD fact_ref-get_ddic_object DDIC Beschreibung auslesen RECEIVING p_object = fact_ddic EXCEPTIONS not_found = 1 no_ddic_type = 2 OTHERS = 3. DATA: descr_ref TYPE REF TO cl_abap_structdescr. CREATE DATA my_structure TYPE (cube_struct). descr_ref ?= cl_abap_tabledescr=describe_by_data_ref( my_structure ). Struktur-Objekt der zu lesenden Objekte lesen CALL METHOD descr_ref-get_ddic_object DDic Beschreibung auslesen RECEIVING p_object = ddic EXCEPTIONS not_found = 1 no_ddic_type = 2 OTHERS = 3. DATA: wa_rol LIKE ldic-fieldname. LOOP AT ddic INTO ldic. Iterate over all relevant Keyfigures READ TABLE ignore_list FROM ldic-fieldname INTO wa_rol. IF sy-subrc NE 0. READ TABLE fact_ddic WITH KEY rollname = ldic-rollname ASSIGNING . Compare if rollname of fact-table is in Cube-structure - if it is ne 0; IF sy-subrc NE 0. Key-Figure line_of_e_th_sfc-chanm = ldic-fieldname. INSERT line_of_e_th_sfc INTO TABLE e_th_sfc. ELSE. must be a characteristic line_of_e_th_sfk-kyfnm = ldic-fieldname. INSERT line_of_e_th_sfk INTO TABLE e_th_sfk. ! Be carefull by Cubes with many keyfigures see above ! ENDIF. ENDIF. ENDLOOP. infoprov = cube. Just for type-matching. WHILE ( end_of_data NE X). As long as not end_of_data CALL FUNCTION RSDRI_INFOPROV_READ EXPORTING i_infoprov = cube i_th_sfc = e_th_sfc i_th_sfk = e_th_sfk i_t_range = r_seloption* 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 = 10000* I_MAXROWS = 0 i_authority_check = rsdrc_c_authchk-none use if you want to check auth* 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 = g_t_data e_end_of_data = end_of_data* E_AGGREGATE =* E_SPLIT_OCCURRED =* E_T_MSG =* E_STEPUID = CHANGING c_first_call = c_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_w
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- Lesson 2 What's the temperature in Yantai说课稿-2025-2026学年中职英语第一册人教版(中职三年制)
- 3.3.2 抛物线的简单几何性质第1课时教学设计-2024-2025学年高二上学期数学人教A版(2019)选择性必修第一册
- 7 不甘屈辱奋勇抗争2023-2024学年五年级下册道德与法治同步教学设计(统编版)
- 蔬菜储藏知识培训课件
- 蔬菜保鲜知识培训内容课件
- 2025年中考化学试题分类汇编:工艺流程题(第1期)解析版
- 写作:如何突出中心(说课稿) 七年级语文上册同步备课系列(统编版)
- 2025年天津市河西区中考三模物理试题(解析版)
- 四年级英语下册 Unit 3 At the zoo Part B第一课时说课稿2 人教PEP
- 蒸制食品技术知识培训
- 2025年云南警务辅助人员招聘考试(基本法律知识和公文写作)历年参考题库含答案详解(5卷)
- 医院患者随访体系建设与实践
- 2025年全国《质量知识竞赛》题库及答案
- 2025版山东省病历书写与管理规范
- 新疆产假管理办法
- GB 11122-2025柴油机油
- 2025年河南开封产城融合投资集团有限公司招聘考试笔试试题(含答案)
- 锂电池充电安全管理制度
- 重庆市荣昌区招聘社区工作者后备人选考试真题2024
- 制造业生产流程质量管理及保证措施
- 2025秋 名师金典高考总复习 英语 课件05 第一部分 必修第一册 UNIT 4 NATURAL DISASTERS
评论
0/150
提交评论