Skip to Content
author's profile photo Former Member
Former Member

Copy one dimension to other in the same Application

Dear Experts,

I need to create a new dimension as a copy of one dimension inside App_set (yes, two dimensions with same data), I think about implement a BADI like this:

Time dimension & BAdI

But really I'm not sure what happens in this code. I'm in a good way or I need to change my point of view?. Anyway, can somebody help me with my problem?

Many thanks.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Oct 21, 2010 at 01:50 PM

    Hi Roger,

    If you are trying to copy dimension in the same appset, then you can use the copy dimension feature.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Solved.

       
        lo_context = cl_uj_context=>get_cur_context( ).
        lo_model = cl_uj_model=>get_model( i_appset_id = lo_context->d_appset_id ).
        lo_dim_origin = lo_model->get_dim_data( 'Dimension7' ).
      
        lo_dim_post = lo_model->get_dim_data( 'Dimension8' ).
      
      " Leémos los datos de la dimensión origen
        CALL METHOD lo_dim_origin->read_mbr_data
          EXPORTING
           " if_ret_hashtab = abap_true
            "if_sort        = abap_true
            "if_inc_txt     = abap_true
            if_only_base = abap_false
          IMPORTING
            er_data        = lr_data.
        ASSIGN lr_data->* TO <lt_dim_mbr>.
      
        if lines( <lt_dim_mbr> ) = 0.
          return.
        endif.
      
      " Escribimos los datos de la dimensión destino
        CALL METHOD lo_dim_post->write_mbr_data
          EXPORTING
            i_key_date   = sy-datum
            it_md        = <lt_dim_mbr>
            if_overwrite = abap_true
          IMPORTING
            ef_success   = lf_success
            et_message   = lt_msg.
      
        IF lf_success = abap_false.
      
          RAISE EXCEPTION TYPE CX_UJ_CUSTOM_LOGIC.
      
        ENDIF.

      Edited by: Roger Peruchet on Oct 25, 2010 6:31 PM

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.