cancel
Showing results for 
Search instead for 
Did you mean: 

replacement for IF_UJ_MODEL~GET_APPL_DATA

Former Member
0 Kudos

Hi,

I am trying to update code from BPC 7.5 to BPC 10.

I am having diffculty to find replacement for IF_UJ_MODEL~GET_APPL_DATA and also cl_ujq_sqe_factory=>get_instance

What I am trying to do is export data from BPC to ABAP table.

Can anyone please advise me on this.

I attached part of what I have coded.

Regards

method run_query.

  data:
*      Application Set
       l_appset type ref to if_uj_model,
*       Application
       l_ibp    type ref to if_uja_application_data,

*       Shared Query Engine
        l_sqe           type ref to if_ujq_sqe,
if_ujq
*       Table of used dimensions
        lt_dim_name     type ujq_t_dim,

        lt_sel_cond     type uj0_t_sel,

        l_data          type ref to data.

  field-symbols:
*       Data table field symbol
        <fs_table>      type standard table.


* Application Set
  l_appset = cl_uj_model=>get_model( 'TESTING' ).

* Application
****************PROBLEM HERE********************
  l_ibp    = l_appset->get_appl_data( 'TEST' ).


* Get a list of dimensions in the application
  l_ibp->get_dim_list(
    importing
      et_dim_name    = lt_dim_name ).

try.
*   Create a reference to the data table:
*   This is the table in the form of the structure of the application:
*   all the dimensions + one value at the end!
*** PF_ACCOUNT, PF_CUSTOMER, .... TIME, SIGNEDDATA
      l_ibp->create_data_ref(
        exporting
           i_data_type = if_uja_application_data=>gc_type_table
        importing
          er_data      = l_data ).

*     Assign this reference to a field symbol so we can use it
      assign l_data->* to <fs_table>.

****************PROBLEM HERE********************
*     Get the instance of the Shared Query Engine
      cl_ujq_sqe_factory=>get_instance(
        exporting
          i_appset_id = 'TESTING'
          i_appl_id   = 'TEST'
        importing
          e_sqe       = l_sqe ).

*     Run the query on the application!
      l_sqe->run_rsdri_query(
        exporting
          it_dim_name       = lt_dim_name
          it_range          = lt_sel_cond
          if_check_security = abap_false
        importing
          et_data           = <fs_table> ).


    catch cx_uja_admin_error.
    catch cx_ujq_exception.
  endtry.
endmethod.

Accepted Solutions (1)

Accepted Solutions (1)

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Here is some sample code for reading transaction data in BPC 10.0 NW.

DATA:  lv_environment_id TYPE uj_appset_id VALUE 'TEST_ENV',
       lv_application_id TYPE uj_appl_id VALUE 'PLANNING',
       lt_dim_list TYPE uja_t_dim_list,
       lo_appl_mgr TYPE REF TO if_uja_application_manager,
       lo_query TYPE REF TO if_ujo_query,
       lr_data TYPE REF TO data,
       lt_message TYPE uj0_t_message,
       ls_application type UJA_S_APPLICATION,
       ls_dimensions type UJA_s_DIMENSION.

FIELD-SYMBOLS: <lt_query_result> TYPE STANDARD TABLE.

lo_appl_mgr = cl_uja_bpc_admin_factory=>get_application_manager(
                 i_appset_id      =  lv_environment_id
                 i_application_id =  lv_application_id ).

clear ls_application.
lo_appl_mgr->GET(
  exporting
    IF_WITH_MEASURES = ABAP_FALSE    " BPC: Generic indicator
    IF_SUMMARY       = ABAP_FALSE    " BPC: Generic indicator
  importing
    ES_APPLICATION   = ls_application ).  " Applications table type

refresh lt_dim_list.
loop at ls_application-dimensions into ls_dimensions.
  append ls_dimensions-dimension to lt_dim_list.
endloop.

lo_appl_mgr->create_data_ref(
  EXPORTING
    i_data_type   = 'T'
    it_dim_name   = lt_dim_list
    if_tech_name  = abap_false
    if_signeddata = abap_true
  IMPORTING
    er_data       = lr_data ).

ASSIGN lr_data->* TO <lt_query_result>.

TRY.
    lo_query = cl_ujo_query_factory=>get_query_adapter(
        i_appset_id = lv_environment_id
        i_appl_id   = lv_application_id
    ).

    lo_query->run_rsdri_query(
      EXPORTING
        it_dim_name       =  lt_dim_list   " BPC: Dimension List
*        it_range          =     " BPC: Selection condition
         if_check_security = ABAP_FALSE    " BPC: Generic indicator
*        i_packagesize     =     " BPC: Size of Returned Data Package
*        i_call_badi       = ABAP_TRUE
*        if_db_aggregate   = ABAP_TRUE    " BPC: Generic indicator
       IMPORTING
         et_data           = <lt_query_result>
*        e_end_of_data     =     " BPC: Last Data Package Yes/No
*        e_split_occurred  =     " Result may not be completely aggregated
         et_message        = lt_message    " BPC: Messages
*        e_stats_guid      =     " BPC: Statistics Session
*        e_cell_filted     =
*      CHANGING
*        c_first_call      =     " BPC: First Call Yes/No
    ).
*      CATCH cx_ujo_read.    " Exception of common read

  CATCH cx_ujo_read.  " Exception of common read
ENDTRY.


* SHow transaction data via ALV
DATA: lo_table     TYPE REF TO cl_salv_table.
DATA: lo_functions TYPE REF TO cl_salv_functions.
TRY.
    cl_salv_table=>factory( IMPORTING r_salv_table  = lo_table
                             CHANGING t_table       = <lt_query_result> ).

    lo_functions = lo_table->get_functions( ).
    lo_functions->set_all( abap_true ).
    lo_table->display( ).
  CATCH cx_salv_msg.
ENDTRY.

Hope this helps.

CHeers,

Rich Heilman

Answers (0)