cancel
Showing results for 
Search instead for 
Did you mean: 

Adding members to hierarchy in BADI Endiroutine

Former Member
0 Kudos

Hi there

I am trying to enhance a hierarchy loaded from BW in a BADI endroutine.

What i am doing is to add some members based on master data in a BPC dimension.

The Badi in it self seems to work ok. the Badi output ER_DATA looks correct as a combination of the loaded hierarchy + the newly added records.

The issue arises later on in a piece of standard code. It seem like a test is performed to check if IR_DATA contains the same number of rows as ER_DATA. In my case this will not be the case as i add records in the Badi.

Do you know if this way of enhancing the hierarchy is not possible? or has anybody seen this issue before and found a solution?

Help will be very much appreciated.

/Chris

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Hi, I am having this exact same error. Was it resolved?

Former Member
0 Kudos

Hi

The error that i recieve is a short dump in ST22

GETWA_NOT_ASSIGNED in abap program CL_UJD_BADI========CP

ABAP code where the prorblem arises.

if lr_normal_data_export is not initial.

     assign lr_normal_data_export->* to <lt_normal_data>.

     l_row_count = lines( <lt_normal_data> ).

The last statement generates the dump as <lt_normal_data> is not getting assigned in the previous code line.

Appreciate your response.

/Chris

former_member200327
Active Contributor
0 Kudos

Hi Chris,

I found that code in Method IF_UJD_PIPE_EXECUTE~PROCESS_INPUT of Class CL_UJD_BADI. You have that dump because variable lr_normal_data_export references to a wrong address or nothing was assigned to it.

It looks like this can happen if BADI didn't assign correct address to export parameter ER_DATA. Is it possible that control goes out of your BADI without making any assignment to ER_DATA?

I don't see any code comparing number of records.

-Gersh

Former Member
0 Kudos

Hi Gersh

When the badi is completed it contains arround 3100 records so data is assigned. I have inserted the code below, maybe you can see the cause.

method IF_UJD_ROUTINE~RUNROUTINE.



  
DATA: lv_check(1) TYPE C.


* Stop if debugging is active *



 
SELECT SINGLE /bic/zbpcval INTO lv_check FROM /bic/mzbpcparam

     
WHERE /bic/zbpcparam = 'ZCL_BPC_HIERARCHY'.



 
WHILE lv_check = 'X'.

 
ENDWHILE.



 
TYPES:

     
BEGIN OF ls_ic_tab,

          ic
(20) type c,

          P2MAN
(20) type c,

     
END OF ls_ic_tab.



 
TYPES:

     
BEGIN OF ls_hier,

        nodename
(60) type c,

        hier_name
(30) type c,

        parent
(60) type c,

       
order type i,

        iobjnm
(16) type c,

        parent_iobj
(16) type c,

     
END OF ls_hier.



 
DATA: i_appset_id(20) type c,

        lo_dataref
TYPE REF TO data,

        lo_model
TYPE REF TO if_uj_model,

        lo_dim
TYPE REF TO if_uja_dim_data,

        lt_ic_table
type TABLE OF ls_ic_tab,

        ls_hier_tab
TYPE TABLE OF ls_hier,

        ls_hier_line
LIKE LINE OF ls_hier_tab,

        ls_hier_line2
LIKE LINE OF ls_hier_tab,

         ls_ic_line
like line of lt_ic_table,

         lv_order
(32) type c,
lr_data              
TYPE REF TO data,

l_log
type string,

lt_final
TYPE REF TO data,

         lt_ic_attrlist
type uja_t_attr_name.



 
FIELD-SYMBOLS: <lt_data_im> TYPE STANDARD TABLE,

                 <lt_final>
type STANDARD TABLE,

                 <ls_data>
type any,

                 <lt_ic_line>
type any,

                 <lt_ic_mem>
type table,

                 <ls_ic>
type any,

                 <ls_nodename>
TYPE any,
<ls_hier_name>
type any,

                 <ls_iobjnm>
type any,

                 <ls_parent_iobj>
type any,

                 <ls_p2man>
type any,

                 <ls_parent>
type any,

                 <ls_order>
type any,

                 <lt_data_ex>
TYPE STANDARD TABLE.








* Assign importing data reference to field symbol

  
ASSIGN ir_data->* TO <lt_data_im>.

   i_appset_id
= i_source_info-appset_id.


* Create work area for importing data
CREATE DATA lo_dataref LIKE LINE OF <lt_data_im>.
ASSIGN lo_dataref->* TO <ls_data>.


* Create new internal table for exporting data
CREATE DATA lo_dataref LIKE TABLE OF <ls_data>.
ASSIGN lo_dataref->* TO <lt_data_ex>.






* Find the model for the appset used *

  cl_uj_model
=>get_model( EXPORTING i_appset_id = i_appset_id

      RECEIVING ro_model
= lo_model ).





   
" Read masterdata from InterCompany

  lo_dim
= lo_model->get_dim_data( 'INTERCOMPANY' ).

 
TRY.

   
CALL METHOD lo_dim->read_mbr_data

       
EXPORTING

            it_attr_list
= lt_ic_attrlist

       
IMPORTING

             er_data
= lr_data.



   
ASSIGN lr_data->* to <lt_ic_mem>.



 
CATCH cx_uja_admin_error.

      l_log
= 'Error while reading ACCOUNT dimension'.

      cl_ujk_logger
=>log( i_object = l_log ).

     
cleanup.

 
ENDTRY.

   
LOOP at <lt_data_im> into <ls_data>.

       
ASSIGN COMPONENT 'NODENAME' OF STRUCTURE <LS_DATA> TO <ls_nodename>.

       
ASSIGN COMPONENT 'HIER_NAME' OF STRUCTURE <LS_DATA> TO <LS_HIER_NAME>.

       
ASSIGN COMPONENT 'PARENT' OF STRUCTURE <LS_DATA> TO <LS_PARENT>.

       
ASSIGN COMPONENT 'ORDER' OF STRUCTURE <LS_DATA> TO <LS_ORDER>.

       
ASSIGN COMPONENT 'IOBJNM' OF STRUCTURE <LS_DATA> TO <LS_IOBJNM>.

       
ASSIGN COMPONENT 'PARENT_IOBJ' OF STRUCTURE <LS_DATA> TO <LS_PARENT_IOBJ>.

        LS_HIER_LINE
-NODENAME = <LS_NODENAME>.

        LS_HIER_LINE
-HIER_NAME = <LS_HIER_NAME>.

        LS_HIER_LINE
-PARENT = <LS_PARENT>.

        LS_HIER_LINE
-ORDER = <LS_ORDER>.

        LS_HIER_LINE
-IOBJNM = <LS_IOBJNM>.

        LS_HIER_LINE
-PARENT_IOBJ = <LS_PARENT_IOBJ>.

       
APPEND LS_HIER_LINE TO LS_HIER_TAB.

   
ENDLOOP.

   
LOOP at <lt_ic_mem> ASSIGNING <lt_ic_line>.

      lv_order
= ''.

     
ASSIGN COMPONENT 'ID' OF STRUCTURE <lt_ic_line> to <ls_ic>.

     
ASSIGN COMPONENT 'MAN_PAGE2_PAR_SPLIT' OF STRUCTURE <lt_ic_line> to <ls_p2man>.

      ls_ic_line
-ic = <ls_ic>.

      ls_ic_line
-p2man = <ls_p2man>.

     
if <ls_p2man> ne ''.

        ls_hier_line
-nodename = <ls_ic>.

        ls_hier_line
-hier_name = 'PARENTH2'.

        ls_hier_line
-parent = <ls_p2man>.

       
LOOP at <lt_data_im> ASSIGNING <ls_data>.

           
ASSIGN COMPONENT 'PARENT' OF STRUCTURE <ls_data> to <ls_parent>.

           
if <ls_parent> = <ls_p2man>.

             
ASSIGN COMPONENT 'ORDER' of STRUCTURE <ls_data> to <ls_order>.

             
if lv_order < <ls_order>.

                lv_order
= <ls_order>.

             
endif.



           
endif.

       
endloop.

           
LOOP at ls_hier_tab into ls_hier_line2

               
WHERE parent = <ls_p2man>.

                 
if ls_hier_line2-order > lv_order.

                      lv_order
= ls_hier_line2-order.

                 
ENDIF.

             
ENDLOOP.

        ls_hier_line
-order = lv_order + 1.

        ls_hier_line
-IOBJNM = '0PROFIT_CTR'.

        ls_hier_line
-PARENT_IOBJ = '0HIER_NODE'.

       
APPEND ls_hier_line to ls_hier_tab.

     
endif.

   
endloop.





   
get reference of ls_hier_tab into er_data.


endmethod.

/Chris

former_member200327
Active Contributor
0 Kudos

Hi Chris,

What package are you using: MD and attr load or Hier load?

We added a lot of records in ROUTINE BADI and never had that issue. What kind of error do you receive?

Gersh

Former Member
0 Kudos

Hi Gersh

Thanks for your response.

We are using hierarchy data manager package.

The error results in a short dump with a field symbol not beeing assigned in a piece of standard code executet right after the Badi. I am not completely sure about the purpose of this code, but it has something to do with the number of rows in the dataset.

/Chris

former_member200327
Active Contributor
0 Kudos

Hi Chris,

Do you have PARENTHn in mapping section of your MD load?

I'd recommend calling your BADI from Package for MD and attribute load. You can add there as many records as you want and assign Parent field whatever value needed. Load will adjust hierarchy.

If you still want to do it Hierarchy load for some reason can you please be more specific of where that error message is issued: class, method, statement?

Gersh

former_member191765
Active Participant
0 Kudos

Give exact error/Exception message, you can check the DUMP in ST22