cancel
Showing results for 
Search instead for 
Did you mean: 

BPC 10 NW : replacement for RUN_RSDRI_QUERY

Former Member
0 Kudos

Hi,

Recently we have migrated from BPC 7.5 NW to BPC 10 NW and we have few BADI's in the system. We were using the SQE RUN_RSDRI_QUERY to read data from Application.

But in BPC 10 NW RUN_RSDRI_QUERY is not supported. Is there any similar FM / Class to read data from an Application?

Thanks in advance.

Regards,

Meiyalagan

Accepted Solutions (1)

Accepted Solutions (1)

former_member190501
Active Contributor
0 Kudos

Hi,

Can you try Class CL_UJO_QUERY_BASE method IF_UJO_QUERY~RUN_RSDRI_QUERY.

Put a break point in this method and run UJO_SQE_TEST to see the parameters.

Hope it helps..

Thanks,

Raju

Former Member
0 Kudos

Hi Vara/Meiyalagan/other experts,

I'm using BPC10 also, and tried to use the class you've provided above to read data from other application but can't retrieve the data/empty.

Can you help to provide sampe code to use this class.

Here's my sample code, could you pointing which part is not correct.

Thanks in advance.

  DATA:

    lo_appl           TYPE REF TO CL_UJO_QUERY_BASE,
    lv_appset_id      TYPE uj_appset_id VALUE 'PETDEMO_USER',
    lv_application_id TYPE uj_appl_id VALUE 'Volume',
    lo_appl2          TYPE REF TO cl_uja_application,
    lo_model          TYPE REF TO if_uj_model,
    lo_dataref        TYPE REF TO data,
    lt_dim_name       TYPE UJA_T_DIM_LIST,
    ls_dim_name       LIKE LINE OF lt_dim_name,
    lt_appl_dim       TYPE uja_t_appl_dim,
    ls_appl_dim       LIKE LINE OF lt_appl_dim,
    lv_end_of_data    TYPE RS_BOOL,
    lv_split_occured  TYPE RSDR0_SPLIT_OCCURRED,
    lt_message        TYPE UJ0_T_MESSAGE,
    lv_stats_guid     TYPE UJ_STAT_SESSION,
    lv_cell_filted    TYPE ABAP_BOOL.

  FIELD-SYMBOLS: <lt_data> TYPE STANDARD TABLE.



  BREAK-POINT.

* Get applications dimensions
  CREATE OBJECT lo_appl2
    EXPORTING
      i_appset_id      = lv_appset_id
      i_application_id = lv_application_id.


  REFRESH lt_appl_dim.
  lo_appl2->get_appl_dim(
  EXPORTING
    i_appl_id = lv_application_id
  IMPORTING
    et_appl_dim = lt_appl_dim ).


* Get the structure of the result
  TRY.
      lo_model = cl_uj_model=>get_model( lv_appset_id ).
      lo_model->create_tx_data_ref(
      EXPORTING
        i_appl_name = lv_application_id
        i_type = 'T'
        it_dim_name = lt_dim_name
        if_tech_name = space
      IMPORTING
        er_data = lo_dataref ).
    CATCH cx_uj_static_check.
  ENDTRY.

  ASSIGN lo_dataref->* TO <lt_data>.

* populate dimension internal table
  REFRESH lt_dim_name.
  LOOP AT lt_appl_dim INTO ls_appl_dim.
    ls_dim_name = ls_appl_dim-dimension.
    APPEND ls_dim_name TO lt_dim_name.
  ENDLOOP.


  CREATE OBJECT lo_appl
    EXPORTING
      i_appset_id = lv_appset_id
      i_appl_id   = lv_application_id.

*  WHILE lv_end_of_data = rs_c_false.
* Get data
    TRY.
        lo_appl->IF_UJO_QUERY~RUN_RSDRI_QUERY(
        EXPORTING
          IT_DIM_NAME = lt_dim_name
        IMPORTING
          ET_DATA           = <lt_data>
          E_END_OF_DATA     = lv_end_of_data
          E_SPLIT_OCCURRED  = lv_split_occured
          ET_MESSAGE        = lt_message
          E_STATS_GUID      = lv_stats_guid
          E_CELL_FILTED     = lv_cell_filted ).
      CATCH CX_UJO_READ.
    ENDTRY.
*  ENDWHILE.

former_member76372
Participant
0 Kudos

Ive tried similar approach as you did but to no expense I dont know waht went wrong with it but I used the FM UJQ_RSDRI_RUN_QUERY and it works for me.

Hence the code:

*Get appset_id and appl_id infocube

   TRY.

     cl_uj_model=>get_model( EXPORTING i_appset_id = ex_i_appset_id

                             RECEIVING ro_model = lo_model ).

     lo_model->get_appl_data( EXPORTING i_application_id = ex_i_appl_id

                              RECEIVING ro_appl_data = lo_application ).

     CALL METHOD lo_application->get_application_info

       EXPORTING

         i_application_id = ex_i_appl_id

       IMPORTING

         es_appl_info     = im_infocube_info.

   ENDTRY.

*Incorporate Dimension Names for Table Type Determination

   LOOP AT ex_it_cv INTO gs_cv.

     gs_dim_name = gs_cv-dimension. "Incorporate dim names

     APPEND gs_dim_name TO gt_dim_name.

     CLEAR gs_dim_name.

   ENDLOOP.

*Move dimensions

   MOVE: gt_dim_name TO im_dim_name.

* Get the structure of the result

   TRY.

       go_model = cl_uj_model=>get_model( ex_i_appset_id ).

       go_model->create_tx_data_ref(

        EXPORTING

          i_appl_name  = ex_i_appl_id

          i_type       = 'T'

          it_dim_name  = gt_dim_name

          if_tech_name = space

        IMPORTING

          er_data      = go_dataref ).

     CATCH cx_uj_static_check.                           "#EC NO_HANDLER

   ENDTRY.

*Assign Data type to the table generated

   ASSIGN go_dataref->* TO <gt_data>.

   im_data_type = go_dataref.

   CHECK <gt_data> IS ASSIGNED.

   CHECK NOT ex_retrieve IS INITIAL.

   IF NOT ex_it_sel IS INITIAL. "If selection is specified

     CALL FUNCTION 'UJQ_RUN_RSDRI_QUERY'

       EXPORTING

         i_appset_id       = ex_i_appset_id

         i_appl_id         = ex_i_appl_id

         it_dim_name       = gt_dim_name

         it_sel            = ex_it_sel

         if_check_security = abap_false

       IMPORTING

         et_data           = <gt_data>.

   ELSE.

     CALL FUNCTION 'UJQ_RUN_RSDRI_QUERY'

       EXPORTING

         i_appset_id       = ex_i_appset_id

         i_appl_id         = ex_i_appl_id

         it_dim_name       = gt_dim_name

         if_check_security = abap_false

       IMPORTING

         et_data           = <gt_data>.

   ENDIF.

Try and compare.

Former Member
0 Kudos

Hi Edwin,

Thx a lot for your answer.

But are you using BPC10 ?

Because initially I tried with the same function module as yours, but there's no data being return, when I tried to debug the FM, it's actually the code already comment out by SAP.

And I belive the first question for this thread by Meiyalagan also referring to the FM that is no longer supported for BPC10.

any ideas ?

Thank you.

Former Member
0 Kudos

Hi kayala,

The code looks perfect. Please make sure tables lt_dim_name and lt_appl_dim.

Regards,

Meiyalagan

former_member76372
Participant
0 Kudos

Hi Kayla,

Can you ensure NOTE: 1582404 has been implemented?

Also, please use CLASS CL_UJQ_QUERY_ENGINE instead of CL_UJO_QUERY_BASE I think this might solve the problem.

Cheers.

Former Member
0 Kudos

Hi Edwin,

the OSS note is for BPC7.5, I double checked the correction code inside it, also already applied to our system.

in our system now, BPC10, the code inside class CL_UJQ_QUERY_ENGINE , method: RSDRI_QUERY already comment out.

actually I dont know in BPC lower version than 10 is comment out or not. But I believe because this code is no longer active in BPC10, then FM 'UJQ_RUN_RSDRI_QUERY' can't return any data.

Thank you.

Former Member
0 Kudos

Hi Meiyalagan,

Thx for your answer.

I'm expecting my code is not perfect.

If this is the case then how come I still can't get the result.

Thx a lot.

Former Member
0 Kudos

Hi,

Can you check and let me know, if the values in the table lt_dim_name and the fields of the table <lt_data> are same??

Regards,

Meiyalagan

Former Member
0 Kudos

Yes, it's the same. the structure already assigned to <lt_data>.

But at the end <lt_data> still no data inside.

This class can retrieve the data that still in yellow request inside the cube/application/model right ?

Thank you.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Hello.  Just to be clear, yes the UJQ functions have been replaced in BPC 10.0 NW.  You should now use the UJO classes instead.  Here is an example program that I have used many times, and I know that the code works well.

DATA:  lv_environment_id TYPE uj_appset_id VALUE 'TESTENV',

       lv_application_id TYPE uj_appl_id VALUE 'TESTMODEL',

       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.

Hope this helps.

Cheers,

Rich Heilman

Former Member
0 Kudos

Hi Rich,

Yeayy..it works.. thx a lot...

my code missed the part to call query adapter class.

For all, thx a lot for your reply.

Cheers..

Former Member
0 Kudos

Thank you for the code. I have a requirement to pick values for the (selected year -1). I wanted to know if there is a way to pick the year context (selected year) and pass (year -1) to the method 'create_data_ref'. That way, the transaction data will be filtered by the previous year.

Former Member
0 Kudos

Hey Rich,

Do we still need the above code to get data into BADi for BPC?

Regards

Rohan

former_member186338
Active Contributor
0 Kudos

Hi Rohan,

The alternative is to use QUERY=ON and define scope before badi call in the script. Then you will get scope data in ct_data without additional code.

Vadim

Answers (0)