Variable default values

Hi Experts,
I am using a variable for Date From to Date to in my Query.  I had used the variable 0I_SPL_D which supplies two date Period from / Period To. My requirement is to give default values at run time from beginning of the month to current date of execution.
So that I can schedule the Query and Broadcast it.
eg If the report is run today ie on 22.0ct.2009 then both the ends must have the values
from date 01.10.2009 and
to date     22.10.2009
If the report is executed tomorrow the parameters should be
from date 01.10.2009 and
to date     23.10.2009
can any one give any idea
Thanks
Shivani

Hi,
Try this code.
WHEN 'Zvariable'
DATA: from_dy(2) type n,
           from_mo(2) type n,
           from_yr(4) type n,
           from_d(8) type n,
           Date_to TYPE sy-datum.
    IF i_step = 1.
      from_dy(2) ='01'.
      from_mo = sy-datum+4(2).
      from_yr = sy-datum+0(4).
      concatenate from_yr from_mo from_dy into from_d.
      Date_to = sy-datum.
      CLEAR l_s_range.
      MOVE from_d TO l_s_range-low.
      MOVE Date_to TO l_s_range-high.
      MOVE 'I' TO l_s_range-sign.
      MOVE 'BT' TO l_s_range-opt.
      APPEND l_s_range TO e_t_range.
    ENDIF.
Regards,
Rk.

Similar Messages

  • BW Query variable default value put in Crystal report variable question

    Why BW Query variable default value put in Crystal report variable for BO InfoView to open crystal report.
    I using Analyzer to open bw query,variables had default value ,but crystal report can't had variable default value ,and can't search variable  value.
    pho:
    [http://file.itpub.net/f/e38876ad4f6efb7e73980488e7d71f8d/4ae940e9/day_091029/20091029_2b04da1232144feba180OrB23SNvXtoT.gif/p/1.gif]
    [http://file.itpub.net/f/d93ddfe61e0eaf80429726c61f1a02ff/4ae940e9/day_091029/20091029_3211ffe04bf0302fbab5FRKnbwmH80p7.gif/p/BW_QUERY_Crystal.gif]
    Edited by: flying on Oct 29, 2009 8:20 AM

    I Know what to do .
    but Crystal report date variable value are Garbage characters "###".
    PHO:
    [http://file.itpub.net/f/39a8510104476707ae21c945db93ecba/4ae97949/day_091029/20091029_32dcbb7e7d99141483aesJ9KBJHXN0Kj.gif/p/2.gif]

  • How to set variable default value by program?

    Dear all,
    We would like to set a BW variable default value by program (not using query designer).
    Do you have any ABAP sample code for this? I'm really new in ABAP programming.
    we are using BI 7.0
    Thank you for your help!
    Olivier DESFOUR

    Hi Olivier,
    FOllowing is the code which defaults calmonth to first month of the year to current month - 1.
    Data : input1(4) TYPE n,
           input3(2) TYPE n.
    WHEN 'YQV_FD'.
      if i_step = 1.
      input1 = sy-datum+0(4).
      concatenate input1 '01' into l_s_range-low.
      input3 = sy-datum+4(2) - 1.
      concatenate input1 input3 into l_s_range-high.
      l_s_range-sign = 'I'.
      l_s_range-opt = 'BT'.
      APPEND l_s_range TO e_t_range.
      endif.

  • BEx Variable default value does not pass thru to Webi report

    Hi,
    It appears that the integration between BEx and BOBJ Webi does not support default values when the webi report is scheduled.  This means that if Webi/Infoview is the delivery method, than clients require 2 reports.  1 for adhoc and 1 for scheduling.  Is there another way around this so 2 reports are not required?  See SAP Knowledge Base Article  https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/sno/ui_entry/entry.htm?param=69765F6D6F64653D3030312669765F7361706E6F7465735F6E756D6265723D3030303136363534393826
    Regards,
    Dae Jin

    Hi,
    Yes it is not supported. you can achieve by writing customer exit for this.
    in istep 2,
    check whether the variable value is intial.
    if intial
    pass default value
    if not intial (else)
    dont do any change, just pass the user input to restriction.
    -Sriram

  • Local variable default value

    Hi
    Just a quick question to get me out of a hole..... I am using local variable to control while loops, and based on a counter value, it turns it on or off. When i probe the value of the actual boolean, it comes up not exectuted, but the local indicator value is true???? is there any way to change this?? i need to to remain false, UNTIL it goes true!
    Cheers
    Peter
    Solved!
    Go to Solution.

    I think that "Ravens" has hit the nail on the head. Using unprotected shared resources (like local variables) in parallel will open the door to race conditions... the bane of any programmers life!
    Here are some useful resources which further explain this concept.
    Using a Local, Global, or Shared Variable in Parallel Loops Can Cause Race Conditions
    http://digital.ni.com/public.nsf/allkb/4F3CC921B4179F9F86256A3B0045CE2D
    Tutorial: Local Variable, Global Variable, and Race Conditions
    http://zone.ni.com/devzone/cda/tut/p/id/7585
    The first link also mentions the producer/consumer articeture and the semaphore. Both great solutions. However, correctly sequencing your source code (using things like error clusters) will help prevent this issue.
    Further more, I wonder if you are initialising your variables??
    You should write a value of false to the variable before you enter the main body of your code. This ensure that the first time you read from the variable it will return a known value (false). If you dont do this, the variable will return what ever was the last value written to it.
    Hope this has been useful.
    Rich R
    Applications Engineer
    National Instruments UK & Ireland

  • Global variable default value

    Hi All.
    I am running Test Stand 3.5 scripting Labview 7.1 vi's to test batches of populated PCB's (using single pass method). On each initial run of aTest Stand session the test site cables need to be calibrated and the values stored for later use. i.e calibrate the site just the once per session.
    I have tried using both a boolean station global and boolean sequence file global and setting them to 'True' when calibration is finished. However the sequence file global defaults to 'False' at the end of each run, (hence cuasing a calibrate each run). and the station global stays 'True' even after the session is ended and Test Stand is closed down. ( hence next session calibration routine is ignored).
    Is there a way to either  a) stop the sequence file global defaulting to 'False' after each 'single pass' run yet default to 'False' on Test Stand shutdown. Or b) default the station global to 'False' on Test Stand shutdown? either method would be OK.
    Any help would be appreciated.
    Thanks
    Ian R

    Thanks anyway but I just found I need to set the sequence file global properties to 'Shared at run time'.
    Cheers

  • Default value of BeX customer Exit variable not Displayed in WeBI??

    Hello Experts,
    We are stuck with a problem where WeBI report is created on top of BeX query and we are not able to see the default value of Bex Customer exit variable in WeBI run. Here is the complete scenario:
    1. One restricted KF is created in BeX, restricted with Customer exit variable on net Due date. And this variable is mandatory, ready for input, and Default value in calculated is user exit as current Week's Monday.
    2. So, by default KF data should be restricted to Monday of current week, if user does not change this value.
    3. Now, WeBI report is created on top of this Bex query, and all is working fine, i.e. we are getting variable as Prompt in WeBI, but Default value is not shown while Running the Webi Report.
    So, need your inputs on the same, if default values from BeX in WeBI is supported or not? If yes, why this is happening, and how to resolve it?
    Please notice, the restrcition is in KF only, it is not a separate restrcition on Net Due date in Filter area or in Defualt area of BeX
    and we are on SAP BW 7.1 and BOXI 3.1 SP4.
    Regards,
    Vipul
    Edited by: VIPUL GOYAL on Nov 23, 2011 9:44 PM

    Hi,
    See 1285993 - Support of Customer Exit Variables from BEx query into WebIntelligence via OLAP universe
    WebI will prompt when executed, but the default values calculated by the user exit  - do not appear.
    Note: If the BEx variable has property 'ready for input' set / enabled, then its WebI prompt shows ok, but no default value appears.
    Cause
    This behaviour expected 'by design' (in the context of the product's current limitations) as explained in the online guide below:
    Please refer to Chapter 7, page 44, document link here: http://help.sap.com/businessobject/product_guides/boexir3/en/xi3_sap_olap_universes_en.pdf
    Characteristic variable > processing type > Customer Exit  is "Supported, without user entry"                                                                               
    -->  This should be understood as meaning "User will not be shown a prompt"
    regards,
    H

  • Default Value in Formula Variable - Inconsistent behaviour

    Hi,
    I am facing a very strange issue in a formula variable.
    I had created three formula variables with default values and the user (Power user who has the Bex access) was able to change the default value themselves for two of these variables.
    Now he wants to change all the three, so I have tried to check the issue and changed all the three for testing purpose.
    Now, he is unable to change any of them!!! Sad, now I cant even say that "You dont have the Auth to do so"
    Any clue? Anyone has faced similar issue.
    Any thoughts are highy welcome! Suddenly users wants to get this one URGENTLY, usually he used to access the report once in month. Now he wants to use the same once in half an hour
    We are on BI 7.0 with SP 24
    Any thoughts PLS
    Regards

    hi,
       probably you can refer to SAP Note 1413030 - SAPBWNews NW 7.x BW Add-On Frontend Patch 1300 - GUI 7.10 or maybe  SAP Note 1294382 - SAPBINews NW7.0  BI Add-On Frontend SP900 - GUI 7.1 that might help you in sorting out your problem, plus you can buy more time from the user as well
    regards
    laksh

  • Default value in recordset variable

    Hi,
    I am using Dreamweaver 8.
    I am not sure that I understand the function of the default
    value in the variable area of the recordset. I'm using a search box
    and sending the result on through the url. If the person types
    something that is not in either of the two fields searched, is the
    default value supposed to kick in? I have tried entering a value of
    something that is actually in the field, but get a broken image
    (x)...I'm displaying images.
    What I would actually do is to display an error message on a
    different page. Is there a SQL statement that could be put after
    the search statement such "if not....go to url or
    something"? If not, I was thinking of creating a blank
    image with wording stating that there was no match.
    Current recordset code:
    SELECT*
    FROM images
    WHERE description LIKE %colname% OR picturenum = colname2
    ORDER BY picturenum ASC
    Name:colname
    Type:Text
    Default Value: montana (an actual word in the database)
    Run-Time Value: $_GET['description']
    Name:colname2
    Type:Text
    Default Value: A091 (an actual image in the database)
    Run-Time Value: $_GET['description']
    Current code works perfectly thanks to some direction by
    David Powers....thanks David.
    Any help would be appreciated.
    Thanks,
    Cliff

    The best way to accomplish this is to build the WHERE clause dynamically, or else have a different WHERE clause that you use in these situations. In other words, test the value of the querystring variables and if they are empty,  use a different WHERE clause that does not include the address  condition.
    Also, this question belongs in the app dev forum.

  • OBIEE 11g Prompt's default value doesn't work with a presentation variable

    Hi, I'm using OBIEE 11g and I have two dashboard prompts (Product Name and Product Number). Theses prompts are hierarquical, so the values that are displayed in the Product Number prompt have dependency with the values chosen on the Product Name prompt. This I was able to do, but now I want to put a default value on the Product Number prompt. The steps are:
    1 - The user chooses the value for the Product Name Prompt and by doing that the Product Number prompt is automatically filled with the correspondent value.
    But unfortunatelly this is not working, after choosing the value for the Product Name the default value for Product Number is not displayed (when you open the prompt the values displayed are correct and already filtered considering the Product Name but the prompt is not automatically filled with the default value).
    What I did is:
    On the Product Name Prompt I've created a Presentation Variable called PROD.
    On the Product Number Prompt I've selected:
    1 - For the "Choice List Values" field I've checked the option "Limit Values by All Prompts"
    2 - For the "Default Selection" field I've chosen the SQL Results option and enter the following SQL:
    SELECT "Products"."Product Number" FROM "Sample Sales Lite"."Products" WHERE "Products"."Product"='@{variables.PROD}
    What am I doing wrong?
    Thank you,
    Carla

    Sorry I was wrong in my previous thread.
    Actually your approach is not correct, Product Number choose constraint that will show as per the selection of Product Name.
    Coming to default value for Product Number you are going for sql override that is okay but not work with variable, instead of setting default values for product number set that to product name.
    if not you need to go for 2 different prompts
    Prompt 1 Product Name hit GO
    Prompt 2 will work based on as you defined earlier with variables
    Hope this helps

  • How to use SYSDATE as a default value of a bind variable in a query report?

    Hi,
    I want to use SYSDATE as default value for a bind variable in Query based report.
    I don't see any way to do it, someone helps?
    Thanks a lot.
    Paulo.

    You can aslo use #sysdate directly.
    Hi,
    The way I'm doing in my report is, I have a database function (f_ret_sysdate) with the following code
    create function f_ret_sysdate return varchar2
    begin
    return to_char(sysdate,'mm/dd/yyyy');
    end;
    Now, in the 'Customization Form Display Options' section of the report I'm calling this function as #f_ret_sysdate in the default value field of corresponding bind variable to display SYSDATE with the format.
    Hope this helps!...
    -Krishnamurthy

  • How to use one variable as a default value for another variable?

    Hi Experts,
    Is it possible to use one variable as a default value for another variable?
    For example:
    Variable 1 = current calendar year month
    Variable 2 = mandatory input ready variable for calendar year month
    I want to use variable 1 as default value for variable 2, but also have the ability to change the month if required.
    Thanks!
    Kathryn

    u can use replacement path variable
    in that case u can replace the values of 1 variable with the another variable...
    but  u cannot do this setting
    u cannot make variable 2 as mandatory
    u cannot enter value for variable 2
    because by default it will take the value of variable 1
    u have to make follow settings
    variable 2
    name , technical name
    processing by = replacement path
    infoobject = ocalmonth
    next tab
    replaced by another variable
    variable name
    offset start , offset lenght
    save and hit okey

  • How to set a default value as current month in already created variable of 0fiscper

    Hi Guys,
    In my report currently we are using a variable for 0fiscper which is mandatory and selection option.
    Now there is a requirement to set current month as default value in that variable.
    Please let me know how can I do that.
    Thanks.
    Dolly

    You need to change the processing type to customer exit of that variable.
    Now in i_step = 1 write the following code:
    Data:dt LIKE sy-datum,
          zper  TYPE /bi0/oifiscper,
          YR type /bi0/oicalyear,
          per LIKE t009b-poper.
    IF i_step = 1.
    WHEN 'X_FSCPRC' .---User input variable based on cmod.
          dt = sy-datum.
          CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
            EXPORTING
              i_date         = dt
              i_periv        = 'M3'---Give the fiscal year variant                             according to your system
            IMPORTING
              e_buper        = per
              e_gjahr        = yr
            EXCEPTIONS
              input_false    = 1
              t009_notfound  = 2
              t009b_notfound = 3
              OTHERS         = 4.
          IF sy-subrc = 0.
    Concatenate YR Per into Zper.
            l_s_range-low = Zper.
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            APPEND l_s_range TO e_t_range.
          ENDIF.
    endif.

  • Is it possible to define default value of a variable in sql scripts

    Hi,
    I was thinking of a way to assign a default value to a variable without any prompt by the script as we do in shell script.
    To make my query more clear, consider the example.
    suppose we have a sql script like test.sql with contents
    ===========================================
    define x=&1
    declare
    x1 number;
    begine
    x1:=nvl(&x,10);
    dbms_output.put_line(x1);
    end;
    ===========================================
    even though I am using nvl it will prompt for value of 1 which needs user interference. for example if I run test.sql output is as below:
    =============
    SQL> @test
    Enter value for 1:
    10
    =============
    Is there any way to avoid sql from prompting for values of variables for which we want it to take a default value (if not specified as input argument)
    Thanks
    now if i run this as
    sql>@test 10
    it executes

    I wan't to accept the value as command line argument. say the whole statement is written into an sql file say test.sql so that &1 will hold any value specified as input.
    So the issue is although sql will execute the procedure if no value is specified but it will still prompt once for any variable (&x or &1). if you don't specify anything and just press enter than only the default value is taken.
    I wan't the script to be executed on cron without user interference. So, was looking if there's a way to specify default value for cron script.

  • Default value for variable

    Hello Experts,
    I have created a report which containts variable 0P_FPER ( Period/Fiscal year,single entery required). Now, the requirement is to get completed fiscal year/month(current month-1)  by default in the input box of variable entry whenever I execute the query.
    Assigning default values option is not giving me the list of variables to assign for default value.
    How can I achieve this?
    Regards,
    Nirav Shah
    Edited by: Nirav Shah on Aug 6, 2008 8:19 AM

    How to Create a u201CCustomer Exitu201D Date Variable.
    Custom date variables greatly enhance BEx Reporting.
    Letu2019s assume you have an InfoProvider with a characteristic 0CALDAY (Calendar Day) and you want to restrict results of your query to u201Ccurrent month to dateu201D.
    Scenario:
    1. Start by creating a variable for the 0CALDAY InfoObject.
    2. Assign u201CProcessing byu201D type u201CCustomer Exitu201D, u201CVariable Representsu201D to u201CIntervalu201D and u201CVariable Entryu201D to u201CMandatoryu201D. Select u201CReady for Inputu201D checkbox if you want a request window for your variable to be presented at runtime (interval values will be filled from your Customer-Exit but a user can still change them).
    3. Go to transaction CMOD to create a project for your enhancement (see ref.2). Give a name to the project (1), create (2) and save the project. Then assign an enhancement RSR00001 to your project and
    save. (In this step an error message u201CSAP enhancement RSR00001 already belongs to project NAMEu201D may appear. That means an active project with the enhancement RSR00001 already exists. If this is the case, you do not need to create your own project and may terminate this step and go to the step 4). Activate the project.
    4. Go to a transaction SE80, display a Function Group XRSR (1,2), open Function Modules (3) and double click on an EXIT_SAPLRRS0_001 (4). A source code for the EXIT_SAPLRRS0_001 function module opens. Double click on a word ZXRSRU01. You arrive to a source code for the Include ZXRSRU01.
    5. In the source code for Include ZXRSRU01 insert your code (see sample code below). If some code like DATA: L_S_RANGE TYPE RSR_S_RANGESID. u2026 u2026 u2026 u2026 u2026 u2026 ENDCASE. Already exists in the Include just insert the part of the sample code from the first comment to the last at the end of the existing code but above the ENDCASE statement. Check and Activate.
    Code Example:
    DATA: L_S_RANGE TYPE RSR_S_RANGESID.
    Current month to date variable ZCMTD example.
    WHEN 'ZCMTD'.
    you variable name
    data: ZCMTD_LOW like sy-datum.
    *defining variable for using as a starting date of the interval
    ZCMTD_LOW = sy-datum. 
    *initializing it with the current date
    ZCMTD_LOW+6(2) = '01'.
    *replacing last two symbols (day) in the current date with '01'(see ref.1)
    CLEAR L_S_RANGE.
    L_S_RANGE-LOW = ZCMTD_LOW.
    *initializing low interval limit
    L_S_RANGE-HIGH = SY-DATUM.
    *initializing high interval limit
    L_S_RANGE-SIGN = 'I'.
    *defining interval as inclusive
    L_S_RANGE-OPT = 'BT'.
    APPEND L_S_RANGE TO E_T_RANGE.
    Current month to date variable ZCMTD example end.
    ENDCASE.
    The result of this will be an interval from the first day of the current month till the current system date.
    Acknowledgements and more info:
    Thanks go to Dirk Herzog and Roberto Negro for their valuable posts on forum regarding Customer-Exit variables.
    References:
    ref.1 Processing Sections of Strings
    ref.2 Customer Exits
    ref.3 Date for Several Months topic on BW Forum

Maybe you are looking for

  • Horizontal scroll bar in 1024x768 resolution

    I working in a older type HP notebook. ( Windows XP 32bit) This notebook max screen resolution is 1024x768 A few days ago i update my Firefox.In the new version the websites wider than my screen and Firefox show the horizontal scroll bar, which is ve

  • Motion project appears with

    I'm having a problem with Motion projects imported into a Final Cut Pro timeline. A thin black bar appears over the top of the movie. This is consistent across multiple Motion and Final Cut Pro projects. An example is at http://homepage.mac.com/alan.

  • Safari 4.0.3 and Adobe Flash Player 10

    I am running a dual 1.8 G5 powerpc. Once I was upgraded to Safari v. 4 I am unable to read certain web media that requires Adobe Flash. I have repeatedly gone to the Adobe site and completed the download procedure correctly and it tells me I have suc

  • Databases general optimizations

    First of all let me give you a warm hello to all of you guys. Coming to my subject, it is relevant to Oracle databases management in general for very large companies (e.g. TLC operators). The usually face this kind of problems: - licences number prol

  • FCE Export settings for Web content

    I'm about to help a friend make a how-to video for the web. I have not shot it yet and I've never made anything for the web before so I wanted to verify the correct settings before I start. I will be shooting with a Canon HV30 in HD 30 fps. What easy