Quantcast
Channel: SCN : Discussion List - SAP Planning and Consolidation, version for SAP NetWeaver
Viewing all articles
Browse latest Browse all 5414

z-function to read BPC Model transaction data

$
0
0

Hi Experts,

  I have tried to pass selection to  run_rsdri_query but it does not return any results. When I run without any selections, it returns the data from the model.

I have passed the below selections:

tra.png

The code is as below:

FUNCTION ZBPC_READ_TRNS.

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     REFERENCE(TIME_FROM) TYPE  CHAR32

*"     REFERENCE(TIME_TO) TYPE  CHAR32

*"     REFERENCE(APPSET_ID) TYPE  CHAR20

*"     REFERENCE(APPL_ID) TYPE  CHAR20

*"----------------------------------------------------------------------

DATA:

*       lv_environment_id TYPE uj_appset_id VALUE 'CATHAY',

*       lv_application_id TYPE uj_appl_id VALUE 'OPEX',

        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,

        lt_sel TYPE uj0_t_sel,

        ls_sel TYPE uj0_s_sel,

        ls_cv TYPE ujk_s_cv.

 

FIELD-SYMBOLS:

                <lt_query_result> TYPE STANDARD TABLE.

 

try.

 

lo_appl_mgr = cl_uja_bpc_admin_factory=>get_application_manager(

                     i_appset_id = APPSET_ID

                     i_application_id = APPL_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>.

  lo_query = cl_ujo_query_factory=>get_query_adapter(

         i_appset_id = APPSET_ID

         i_appl_id   = APPL_ID

     ).

 

"Generating application data with below filter set

 

REFRESH lt_sel.

CLEAR ls_sel.

 

ls_sel-dimension = 'INPUTCURRENCY'.

ls_sel-low = 'HKD'.

APPEND ls_sel TO lt_sel.

" Reading the time values passed from the LGF script that calls this BAdI

 

ls_sel-dimension = 'TIME'.

ls_sel-low = TIME_FROM.

ls_sel-high = TIME_TO.

APPEND ls_sel TO lt_sel.

 

 

REFRESH <lt_query_result>.

 

  lo_query->run_rsdri_query(

       EXPORTING

         it_dim_name       lt_dim_list   " BPC: Dimension List

         it_range          lt_sel " 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

 

                            ).

*    LT_DATA[] = <lt_query_result>.

CATCH:cx_uja_admin_error,cx_uj_static_check. "cx_uj_no_auth.

* CATCH cx_ujo_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.

  

ENDFUNCTION.


May I know what is the correct way of passing selections?


Regards,

Draksh


Viewing all articles
Browse latest Browse all 5414

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>