Skip to Content
0

how to pass memberset rules (BAS,DEP etc) to CALL METHOD lo_sqe->run_axis_query_symm

Sep 19, 2017 at 01:32 PM

121

avatar image

Dear Experts,

I am trying to use basic BPC Data reading approach in SAP BPC 10.1 NW classic environment according to published How-to guide (How To Migrate BPC 7.x BADIs to BPC 10).
I need to read data from parent members so I use axis query (call method lo_sqe->run_axis_query_symm).

call method lo_sqe->run_axis_query_symm 
  exporting 
    it_axis   = lt_axis 
    it_slicer = lt_slicer 
  importing 
    et_data   = <lt_query_result>. 

Does anyone know how to pass memberset rules (BAS,DEP etc) to such queries?
According to Appendix B I see that "ls_member" variable has "MEMBERSET_FORMULA" parameter but I have no idea how to use it.

ls_member-dimension = 'ACCOUNT'. 
ls_member-member = 'PL110'. " <--- need something like BAS(PL_TOTAL) here
insert ls_member into table ls_axis. 
insert ls_axis into table lt_axis. 
clear ls_axis. 

Please, share your ideas.

Regards,

Oleg.

abap | badi | sqe
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Vadim Kalinin Sep 19, 2017 at 03:18 PM
1

"I am using run_axis_query_symm method in custom abap report" - have to be mentioned in the beginning :)

cl_ujk_model=>get_children
exporting
    i_appset_id = l_appset_id
    i_dim = 'SOMEDIMENSION'
    i_parent_mbr = 'SOMEPARENT'
    i_type = 'DEP'
    "i_self = if you want to include parent in the result
importing
    et_bas_list. "in this sample the result is DEP(SOMEPARENT)

Then use the received member list to fill the axis in lt_axis

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Another option is to use method: GET_MEMBER_LIST

And create it_sel parameter.

0
Lucas Costa Sep 19, 2017 at 10:17 PM
0
With this method you don't need to select base members, as the method does it for you. Actually in the documentation there is tip in there: "Though the method is called ‚ axis query ‛ , the internal engine is smart enough to choose which type of query to use. For example , if the selection is all base members, the RSDRI query type will be used automatically."

If you look at the import table IT_AXIS you have:

DIMENSION
HIERARCHY
MEMBER
MEMBERSET_FORMULA

Therefore using your example, BAS(PL_TOTAL), would be something like:

DIMENSION = ACCOUNT
HIERARCHY = PARENTH1
MEMBER = PL_TOTAL

Cheers,

Lucas

Show 4 Share
10 |10000 characters needed characters left characters exceeded

Sorry, Lucas! If it_axis contain PL_TOTAL the result of this query will be for PL_TOTAL only, not for BAS(PL_TOTAL).

0

Yes, exactly, Vadim. Using PL_TOTAL member in axis query gives you the result with PL_TOTAL only.

That's why I'm curious about how to use ls_member-MEMBERSET_FORMULA here without filling lt_axis element by element using cl_ujk_model=>get_children (or similar).

0

Just tested: run_axis_query_symm will ignore information stored in MEMBERSET_FORMULA!

    LOOP AT it_cv ASSIGNING <ls_cv>.
      l_dimname = <ls_cv>-DIMENSION.
      append l_dimname to lt_dim_list.
      LOOP AT <ls_cv>-MEMBER INTO l_member.
        ls_member-DIMENSION = l_dimname.
        ls_member-MEMBER = l_member.
        if l_dimname = 'TIME'.
          ls_member-MEMBERSET_FORMULA-TYPE = CL_UJO_QUERY_MEMBERSET=>GC_BASELEVEL.
        endif.
        insert ls_member into table ls_axis.
      ENDLOOP.
      insert ls_axis into table lt_axis.
      clear ls_axis.
    ENDLOOP.

Tested with GS_BASELEVEL or GS_SAMELEVEL

0

Oh I see... Sorry for that.

But what do you want to do then? Always bring the base members? Or both?

0
Vadim Kalinin Sep 19, 2017 at 02:29 PM
0

You have to correctly fill the structure:

lt_axis

For custom logic badi you can scope data before badi call in script logic using XDIM_MEMBERSET...

And inside badi you can read the scope from It_cv

Loop It_cv dimensions and assign members to it_axis.

Or you can perform everything inside badi.

Share
10 |10000 characters needed characters left characters exceeded
Vadim Kalinin Sep 19, 2017 at 02:46 PM
0

My code sample to use scope defined in the script to query data inside badi:

DATA:     ls_axis type ujo_t_members,
          lt_axis type ujo_t_query_dim,
          lt_dim_list type uja_t_dim_list,
          ls_member type ujo_s_member,
          l_dimname TYPE uj_dim_name,
          l_member TYPE UJ_DIM_MEMBER.
          lr_data type ref to data,
          lo_sqe type ref to if_ujo_query,
          lr_rec TYPE REF TO data,
          lo_appl_mgr type ref to if_uja_application_manager.

FIELD-SYMBOLS: <ls_rec> TYPE ANY,
               <ls_cv> TYPE UJK_S_CV.
               <lt_query_result> type standard table.

    LOOP AT it_cv ASSIGNING <ls_cv>.
      l_dimname = <ls_cv>-DIMENSION.
      append l_dimname to lt_dim_list.
      LOOP AT <ls_cv>-MEMBER INTO l_member.
        ls_member-DIMENSION = l_dimname.
        ls_member-MEMBER = l_member.
        insert ls_member into table ls_axis.
      ENDLOOP.
      insert ls_axis into table lt_axis.
      clear ls_axis.
    ENDLOOP.

    TRY.
    call method cl_uja_bpc_admin_factory=>get_application_manager
    exporting
    i_appset_id = i_appset_id
    i_application_id = i_appl_id
    receiving
    ro_return = lo_appl_mgr.

    call method 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>.

    call method cl_ujo_query_factory=>get_query_adapter
    exporting
    i_appset_id = i_appset_id
    i_appl_id = i_appl_id
    receiving
    adapter = lo_sqe.

    call method lo_sqe->run_axis_query_symm
    exporting
    it_axis = lt_axis
    it_slicer = lt_slicer
    importing
    et_data = <lt_query_result>.

    CATCH
       cx_ujo_read
       cx_uj_static_check INTO lx_static.
    ENDTRY.

    CREATE DATA lr_rec LIKE LINE OF <lt_query_result>.
    ASSIGN lr_rec->* TO <ls_rec>.

    "Loop through incoming data and create a result set
    LOOP AT <lt_query_result> ASSIGNING <ls_rec>.
    " Your code here!
    ENDLOOP.

P.S. If you want to select members in APAP then look on:

cl_ujk_model=>get_children

i_parent_mbr - parent member

i_type export parameter can be:

"ALL" (children member from all levels), "DEP" (children members from one level lower than the parent), "BAS" (base members only)

Show 1 Share
10 |10000 characters needed characters left characters exceeded

I am using run_axis_query_symm method in custom abap report so I don't have it_cv in my scope and I am not going to run this code via bpc badi call.
I just need to know how to correctly populate lt_axis for dimension with memberset rule like "all base members for specific parent".
For example, I want to specify somehow rule BAS(2017.TOTAL) for TIME dimension in ls_member and to get in the result rows with TIME=2017.01,2017.02...2017.12.

0