on 09-05-2014 3:27 PM
Hi All,
I have a requirement of deleting the orphan nodes for one of the dimension in BPC using ABAP code.
Please let me know any standard program or classes for deleting the master data from dimension.
Regards
Pratibha Biradar
Hi Pratibha,
Here is the code to add master data, you can change the flag to 'D' to delete, i have not checked it for delete, it is working for adding.
DATA: ls_message TYPE uj0_s_message,
lt_messages TYPE uj0_t_message,
l_success TYPE uj_flg,
l_appset_id TYPE uj_appset_id,
l_dimension_id TYPE uj_dim_name,
lo_member_mgr TYPE REF TO if_uja_member_manager,
lo_dimension TYPE REF TO if_uja_dimension_manager,
lo_master_data_store TYPE REF TO if_ujam_master_data_store,
lo_context TYPE REF TO if_uj_context,
ls_dimension TYPE uja_s_dimension,
lt_errors TYPE uja_t_members_error,
lr_members TYPE REF TO data,
lr_data TYPE REF TO data.
FIELD-SYMBOLS:
<lt_member_data> TYPE STANDARD TABLE,
<ls_member_data> TYPE any,
<lv_field> TYPE any.
TRY.
lo_context = cl_uj_context=>get_cur_context( ).
cl_uj_context=>set_cur_context(
i_appset_id = l_appset_id
i_module_name = lo_context->d_calling_module
is_user = lo_context->ds_user
).
lo_dimension = cl_uja_bpc_admin_factory=>get_dimension_manager(
i_appset_id = l_appset_id
i_dimension_id = l_dimension_id
).
lo_dimension->get(
EXPORTING
if_with_hier_maxlevel = abap_false
IMPORTING
es_dimension = ls_dimension
).
CREATE OBJECT lo_master_data_store TYPE cl_ujam_master_data_store.
* creating masterdata table
lr_members = lo_master_data_store->get_table_buffer( ls_dimension ).
ASSIGN lr_members->* TO <lt_member_data>.
* Add members to <LT_MEMBER_DATA>, these are the member that will be saved.
CREATE DATA lr_data LIKE LINE OF <lt_member_data>.
ASSIGN lr_data->* TO <ls_member_data>.
* Fill each field, such as ID, and EVDESCRIPTION, update other fields here as well as
* any properties that need to be updated.
ASSIGN COMPONENT 'ID' OF STRUCTURE <ls_member_data> TO <lv_field>.
IF sy-subrc = 0.
<lv_field> = 'ProductD'.
ENDIF.
ASSIGN COMPONENT 'MBR_NAME' OF STRUCTURE <ls_member_data> TO <lv_field>.
IF sy-subrc = 0.
<lv_field> = 'ProductD'.
ENDIF.
ASSIGN COMPONENT 'EVDESCRIPTION' OF STRUCTURE <ls_member_data> TO <lv_field>.
IF sy-subrc = 0.
<lv_field> = 'Product D Update'.
ENDIF.
ASSIGN COMPONENT 'PARENTH1' OF STRUCTURE <ls_member_data> TO <lv_field>.
IF sy-subrc = 0.
<lv_field> = 'TotalProduct'.
ENDIF.
ASSIGN COMPONENT 'OBJVERS' OF STRUCTURE <ls_member_data> TO <lv_field>.
IF sy-subrc = 0.
<lv_field> = 'A'. "Version flag, should be "A" for Active
ENDIF.
ASSIGN COMPONENT 'ROWFLAG' OF STRUCTURE <ls_member_data> TO <lv_field>.
IF sy-subrc = 0.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Here you can change it to 'D' for Deleting """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
<lv_field> = 'I'. " This is an action flag, I=Insert, M=Modify """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
ENDIF.
APPEND <ls_member_data> TO <lt_member_data>. " Add to the table.
* Create member manager
lo_member_mgr = cl_uja_bpc_admin_factory=>get_member_manager(
i_appset_id = l_appset_id
i_dimension_id = l_dimension_id ).
****
* Save the members UNCOMMENT ONLY when you want to write the data!!!!!
****
* lo_member_mgr->save(
* EXPORTING
* ir_members = lr_members " List of members to save
* IMPORTING
* et_errors = lt_errors
* ).
****
* NOW PROCESS THE DIMENSION
****
DATA: ls_dimensions TYPE uja_s_dim_name,
lt_dimensions TYPE uja_t_dim_name.
CLEAR ls_dimensions. REFRESH lt_dimensions.
ls_dimensions-dimension = l_dimension_id. " Add dimensions to the list
APPEND ls_dimensions TO lt_dimensions.
lo_member_mgr->process(
EXPORTING
it_dim_list = lt_dimensions
if_set_offline = abap_false
if_validate = abap_true
IMPORTING
ef_success = l_success
et_message_lines = lt_messages ).
CATCH cx_uj_no_auth .
ENDTRY.
hope this will help,
thanks,
Rishi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Rishi,
I tried using this piece of code and its able to write the data to BPC dimension but the processing block gets in to error message. When I try to process the dimension manually, it says detected duplicate member but the id appears only once in the list. Could you please tell what is the field MBR_NAME in your code. I assume its the same as member id to be added.
Regards
Nikhil
Hi Pratibha,
You can try load the used master data only into BPC. and don't load the unused ones.
Andy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andy,
We are using 'UPDATE' option for loading the master data as it is happening in step wise process.If I would have used 'OVERWRITE' option then we wouldn't have any faced this issue which will over write every time I load the master data.
The master data in BPC will become Orphan node when you delete it in ECC system .The master data load is happening from ECC->BW->BPC.
So instead of keeping orphan nodes in BPC system,they want to delete.I am speaking regarding Cost Center master data deletion.Business is using the some cost center for some duration for specific requirement and after that they are deleting in ECC system which is becoming orphan node in BPC.
Regards
Pratibha
I had plans of writing ABAP program which will identify all the orphan nodes and check any transaction data exist with respect to that.If transaction data is not there then delete it else list out all the cost centers which has data and notify the users.
I can call this ABAP program in BW process chain and schedule it accordingly user requirement.
For deletion process I am not getting any standard program or class so that it can also take care of checking the associated transaction data.
Regards
Pratibha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vadim,
Thanks for your reply.I do know that if transaction data is associated with the master data then process itself doesn't allow me to delete.
Client has requirement of deleting master data which they are not going to use in BPC and which doesn't have any transaction data with it.Business used to manually delete the master data but they want to automate the process instead of user going and deleting.
Please suggest any best way of deleting the master data in BPC.
Regards
Pratibha Biradar
Hi Pratibha,
Still the requirements are not clear to me! In order to delete empty master data you need to create it at first OK, it's possible to have some empty master data at some moment - then you manually delete it, but what do you want to automate? How the unused master data is creating in the system?
Vadim
User | Count |
---|---|
14 | |
4 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.