OLAP variable in ABAP Routine.

In data selection of Infopackage, I have used a OLAP variable. Is it possible to access the routine for OLAP variable in a ABAP routine?? How to proceed for the same???

Hi,
There are function modules for SAP variables.
-     RSVAREXIT_variablename
-     RREX_VARIABLE_EXIT (for variables to be processed see include LRREXTOP).
Customized variables with exit can be accessed by FM EXIT_SAPLRRS0_001.
If you are able to transfer mandatory parameters, just implement call of required FM
Into report. If not, you have to copy and adopt coding desired from the FMs.
Hope this helps
Joe

Similar Messages

  • Can I use OLAP variable in ABAP Code of infoobject filter

    I have 0FISCPER infoobject in filter section of info-package while loading data.
    Below OLAP varaibles has below dynamic values that are being calculated at run time.
    0P_PRFP2 -  (Current fiscal period - 2)   ex: 2010010
    0P_PRFP1 -  (Current fiscal period - 1)   ex: 2010011
    0FPER    -    (Current fiscal period )        ex: 2010012
    I want to write ABAP CODE FOR using filter values from 0P_PRFP2 to 0FPER. (Last 3 fiscal periods - ex: 2010010 to 2010012).
    how to  use above standard OLAP variables in ABAP CODE to assign l_t_range (low or  high).

    try this using ABAP routine option (6)
    DATA: curryear(4)           type N,
                 currperiod(2)         type N,
                 prevper1(2)           type N,
                 prevyear1(4)         type N,
                 prevper2(2)           type N,
                 prevyear2(4)         type N,
                 prevfiscperYr1(7)   type N,
                 prevfiscperYr2(7)   type N,
                 prevfiscper1(3)      type N,
                 prevfiscper2(3)      type N,
                 w_length1              type i,
                 w_length2              type i.
      curryear = SY-DATUM+0(4).
      currperiod = SY-DATUM+4(2).
      If currperiod EQ '01'.
        prevyear1 = curryear - 1.
        prevper1   =  '12'.
        prevyear2 = curryear - 1.
        prevper2   = '11'.
      elseif currperiod EQ '02'.
        prevyear1 = curryear.
        prevper1   = '01'.
        prevyear2 = curryear - 1.
        prevper2   = '12'.
      else.
        prevyear1 = curryear.
        prevper1   =   currperiod - 1.
        prevyear2 = curryear.
        prevper2   = currperiod - 2.
      endif.
      w_length1 = STRLEN( prevper1 ).
      If w_length1 = 1.
        concatenate '0' prevper1 into prevper1.
      Endif.
      w_length2 = STRLEN( prevper1 ).
      If w_length2 = 1.
        concatenate '0' prevper2 into prevper2.
      Endif.
      concatenate '0' prevper1 into prevfiscper1.
      concatenate '0' prevper2 into prevfiscper2.
      concatenate prevyear1 prevfiscper1 into prevfiscperYr1.
      concatenate prevyear2 prevfiscper2 into prevfiscperYr2.
      l_t_range-low = prevfiscperYr2.
      l_t_range-high = prevfiscperYr1.
    *  modify l_t_range index l_idx from l_t_range.
    l_t_range-sign   = 'I'.
    l_t_range-option = 'BT'.
    modify l_t_range index l_idx.

  • Formulae variable confusion/ abap routine

    in ods i have data like
    Postingday................value1........value2
    1/26/10............70.................50
    1/27/10............60.................48
    12/30/10............120.................55
    12/31/10............10.................52
    now in the report for a cube i have to show data for 3 keyfigures
    1 is amount and 2nd is (Amount x Value1) 3rd is (Amount/Value2)
    now the value1 and value2 changes everyday depending on what the Date is...
    so today on 1/26/11 the value1 is 70 and value2 is 50
    so i have to write formulae variable which fetches the value1 and 2 for Todays date...
    what should be the code for customer exit for formulae variable..
    something like pseudocode below
    when "zvar1"
    FOR 0calday = today = PostingDay in ods table /bic/azpostingdte
    Seleect Value1 ..
    endfunction

    ok, you would like to do sth in the customer exits with formular variable.
    formular variable : zvar. (with customer exits)  for value1.
    case i_vnam.
        WHEN 'zvar'.
    data: l_s_table type your tablename /bic/......
          IF i_step EQ '1'.
            CLEAR: l_s_range,
            select single *  from DB table into l_s_table
            with date = sy-datum.
            CLEAR l_s_range.
            l_s_range-low = l_s_table-value1.
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            APPEND l_s_range TO e_t_range.
      endif.
    endcase.
    for value2 you do same with value1.
    PS:  for amount you must treat it as a restricted kf (with a variable of customer exits, which is gefiiled with sy-datum.)
    hope it helps you.
    Edited by: gang qin on Jan 27, 2011 9:43 PM

  • Infopackage Selections Tab-OLAP Variable/ABAP Routine

    Hi Experts
    In my Infopackage Selections Tab i had Cal Mon/Year field....
    As per my requirment i have to write a selection condion that when we execute info package (it is a monthly data load)  it will extract data only for the months greater than or equal to current month
    Please update me on how can i achieve this either by using OLAP Variable or ABAP Routine in infopackage...will be great if can provide the required ABAP Code
    Thanks in Advance

    here's an example that fills the fiscal year from last month (bold is customer code... the rest is standard):
      data: l_idx like sy-tabix.
      read table l_t_range with key
           fieldname = 'PARAM_P_GJAHR'.
      l_idx = sy-tabix.
      data:
      v_caldy type /BI0/OICALDAY,
      v_calmn type /BI0/OICALMONTH,
      v_calyr type /BI0/OICALYEAR.
      v_caldy = sy-datum.
    determine first day*
      v_caldy+6(2) = '01'.
    determine last month*
      subtract 1 from v_caldy.
      v_calyr = v_caldy(4).
      l_t_range-sign   = 'I'.
      l_t_range-option = 'EQ'.
      l_t_range-low    = v_calyr.
      modify l_t_range index l_idx.
      p_subrc = 0.

  • Pseudo delta with ABAP or OLAP variables

    Hey gurus!
    Since I have to post my first question at SDN one day, it may better be now! I'm rather new to SAP BI, therefore your help is requested:
    I'm currently implementing a pseudo delta, a full data load from ODS to ODS and subsequently ODS to Cube. The data requested should consist of yesterdays records, which was relatively easy in SAP BW 3.5.
    Since it is not possible anymore to, and I quote, choose one of the following selections in the Type (Variable Changing of Selections with Background Processing) entry column from the Data Selection tab page (numbers 0-7, 0 is required), I can now only solve it with creating another OLAP variable or ABAP coding.
    Is there anyone that can give me some advice or provide me with some basic ABAP coding which selects data from 'yesterday?'
    Your help is appreciated!
    Regards,
    Joost

    Thanks for your reply Pom!
    I'm not sure where to insert the '0' as type in my case. I've created a data transfer process instead of an infopackage now, but when setting up my filter there is nowhere to select the type. Or do I have to create an 'old fashioned' infopackage?!
    Your help is appreciated, please provide some directions.
    Regards,
    Joost

  • ABAP code for custom OLAP variables

    Hi experts,
    We have a custom variant set as customer exit that I have just added to an infopackge for the data selection of 0FISCYEAR infoobject via 7-OLAP Variant. When I click on the magnifying glass under the "details for Type" column, the "Use Variable of OLAP Processor" window appears showing the OLAP Variable and the fiscal year variant. When you hit F6 (check) it should process the variant and return data for the ranges. With this variant we are using there is not data being returned (using the SAP exit variants data is returned).
    I have gone through the forums and have seen people citing the function module EXIT_SAPLRRS0_001 as this is the user exit which houses such abap code. I have seen the variant inside this module and the code itself, but why is it in the infopackage when I click on check (F6) no data is returned? I am getting the feeling this abap code is only executed for reporting. In this case I want the infopackage to select certain data from R/3 (via the use of OLAP variable with custom code) during the load to the ODS.

    Hi Mark,
    If you created the custom fiscal year variant as a customer exit type, I doubt that it'll work.
    Variant is an auxiliary time characteristic. You cannot create it. You can only add new char values:
    BW Customizing Implementation Guide (SPRO tcode) -> Business Information Warehouse -> General BW Settings -> Maintain fiscal year variant.
    Though, maybe I misunderstood your requirements.
    Best regards,
    Eugene
    Message was edited by: Eugene Khusainov

  • ABAP Routine Variable in DTP filter

    Helllo,
    I am trying to create a routine in the Filter of DTP, so that I can only pass records that are between sy-datum and 12/31/9999 date range. In the filter are of DTP I created ABAP routine with this code:
    form compute_HE_SPCEND
      tables l_t_range structure rssdlrange
      changing p_subrc like sy-subrc.
          Insert source code to current selection field
    $$ begin of routine - insert your code only below this line        -
    data: l_idx like sy-tabix.
              read table l_t_range with key
                   fieldname = 'HE_SPCEND'.
              l_idx = sy-tabix.
              data: v_day type dats.
              v_day = sy-datum.
              l_t_range-sign = 'I'.
              l_t_range-option = 'BT'.
              l_t_range-low = v_day.
              l_t_range-high = '99991231'.
                modify l_t_range index l_idx.
              p_subrc = 0.
    $$ end of routine - insert your code only before this line         -
    endform.
    However, when I execute the DTP I get an ABAP dump TABLE_INVALID_INDEX. Do you see anything wrong with the code?
    Thank you
    Edited by: AG on Jul 10, 2009 2:31 PM

    Thanks Mr V.
    I added that part of code. So now my code looks like this:
    form compute_HE_SPCEND
      tables l_t_range structure rssdlrange
      changing p_subrc like sy-subrc.
          Insert source code to current selection field
    $$ begin of routine - insert your code only below this line        -
    data: l_idx like sy-tabix.
              read table l_t_range with key
                   fieldname = 'HE_SPCEND'.
              l_idx = sy-tabix.
              data: v_day type datum.
              v_day = sy-datum.
              l_t_range-sign = 'I'.
              l_t_range-option = 'BT'.
              l_t_range-low = v_day.
              l_t_range-high = '99991231'.
             if l_idx <> 0.
                modify l_t_range index l_idx.
              else.
                append l_t_range.
              endif.
              p_subrc = 0.
    $$ end of routine - insert your code only before this line         -
    endform.
    I do not get the ABAP dump anymore, but I still have the problem. When I run the DTP, It gets errors. In a log it says that it cannot determine the value:
    @5C@     Incorrect initial value for characteristic 0HE_SPCEND in i_t_range     @35@
    @5C@     Error while extracting from source ZHE_O03 (type DataStore)     @35@
    @5C@     Package 1 / 07/10/2009 14:43:41 / Status 'Processed with Errors'     @35@
    Am I missing something? Looks like the values still do not get assigned to the field in the filter through my routine.
    Thanks

  • Creation of OLAP Variable for Master data

    Dear BW Experts,
    How to Create OLAP Variable for Master data  in SAP BW? What is the use of OLAP Variable?

    The entry column Type (Variable) on the Select Data tabpage indicates a variable time frame in which the data should be requested. The variables are not replaced by concrete values until a request is made. There are eight options:
    Variable            Data request        Description
    0
                          Yesterday
                                            (12am – 12am)
    1
                         Last week
                                            (Monday-Sunday)
    2
                           Last month
                                            (1. (First day - last day of previous month)
    3
                           Last quarter
                                           (1. (First day - last day of previous quarter)
    4
                           Last year
                                          (01. (January 1 – Dec 31 of previous year)
    5
                      User time selection
                                               See below
    6
                       ABAP routines
                                               See below
    7
                         <b>OLAP variables</b>
                                                See below
    <b>Time selections with the help of the variables 0 to 4.</b>
    The variables 0-4 only refer to date fields of the data type DATS.
    <b>User time selection</b>
    Type 5 gives you a free selection of all fields.
    If you select this variable for a field, confirm the selection, and then choose Detail for Type, an additional dialog box appears. In this dialog box you can freely limit the values of the fields and determine the next period value and the number of periods until a repetition.
    Variables are placeholders for values and are not replaced by concrete values until a data request is made. You can also use a Variable for selections when requesting data for an InfoObject, if you choose type 7, confirm the selection, and then choose Detail for Type.

  • ABAP Routine in the Infopackage data selection

    All,
    I have requirement where i need to write a routine on a Date field(Activity Year Month) which has to return values from the first to the last day of the Previous month in the data selection of the infopackage.
    I know that on Date there is a STD that can be used but my requirement is on Year Month.
    there are 3 vartypes available
    5. free temporal selection
    6. ABAP routine
    7. OLAP variable
    when i pick ABAP routine it asks me to create a routine i need some help with the code here
    Can someone help.
    Thanks

    Hi there
    If the Data field is 0FISCPER you can use the OLAP variable 0P_PRFP1. If you have developed the field yourself i think you need to write code. The code could look something like this.
    DATA:  sysdat TYPE d.
      sysdat = sy-datum.
      sysdat4(2) = sysdat4(2) - 1.
      IF sysdat+4(2) = '0'.
        sysdat+4(2) = '12'.
        sysdat(4) = sysdat(4) - 1.
      ENDIF.
      CONCATENATE sysdat(4) '0' sysdat+4(2) INTO l_t_range-low.
      MODIFY l_t_range INDEX l_idx.
      p_subrc = 0.
    This code returns the previous months as a single value.
    Chris

  • OLAP Variable with user exit for Infopackage Selection 0fiscper

    Hi Frds/ Guru's ,
                    I have a requirement to use a OLAP Variable for Fiscal year period 0fiscper(Characteristic ) in the Infopackage Selection. . I need to extract the data for Previous Year and Current Year , that is to be automatically selected with a OLAP Variable . The standard one's provided by SAP are not satisfying my requirement,as they are getting populated with SAP Exit and I am not getting the ranges .I am planning to create a variable and use the processing type as Customer Exit and Populate it with ABAP code in respective Enhancement RSR00001.
    Even Can I create a ABAP Routine ? Please suggest me which is better to do in respect to performance of dataload  , will be really glad if anyone can provide some code for doing this as u might have faced the situation sometime .
    I have checked with all the threads available , could get some idea but will be really thankful if u gimme some hints in writing the code , at Exit level and routine level .
    Thanks,
    Krish

    thnx

  • OLAP Variable for Filter Selections in DTP

    Hi
      In BI 7.0 DTP i am using a ZZ OLAP Variable for a Filter on Location.
      How/Where i can check the values defined for that OLAP Variable and if i want to update that selection with few new values
    Thanks

    Hi,
    Please check the threads below:
    Re: Infopackage - ABAP routine or OLAP variable
    Re: How to create OLAP Variable in DEV
    Re: Infopackage - ABAP routine or OLAP variable
    Re: creation of OLAP  Variable
    -Vikram

  • Creating new OLap Variable

    Hi Experts,
    I want to create a new variable for using at data extractions. How can I do that, I tried it at CMOD but I couldn't see my variable at the OLAP Variables list how can I see it in the list ?

    How do I get the last 90days from current date in abap routine. When I go to the routine this is what comes up.
    Program conversion routine.
    Type pools used by conversion program
    type-pools: rsarc, rsarr, rssm.
    tables: rssdlrange.
    Global code used by conversion rules
    $$ begin of global u2013 insert your declaration only below this line -
    TABLES: ...
    DATA:   ...
    $$ end of global - insert your declaration only before this line   -
        InfoObject      = SHIPDAT
        Fieldname       = DELIV_DATE
        data type       = DATS
        length          = 000008
        convexit        =
    form compute_DELIV_DATE
      tables   l_t_range      structure rssdlrange
      using    p_infopackage  type rslogdpid
               p_fieldname    type rsfnm
      changing p_subrc        like sy-subrc.
          Insert source code to current selection field
    $$ begin of routine - insert your code only below this line        -
    data: l_idx like sy-tabix.
    read table l_t_range with key
         fieldname = 'DELIV_DATE'.
    l_idx = sy-tabix.
    modify l_t_range index l_idx.
    p_subrc = 0.
    $$ end of routine - insert your code only before this line         -
    endform.         
    TIA

  • Options 0 to 7(olap variable) in infopackage Scheduler screen

    Hi Pioneers,
    I've seen 0 to 7 options in the selection Tabpage of Infopackage scheduler screen(option TYPE beside a date selection).
    0(Yesterday),1(last week),2(last month)....6(Abap code),7(Olap variable).Could any one please let me know what do these options does?If  I am not wrong are these to pick data accordingly(weeek,month..).Please give me a clear picture
    Thanks in Advance
    James

    hi James
    this field is to used to populate date range field dynamically
    suppose u r loading any particular infopackage weekly for previous weeks data (monthly or daily) then u can use option 1 (2 or 0).
    but if u want u r own logic to populate this range in data selection tab for loading then u have to write routine in ABAP in option 6.
    Message was edited by:
            Arun Purohit

  • Problem in OLAP Variable for InfoPackage

    Hi All ,
    My requiremnt is to get all the Blank values for VERSION field from the R/3 to BW .
    So I created a OLAP variable and given that variable in the InfoPackage.
    code i written is
      IF p_vnam = 'ZS_BLKVR'.
        CLEAR: l_s_range.
        l_s_range-sign  = 'I'.
        l_s_range-opt  = 'EQ'.
        l_s_range-low   = '' .
        l_s_range-high  = '' .
        APPEND l_s_range TO p_t_range.
        CLEAR: l_s_range.
      ENDIF.
    Now when iam loading data in BW , it is giving zero records , but there are records in r/3 with blank values for VERSION field.
    in the selection critria it is displaying as '#' for Version in the monitor.
    So is there any other way to get the Blank values VERSION records from R/3
    Thank You.....

    Hi Ravi,
    You can write an ABAP routine to populate the VERSION field. Choose type '6' from the drop-dwon and try the following code,
    loop at l_t_range into l_s_range where fieldname = 'VERSION'.
      l_s_range-low = ' '.
      modify l_t_range from l_s_range.
    endloop.
    If it doesn't work then try to use the other way round. Find out what are the non-zero values possibel for version and exclude all the values from the selection.
    Hope it helps.
    Thanks,
    Soumya

  • ABAP Routine in UR Help

    Hi Friends
    We are on BI7 and ECC6.
    We have to get the quantities into BI from ECC for that we are using one field from 2lis_11_vaitm. But we want to count the quantity only when material is a complete package all other values should be 0. Packages are described in the material as for example DMS PACKAGE , DST PACKAGE , DTTS PACKAGE DTTTT PACKAGE.
    Now My thinking is ,Inorder to do that we have to use the offsets in ABAP routine. But the first few letters are not 3 / 4 fixed it may be 3, 4, 5 or 6 letters the PACKAGE will start from the next word..
    Can any one help me how to write the ABAP logic to get the offset for last 11 letters ?
    regards

    F2 & F3 TYPE I.
    F1 = 'DTTS PACKAGE' (F1 contains the value)
    F2 = LENGTH(F1) (F2 determines the length of the field)
    OR
    F2 = STRLEN(F1)
    F3 = F2 - 11 (F3 determines the difference)
    F4 = F1+F3(11) (F4 picks up value based on offset)
    *Not sure if variables are accepted for offsets.

Maybe you are looking for

  • Drop-down in JSP using a bean as back-end

    Hi everyone, I like to create a dynamic drop-down (reading from a database) using JSP but accessing a bean. My code on the bean is: public void DepartmentName() { try stmt1 = tConnection.createStatement(); rs1 = stmt1.executeQuery ("select DEPT_NAME

  • The import org.fin.app cannot be resolved

    Hii.. i have added a new project to the exixting fine working project and added new java files. But i cant access some packages of old projects from within these new java files as i get the error "The import org.fin.app cannot be resolved". I have se

  • How to restict the standard f4 values in ALV?

    I added standard F4 values to the werks field ( ref_field = WERKS and ref_table = T001W ). It displays all the plants in the system. but the user wants to see only certain series of plants. how toa chive this without using custom F4? (With custom F4

  • Iphone turned off when i plugged it in to a docking station and won't turn back on

    i was going to listen to some music on my vivo docking station and my boyfriend put his iphone on the docking station and his phone just turned off and wouldnt turn back on i put mine in and the same happend.. anyway my boyfriend called apple and spo

  • HT3702 $1 credit card payment x 2

    Hi everyone, I created an Itunes account and a $1 payment appears twice in my credit card, even though I have not purchased anything yet.  I was wondering if this is just to confirm the credit existence and if it's going to be refund at some stage? C