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.

Similar Messages

  • How can we  use java variable in javascript code on JSP page?

    How can we use java variable in javascript code on JSP page?
    Pls help

    Think about it:
    JSP/Java is executed on the Server and produces HTML+JavaScript.
    Then that HTML+JavaScript is transfered to the client. The client now interpretes the HTML+JavaScript.
    Obviously there's no way to access a Java variable directly from JavaScript.
    What you can do, however, is write out some JavaScript that creates a JavaScript variable containing the value of your Java variable.

  • How can I use environment variables in a controller?

    Hi all,
    How can I use environment variables in a controller?
    I want to pass a fully qualified directory and file name to FileInputStream and would like to do it by resolving an env variable, such as $APPLTMP.
    Is there a method somewhere that would resolve this??
    By the way,Did anyone used the class of "oracle.apps.fnd.cp.request.RemoteFile"?
    The following is the code.
    My EBS server is installed with 2 nodes(one for current,and other is for application and DB).I want to copy the current server's file to the application server's $APPLTMP directory. But the result of "mCtx.getEnvStore().getEnv("APPLTMP")" is current server's $APPLTMP directory.
    Can anyone help me on this?
    private String getURL()
    throws IOException
    File locC = null;
    File remC = new File(mPath);
    String lurl = null;
    CpUtil lUtil = new CpUtil();
    String exten;
    Connection lConn = mCtx.getJDBCConnection();
    ErrorStack lES = mCtx.getErrorStack();
    LogFile lLF = mCtx.getLogFile();
    String gwyuid = mCtx.getEnvStore().getEnv("GWYUID");
    String tmpDir = mCtx.getEnvStore().getEnv("APPLTMP");
    String twoTask = mCtx.getEnvStore().getEnv("TWO_TASK");
    // create temp file
    mLPath = lUtil.createTempFile("OF", exten, tmpDir);
    lUtil.logTempFile(mLPath, mLNode, mCtx);
    Thanks,
    binghao

    However within OAF on the application it doesn't.
    what doesnt work, do you get errors or nothing ?XX_TOP is defined in adovars.env only. Anywhere else this has to go?
    No, it is read from the adovars.env file only.Thanks
    Tapash

  • Using jsp variable in java code

    Hey guys,
    I need some help hope you guys can help me.
    I've declared a variable "error" in a jsp. how do I access this variable in the java code whice resides in the same jsp page.
    I know I can use java variable in jsp code using
    <%= sVariable %>
    where sVariable was declared in the java code. but how do I access a jsp variable in java code??
    Thanks very much in advance

    Thanks for the reply.
    This is what I want to do.
    I've declared a variable "error" using <c:catch var="error">I want to check the value of this variable and suppose if it contains XYZ (error variable will have a long string so I just want to check if it contains a specific value) I want to do step1 and if the variable of error is not XYZ I want to do step 2
    Problem is I dont know how to check if error contains the XYZ in jsp thats why I thought java code would help here.
    Can you guys suggest a better way to solve my problem.
    Thanks again

  • Can we set password to our abap code

    can we set password to our abap code. so that no one can edit it.

    Hi,
    REPORT YEDULOCK.
    * This program switches the editor lock flag of a given ABAP program.
    * It can be useful when the owner of the ABAP is on holiday ...
    TABLES: TRDIR.
    PARAMETERS: PRG_NAME LIKE TRDIR-NAME.
    SELECT SINGLE * FROM TRDIR WHERE NAME = PRG_NAME.
    IF SY-SUBRC = 0.
      IF TRDIR-EDTX = ' '.
        TRDIR-EDTX = 'X'.
      ELSE.
        TRDIR-EDTX = ' '.
      ENDIF.
      MODIFY TRDIR.
      IF SY-SUBRC = 0.
        WRITE: / 'Successful switch.'.
        COMMIT WORK.
      ELSE.
        WRITE: / 'Failed switch.'.
      ENDIF.
    ELSE.
      WRITE: / PRG_NAME, ' does not exist.'.
    ENDIF.
    Regards
    Sudheer

  • Can we use Substitution variables in MAXL?

    Hi,
    Can we use substitution variables in MAXL script?
    I have to run this MAXL command for clearing a slice of ASO cube on V11.1.1.3.
    alter database Apname.DBname clear data in region 'CrossJoin({[2009]},{[Dec]})';
    I am planning to use Current_year & Current_month variables instead of hardcoding 2009 & Dec as I have to use this everymonth to clear the current months data.
    If it is allowed, what is the syntax?
    Is there any alternative apart from substitution variables?
    Appreciate your thoughts.
    Thanks,
    -Ethan.

    You would just use ampersand and the variable name instead of the hard coding e.g. &yearVar &periodVar.
    Not tried it on aso clears but in theory it should work as ...'CrossJoin({&yearVar},{&periodVar})';
    just change yearVar and periodVar for your substitution variable names.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Can we use repository variables in bi publisher like in anwers

    can we use repository variables in bi publisher like in anwers
    if possible then how

    Yes,
    but you should be using Oracle BIEE as Datasource in order to use the variable of repository
    you 'll have to follow this syntax: valueof("variable")

  • How can we use Session Variable in Answers or Analysis?

    How can we use Session Variable in Answers or Analysis?

    Again, duplicate cross-posting!
    See rukbat 's post here: Re: BI Apps 7.9.6.3(Agent Issue)

  • How can I use the Variable Delay VI (From DSP Module) to Deploy Variable Delay on Speddy-33

    Dears,
    I dont Understand How Can I Use the Variable Delay to Deploy Variable Delay on a Speedy-33 Kit

    Hello,
    Thank you for posting to the NI Forums!! You should be able to incorporate the Variable Delay.vi into your vi and then build as normal and the functionality of the vi should translate to the build. What type of build are you doing? Are you receiving any specific errors? Thanks!
    Regards,
    Margaret Barrett
    National Instruments
    Applications Engineer
    Digital Multimeters and LCR Meters

  • How can i use substitution variable

    Hai All
    This is my sql statement
    SELECT (TO_DATE(TO_CHAR(Intime,'DD-MON-YYYY')||' '||
    TO_CHAR(0815,'0000'),'DD-MON-YYYY HH24:MI')-intime) * 24*60
    from dail_att where to_char(intime,'hh24mi') between 0700 and 0815 ;
    Here my table name called Dailyattendance
    Intime field is declared as Date Type
    So now i have hardcoded 0815 and now my intime is subtracted from this time so i can calculate the employee
    coming late so how can i use substitution variable here to give the value at run time
    Ie i need to give 0815 instead or any other time at runtime
    Thanks In advance
    Srikkanth.M

    Where exactly are you planing to use it? Is sqlplus or at any other front end?
    One way is to use below given SQL
    SELECT   (  TO_DATE (   TO_CHAR (intime, 'DD-MON-YYYY')
                         || ' '
                         || TO_CHAR (:TIME_VAR, '0000'),
                         'DD-MON-YYYY HH24:MI'
              - intime
           * 24
           * 60
      FROM dail_att
    WHERE TO_CHAR (intime, 'hh24mi') BETWEEN 0700 AND 0815;*009*
    Edited by: 009 on Apr 6, 2010 2:15 AM

  • Can ODI use environment variables?

    Running on Linux/Unix, can ODI use environment variables? For example, export LANGUAGE="en", and anyway in ODI can get variable LANGUAGE?

    It is easy.
    Use the following command at variable Refresh tab and let the Logical Schema to the file too...
    Just change the file path (c:/temp/cezar_test.txt)
    Select COLUMN_1 from TEST
    /*$$SNPS_START_KEYSNP$CRDWG_TABLESNP$CRTABLE_NAME=TESTSNP$CRLOAD_FILE=c:/temp/cezar_test.txtSNP$CRFILE_FORMAT=DSNP$CRFILE_SEP_FIELD=3BSNP$CRFILE_SEP_LINE=0D0ASNP$CRFILE_FIRST_ROW=0SNP$CRFILE_ENC_FIELD=SNP$CRFILE_DEC_SEP=SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=COLUMN_1SNP$CRTYPE_NAME=STRINGSNP$CRORDER=1SNP$CRLENGTH=50SNP$CRPRECISION=50SNP$CR$$SNPS_END_KEY*/
    For this command the file must to have just just the value in one line.
    Does it help you?
    Edited by: Cezar Santos on 23/01/2009 16:14

  • How can I use a variable in BEx of type date ?

    Hello,
    I have an infoprovider with a key figure of type "date" and I want to display for example all the data where the date is lower than a date entered by the user.
    So I want to create for that a date variable and use it in conditions.
    When I try with "manual entry", I can't get the type "date" : it proposes quantity, amount, number but not date.
    When I try with "customer exit", I can get the type "date" but when I get it on the selection screen, the date is seen as a number so it doesn't work.
    Does anybody have an idea.
    Thanks for your help.
    Regards,
    Vanessa Roulier

    Hi!
    if you are using a cube then there will be at least one time char. I think you can just add 0calday to your cube , even if you are not filling it.
      Once this is available in cube  it can be used in query (free chars) where we can define a variable on this 0calday. But we it will not have any effect on query results as you are not storing anything in your query.
    then in your conditions you create a variable with USEREXIT type. then in your ABAP code you can access the value stored in variable(which is entered by user) and copy it to the USEREXIT variable. Then your condition works because it is having a date type and the value is date.
    I don't see any problem in implementing this scenario.
    with regards
    ashwin

  • 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

  • Can i use a variable instead of a fixed TextField?

    Hello
    I have to set the readOnly property to some set of fileds DYNAMICALLY (i mean, until run time, i dont know Which fields are readOnly and which are not? based on TYPE (Manager, Officer, Clerk....) of user...i hv to set it .
    So, i want to replace the TextField1 dynamically with all the fileds in the below syntax. So, can i put some variable in the position of TextField1? if so, How can i do that?
    xfa.resolveNode("VISITOR.Page3.SubFrom1.TextField1").access = "readOnly";
    xfa.resolveNode("VISITOR.Page3.SubFrom1.MyVariableComesHere").access = "readOnly";
    In ABAP, it looks lik below,
    LOOP AT it_readOnly_fields_itab INTO wa_readOnly_fields_itab.
      xfa.resolveNode("VISITOR.Page3.SubFrom1.wa_readOnly_fields_itab-FieldID").access = "readOnly";
    ENDLOOP.
    Pls. let me know the EQUILANT code (of above ABAP 3 lines code) in Java Script
    How can i put the variable in the red position?
    THank you

    Sorry, am not looking that!!
    Say, i have 5 fields, then, i want to make them readOnly, then i hv to write as below,
    xfa.resolveNode("VISITOR.Page3.SubFrom1.TextField1").access = "readOnly";
    xfa.resolveNode("VISITOR.Page3.SubFrom1.TextField2").access = "readOnly";
    xfa.resolveNode("VISITOR.Page3.SubFrom1.TextField3").access = "readOnly";
    xfa.resolveNode("VISITOR.Page3.SubFrom1.TextField4").access = "readOnly";
    xfa.resolveNode("VISITOR.Page3.SubFrom1.TextField5").access = "readOnly";
    Actually, my requirement is differnent (I know at run time only...that Wht wht fields i hv to set readOnly and wht wht fields should okay for input enable), for that reason i want to use a VARIABLE in the 'position' of TextField1, TextField2.....like bleow
    var myVariable
    myVariable = TextField1
    LOOPing the ARRAY
    xfa.resolveNode("VISITOR.Page3.SubFrom1.myVariable").access = "readOnly";
    PLs. let me know Can i sue a variable like that? if so, what is the correct syntax (pls.  suggest me a SYNTAX error free code, bcz am very very beginner to this)
    THank you

  • Using BAPI's in ABAP code

    Hi bapi Guru's,
    I am asked to use bapi's(Instead of BDC's) for data upload .I am not getting good documentation on 'USING BAPI's IN ABAP',Like Defining structures, and what are the FM's to be called like bapi_commit.
    Any Info is Appriciated.
    Regards
    satish

    Sorry Satish,
    Maybe this is going off topic a little, bit perhaps also its relevant as you have been asked to move from BDC's to BAPIs.
    Juan,
    When I talk about debugging, there are two levels to this:
    <b>1. Debugging by the programmer</b>
    In this case, how can it be easier to debug an error from a BAPI than from the screen?  For a sales order, for example, when you enter a delivery date of 01.01.2000 for an item, via BDC you will get an error message as the item is entered (something along the lines of delivery date is in the past), and you will see exactly the date you have entered, and if you don't understand the error, you can click on F1 and it will give you the long description of the error.  Via a BAPI, you would get the error message, and you MIGHT get the item number and the date in question.  But if you don't understand the error what do you do then?  Debug the BAPI itself?  You could, but isn't this a rather lengthy way to get to the root of the problem?  In general, any errors you get calling BAPIs/BDCs are errors with your master data, or breaking business rules, you shouldn't have to debug standard code to tell you whats going wrong, the application can tell you.
    <b>2. Debugging by the end user</b>
    When you implement a BAPI/BDC this will be related to an interface/automated transaction etc.  When its in production you will occassionally get errors (due to bad master data, not fully capturing all the business logic in your custom coding [it happens], technical issues etc.)  What do you do then?  In the case of BDC you can do nothing.  The error is recorded, and you can get end users to process the errors by stepping through the screens (which they already know how to use) and make corrections as required.  In the case of BAPIs, you have to record the error in a table or a file, then develop some kind of interface to display the errors, then develop some kind of process for re-processing the errors.  If the data used to call the BAPI is not correct then you also need to provide a facility for changing the data before reprocessing.  Normally you do none of this because its too much work and you end up having all errors coming back to the SAP team who have to debug and change table entries etc. to get it all to work.  I would not say that this makes BAPIs easier to debug.
    Oops, just realised my pasta is burning!!!
    Anyway, think I got my point across.  Not personal but feel quite strongly about this topic.  To me BDC's are still a relevant tool despite the push for Idocs/BAPIs.
    Cheers,
    Brad

Maybe you are looking for

  • Mac OS 10.5.6 update not loading

    Software update alerted today that 10.5.6 was available for download, so I downloaded it. After going through the required restart, the update started to load but then just hung there. The blue bar only moved about 1/4 of an inch for 10 minutes, so I

  • My photos dont appear in iphoto

    Yesterday I downloaded some 1700 photos from my Android phone to my MacBook Air. I chose to have the photos copied to iPhoto. Now this morning when I opened iPhoto, it show spaces for where the photos are but only little grey thumbnails and I cannot

  • Urgent 922 negative stocks and no open posting changes (LU04)

    Hello Guys, I will really appreciate your help to this problem: I have in LX02 the figure shown below for a specific material over all storage types. I dont have open posting changes in LU04. All what I physically have are 9 pieces in 915 as shown be

  • PowerBook G4 PC Card slot

    I see that my PowerBook has a PC slot, but what kinds of cards go in there? What are the options? Where can I browse the choices? I have a PowerBook G4 running the latest and greatest system. Thanks in advance!

  • DMA "Acquire Read Region" method

    I've been meaning to ask this question for a while now. I just came across the FPGA method mentioned in the title of this post.  I understand it gives a DVR pointing to the actual memory range for a DMA transfer but I have some questions regarding th