Skip to Content
author's profile photo
Former Member

ABAP ROUTINE in the Infopackage ~ "Data selection"

Hi Experts,

I have a situation where i need to load data from the ODS to a new cube for the last 13 months only. While i searched on SDN, i came across other discussions where they suggested "OLAP Variables". How do these olap variables work ? Is it better to go with ABAP routine or the olap variables ? I'm not an abaper, is there any code or documentation out there that you can assist me with for the routine. Please advise.

Thank you,

Tia

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • author's profile photo
    Former Member
    Sep 30, 2005 at 01:23 PM

    Hallo Tia

    there are some standard OLAP variables which you can use and they return the value without anycoding. More or less the same formthe performance side.

    I can give you an example of abap routine:

    DATA: l_idx LIKE sy-tabix.

    READ TABLE l_t_range WITH KEY

    fieldname = 'CALDAY'.

    l_idx = sy-tabix.

    *....

    DATA: 10days TYPE sy-datum.

    10days = sy-datum - 10.

    MOVE 10days TO l_t_range-low.

    MOVE sy-datum TO l_t_range-high.

    MOVE 'I' TO l_t_range-sign.

    MOVE 'BT' TO l_t_range-option. (you can use for example EQ - in this case valorize only l_t_range_low)

    MODIFY l_t_range INDEX l_idx.

    p_subrc = 0.

    I use that routine to load always the last ten days.

    in case of OLAP Variable - you can also write down code in transaction CMOD like when you have a variable Customer User Exit. but as i said you can also have standard SAP which are already coded.

    I hope this help you.

    if you want to put down the code, then use the ABAP Routine.

    Regards

    Mike

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thank you so much, Mike. This really helped us and go back on track with the thought process. We took this as a base and changed some to give me the year, month and date so that if we are in Dec and i want last 13 months data it should go to Nov of 2003.

      We did this, please have a look and give me your thoughts.

      DATA: L_month(2),

      L_year(4),

      L_newdate like sy-datum.

      L_year = sy-datum(4).

      L_month = sy-datum+4(2).

      if L_month = '01'.

      L_year = L_year - 2.

      L_month = '12'.

      else.

      L_year = L_year - 1.

      L_month = L_month - 1.

      endif.

      L_newdate(4) = L_year.

      L_newdate+4(2) = L_month.

      L_newdate6(2) = sy-datum6(2).

      MOVE L_newdate TO l_t_range-low.

      MOVE sy-datum TO l_t_range-high.

      MOVE 'I' TO l_t_range-sign.

      MOVE 'BT' TO l_t_range-option.

      *l_t_range_low)

      modify l_t_range index l_idx.

      p_subrc = 0.

      $$ end of routine - insert your code only before this line -