Populate variable with default (I_STEP=1)

I created a variable P_CWEEK (mandatory, ready for input) and I want to populate it with a default week (week 22 in 2005). My problem is that the variable is not populated. It comes up empty.
I wrote the code below in the customer-exit.
CASE i_vnam.
  WHEN 'P_CWEEK'.
    IF i_step = 1.
      LOOP AT i_t_var_range INTO loc_var_range
        WHERE vnam = 'P_CWEEK'.   "Reporting week
        CLEAR l_s_range.
        l_s_range-low  = '200522'.
        l_s_range-sign = 'I'.
        l_s_range-opt  = 'EQ'.
        APPEND l_s_range TO e_t_range.
        EXIT.
      ENDLOOP.
    ENDIF.
ENDCASE.

Hi,
code it like this:
CASE i_vnam.
  WHEN 'P_CWEEK'.
    IF i_step = 1.
     LOOP AT i_t_var_range INTO loc_var_range
       WHERE vnam = 'P_CWEEK'.   "Reporting week
        CLEAR l_s_range.
        l_s_range-low  = '200522'.
        l_s_range-sign = 'I'.
        l_s_range-opt  = 'EQ'.
        APPEND l_s_range TO e_t_range.
      EXIT.
    ENDLOOP.
    ENDIF.
ENDCASE
regards
Siggi

Similar Messages

  • I want to set a variable with default value and can be changed by the user

    hi,
    i want to set a variable with default value and can be changed by the user, so i new a variable with setting : customer exit, single value, optional, ready for input.
    in my customer exit code, i set a default value, eg. 20070530
    when the variable screen popup, it display the default value 20070530, i changed it to 20070529, but it doesn't work , it still display the data in 20070530, how can i solve this problem? 
    your help is appreciated.

    Liu,
       As mentioned by Anil, you need to restrict your customerr Exit code to I_STEP = 1.
    or.
       <u>Open your Variable in change mode, in the Last Page os the Variable Maintenance you can provide default value. Note: you are doing same thing in Customer Exit. In your case no need of Customer Exit.</u>
    Nagesh Ganisetti.
    Assign points if it helps.

  • Variable with default Vales

    Hi,
    I have a posting date field in my cube and in my report i have with user selection on Posting Date.
    My requirement is to populate that User interval with default date range of previous month.
    For example if i run the report from today to 30 Apri....i should see 01.03.2014 - 31.03.20114 or
    If i run the same report anytime after 1st may i should see 01.04.2014 - 30.04.2014
    I am sure i need to write User exit ...is it I_Step 1 or IStep 2 and any code is greatly helpful
    Thanks in advance

    As per your requirement you need to have the variable based on posting date populated by the start and end date of previous month (Current month -1).
    Create a customer exit variable on posting date of type interval.Entry should be mandatory.Ready for input.
    Write the following code.
    DATA:DT type SY-DATUM,
             DT1 type SY-DATUM.
    WHEN 'VAR_1'.
    IF I_STEP = 1.
            CALL FUNCTION 'DATE_CREATE'
                                       EXPORTING
                                        ANZAHL_JAHRE         = 0
                                        ANZAHL_KALTAGE       = 0
                                         ANZAHL_MONATE        = -1
                                        ANZAHL_TAGE          = 0
                                         DATUM_EIN           = sy-datum
    *                                   DATUM_EIN_ULT        = ' '
    *                                   ULTIMO_SETZEN        = ' '
                                      IMPORTING
                                        DATUM_AUS            = DT.
    *                                   E_TT                 =
    *                                   E_ULTKZ
    CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
                EXPORTING
                  day_in            = DT
                IMPORTING
                  last_day_of_month = DT1.
    Concatenate DT+0(6) '01' into l_s_range-low
    l_s_range-high = DT1.
    l_s_range-sign = 'I'.
    l_s_range-opt = 'BT'.
    APPEND l_s_range TO e_t_range.
    ENDIF.
    This will give you the desired output.In case any issues then let me know.
    Regards,
    AL

  • Selection variable with default value as previous weeks mon through sun

    Hi Experts,
    1.)
    I need to create a Selection Variable ZTRANS_DT ( type Interval ), with the default value as  "Previous week, Monday Through Sunday" .
    Should we have to write a customer exit to populate these interval values dynamically every time the user runs the report ?
    If so can you please write a sample ABAP code.
    2.)
    The filter restriction for the date feild ZBUSINSDT has to be set to ">=#1/1/CURRENT YEAR#" ..
    How to set current year dynamically.
    Help done would be appreciated and would be assigned points.
    Thanks,
    Santosh..

    Hello,
    I dont remember of any standard variable but still you can wait to see if any1 comes up with one.
    Or else you can try the foll:
    Create the variable as per your requirement.
    Then in CMOD, write a simple code for i_step = 1.
    logic can be l_t_range-low = sy-datum - 1.
    Regards,
    Shashank

  • Problem executing BEx query Hierarchy variable with default value

    My query has hierarchy variable on 0MOVETYPE char with a default value . The 0MOVETYPE variabale restriction is in Static filter area.
    I got timeout on query execution not because of amount of data but because of this hier. variable. Any ideas why?
    Notes:
    a) The hierarchy and the 0MOVETYPE characteristic are active and correct.
    b) I've tried RSRT check, but got the same timeout error.
    c) query executes fine on dev environment. I'm getting timeouts on PRD (as I say not because of amont of data)

    Hi,
    1. Try generating the report in RSRT and see if query runs correctly
    2. Looks like you are dafulating onto top node which contains whole data may be. This is not correct as it will definitely slow down the report based on amount of data it contains. Try to remove default and try first whether query is opening.
    3. You can put some lower level defualt to understand whether amount of data is the issue.
    4. Try to increase the server time out setting and see if it runs.
    Thanks and regards

  • How do I populate variable with NULL in link

    I need to reset a variable value to null upon clicking on a link on the page. I have gone into the field and setup the link, selected the field, and set value to NULL, then told it to create the link.
    When it gets to the new page I get an error of Invalid Number on the queries using the variable. I have an NVL in the query which works. How can I set the variable to NULL instead of the string value "NULL"

    "216080",
    I understand no more than the gist of your description, and nothing at all of the second sentence. But let me offer this in case it might help. To set an item value to null in a link, you can use a comma to represent the null value, for example f?p=100:1:&SESSION.::::P1_ITEM,P2_ITEM,P3_ITEM:999,,888 will set P1_ITEM to 999, P2_ITEM to null, and P3_ITEM to 888. This may not be exactly what you asked for ("to reset a variable value to null upon clicking on a link to the page") but it will set the various items' values in session state as I described at the time the page request is processed. Nothing will happen on the current page when you click the link.
    57434
    P.S. If you like, you can show your name in this forum instead of a numeric ID not only by signing your posts, but also by clicking on 'Forum Settings' and setting 'Name visible to others' to Yes.

  • Issue with Default Variable in WAD after Java Patch 7.01.7.31

    Hello all,
    I'm running into an issue with the Web Application Designer Template execution for a particular default variable. This started occuring after Java Patch 7.01.7.31 we had implented over the weekend.
    The issue is when Executing the WAD Template, we have a selection screen with a variable with default values assigned to it. When leaving the default values and hitting Ok to execute  through the screen does not register and stays as is and I get a message at the top with the following: Characteristic Prob % Number has no master data for "1.00" or you do not have authorization.
    This only seems to occur for this default variable on info object Prob % Number, the other default variables seem to work fine. Also another note when clearing out the values it returns data and executes through. The value 1.00 is also a valid value in the cube and also in the output display. If we run this report in the BEx analyzer, the selection screen executes through with the default variable perfectly fine, this is only an issue with the Web Application Designer Template.
    Has anyone ran into this? I've searched and have not found any notes as of yet.
    Thank you,
    -Andy

    Dear Andy,
    Please raise this to SAP, seems like a strange problem this needs to be addressed by OSS note only.
    Close this thread once you get a solution.
    Regards.
    Den

  • Populate user exit Variable with User Authorizations using ABAP?

    Hi, Does anyone know of a way to populate a user exit variable (with ABAP) with the Authorization Values for a user running a report?  I am turning off authorizations for our InfoProvider using RSSM and want to populate a variable instead and use the variable as a filter.

    Hi Kenneth ,
    You need dynamic authorization in your report .This can be done at query runtime by using exit variable and writing cmod code for the same .
    This code will read authorization maintained at runtime of query in i_step = 1 and will pass input var values accordingly .
    For step by step information you can access this document .
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0f9f33c-0f17-2d10-d3a2-ae52ccd00780?quicklink=index&overridelayout=true
    Hope this will be helpful .
    Regards,
    Jaya Tiwari

  • Best way to pre-populate material variable with values for users

    Hi,  I have a requirement to prepopulate a material variable with about 5 materials and that is the materials that will default when the query is called.  The users would also need the ability to change those values.
    My thought is to create a User-exit variable that derives the values from a user maintained table (infoobject). 
    Does anyone else have any suggestions or ideas on the best way to handle this?

    I don't know if there is a best solution...
    Infoobject
    With this option you have to create a new infoobject (ZMATERIAL) without attribute (you need only a list material codes) and then to set the authorization profile for the user in order to manage the content.
    The creation of an infoobject corresponds to a table creation, but you don't need any other specific options that belong to the infooject (as technical object)...
    Table
    With this option you have to create a Z table with only one field and then to allow the maintenance of the table by SM30....
    In the ending, if you want to be a purist use the table, otherwise use an infoobject (but there are no significant differences !
    Bye,
    Roberto

  • Passed i_step = 2,3(Hierarchy Node Variable with Customer-Exit)

    Hellow !
    I want to insert the following ststement to force the variable to be executed with i_step = 2 or 3.
    CASE I_VNAM.
    when 'ZTEST'.
        CLEAR loc_var_range. REFRESH loc_var_range.
        CLEAR: l_s_range, ytest001.
    LOOP AT i_t_var_range INTO loc_var_range.
       SELECT * FROM ytest001
                  WHERE bname = sy-uname
                        AND node   = loc_var_range-low.
            IF sy-subrc = 0.
              l_s_range-low = loc_var_range-low.
              l_s_range-high = '0HIER_NODE'.
              l_s_range-sign = 'I'.
              l_s_range-opt  = 'EQ'.
              APPEND l_s_range TO e_t_range.
             else.
              l_s_range-low = '#'.
              l_s_range-sign = 'I'.
              l_s_range-opt  = 'EQ'.
              APPEND l_s_range TO e_t_range.
             endif.
    ENDLOOP.
    However, Passed customer-exit(Enhancements for Global Variables in Reporting)  i_step =2,3
    Regards,
    Don

    Hi,
    in addition to Anil's valid input, make sure that ZTEST is NOT ready for input. Indeed "ready for input" vars cannot be changed via customer exits.
    hope this helps...
    Olivier.

  • Populate word document with default metadata information

    Problem is revers as it is available in internet.  I have created list and
     columns. Which are populated  with default value. I have created word
     template. I can enter  data related to “Document properties”, ect. When I save that document to document library, I can see that filed data, that I type it in newly created word document.
    But because I have several project document library and sites, I would like to create library, 
    and fill all data with required values.  Then when I open new document from pre defied 
    template, I would like to have all fields  that are empty in document, to be filed 
    from  default columns value. Problem is, that when I save document, All fields are empty.
    There is no problem, upending document, and default properties are presented.
    How can I merge  default values from library, to word document ?

    I have word template, that I added-it as a site content type. It has all standard 
    fields  that are mapped to document library filed. If I open 
    new document in  document library, and input 
    required filed,  after  saving document, I can 
    see those fields in SharePoint document library (Item properties).
    Problem that I have is, following :
    When I open that  document “new document” from template, I would like to have all fields filed with default values of that particular library.
    Reason : Because  I will generate  hundred project (
    Each new library is based on new project, build fields are the same, values changes to mimic project)
    ),  I do not wont to create additional template, that would have required fields fill up wit project value, and add it to content type.. .
    I do not won`t to fill those properties manually.
    Option 1 :  After saving document based on template, it will fill out  
    required fields.
    Option 2: Create template, for each project, and save that template as project template, that users open, and save it to project Site/library.
    Option 1, is preferred.  Can that be done, when item is created, and copy project 
    information, from different location ?
    So I have  document library fields :
    Name of the project,  Projec Manager,  Project ref number, Contract, ...
    These filed are mapped to document filed :
    Name of the project,  Projec Manager,  Project ref number, Contract, ...
    I have document library : Project A
    Project A  ,  John dear, 
    REF2014_01_01, C1243332_2014, ...
    I have document library : Project B
    Project B ,  Same Jones ,  REF2014_03_05, AS563332_2014, ...
    I would like,  that when I save  document
     using New document (template),  that have those filed fill up. I do not wont to 
    create  new template for every project.

  • Automatically populate a Descriptive FlexField with Default Value

    I have 2 Descriptive flexfield segments defined, one is "Start Date" using value set "LS_START_DATE" and the other segment is "End Date" using value set "LS_END_DATE".
    Now when I enter the "Start Date", I want the "End Date" to be populated automatically with the value of "Start Date + 365 days".
    For example:
    If I enter "Start Date" = 25-May-2010
    Then "End Date" should be automatically populated with the value "25-May-2011" (i.e., Start Date + 1 year)
    Is that possible ?
    I tried defining "End Date" segment with "Default Type" as "SQL Statement" and Default Value as "SELECT :$FLEX$.Start Date+365 from dual" , but it's not working.
    Can someone please help ?
    Prashanthi

    I did, the value set created for this segment "Start Date" is "LS_START_DATE" and I changed the sql statement in Default Value to "SELECT :$FLEX$.LS_START_DATE+365 from dual" , but still it is not working ....no luck.
    Prashanthi

  • Formula variable with replacement path

    HI ,
    1. Is it possible to use "Customer exist- without user entry variable in the formula variable with the replacement ?
    2. if I use two variable for a same time char in one report (one is User entry variable and the other is customer exit variable for calculating current system date), then how it will work ? (User entry variable is there in the "Char restrictions" section and the customer exit variable is customer exit used in formula variable)
    Thanks in Advance.
    Thanks
    Rajesh

    1. Is it possible to use "Customer exist- without user entry variable in the formula variable with the replacement ?
    Yes. use I_step=1
    I_STEP = 1
    Call takes place directly before variable entry. Can be used to pre populate selection variables
    I_STEP = 2
    Call takes place directly after variable entry. This step is only started up when the same variable is not input ready and could not be filled at I_STEP=1.
    I_STEP = 3 In this call, you can check the values of the variables. Triggering an exception (RAISE) causes the variable screen to appear once more. Afterwards, I_STEP=2 is also called again.
    2. if I use two variable for a same time char in one report (one is User entry variable and the other is customer exit variable for calculating current system date), then how it will work ? (User entry variable is there in the "Char restrictions" section and the customer exit variable is customer exit used in formula variable)
    Yes you can use both the variable of time char to restrict a characteristic but that should not be used on single characteristic.
    You can use the sys defined  0date on one field and the customised one Zsydatum on other char.
    Regards
    KP

  • Variable with low value as first day of year and high as  key date

    hi all,
                i need to create a variable with key date for which the low value should be 1st day of the year,
    means if i enter a key date (5/9/06) the values to  appear should be from 1/1/06 to  5/9/06.
    If i want the manipulation based on key date like key date + 90 etc. is it possible?
    i have written a customer exit as
    case i_vnam.
    when 'keydate'
    clear : e_t_range,
           l_t_range.
    DATA DAT(8)TYPE D.
    LOOP AT i_t_var_range INTO loc_t_var_range.
            IF loc_t_var_range-vnam = 'keydate'.
              loc_found = 'X'.
              EXIT.
            ENDIF.
          ENDLOOP.
    DAT = loc_t_var_range-vnam .
    if loc_found = 'X'.
       l_s_range-sign = 'I'.
            l_s_range-opt = 'BT'.
            CONCATENATE sy-datum(4) '01' '01' INTO l_s_range-low.
            l_s_range-high = DAT.
            APPEND l_s_range TO e_t_range.
          ENDIF.
    WILL THIS CODE WORK.
    I FEEL THERE IS PROBLEM WITH L_T_RANGE- HIGH.
    IS THERE A DICREPENCY IN THE CODE?
    IS THE CALLING SEQUENCE OF THE VARIABLE CORRECT?
    PLZ LET ME KNOW.
    THANK U ALL

    Hi,
    my mail bounced back. send vaild mail id.
    try this.
    1) create one customer exit variable say zcuvar
    2) create a USER entry variable Keydate 0date.
    3) in CMOD, in I_STEP  = 1 of zcuvar, make it default value ad 01/01/2006 as you have done.
    4) in use as range in Selection restrict.
    zcuvar;0date.
    hope i m clear.
    regards,
    San!

  • Using a Variable with BEX Java Applications

    If I put a variable into a query and try to run the query using anything Java based (e.g. Web analyzer) when I do a drop down on the variable in the query to make a selection I dont get a proper selection choice. For example if I have a variable on Cost Centre I do the drop down on cost centre and I dont get a list of cost centres to chose from I just get ?? where the cost centres should be. If I select a ?? it does select a cost centre. It's just pot luck which you selec as they are all ??!  This happens on any variable I use SAP Standard or any I have created. Any ideas - sounds like a Java patch should fix it but I cant see anything in SAP notes etc.

    I put a query in a WAD or when I Execute a Query from the Query designer.  When I run the query the variable on the filter kicks in and it requests I select something e.g. cost centre. When I do the drop down in the variable to select a cost centre I dont get a list of cost centres. Only ?? where a cost centre should be. However when I select a ?? it does know what the cost cejtre is as it populates the variable with a cost centre. All the cost centre data is loaded etc.

Maybe you are looking for

  • Dropdown in column group of a table

    I am building a table with one multiple column groups, each has a number of columns, one of these columns have a dropdownbykey field. I get a ClassCastException on this. It seems like there is a bug in the implementation, because when I move the drop

  • Drop Box behaviour

    I've just put a folder of photos in my wife's Drop Box. When she tried to import the photos into iPhoto, all went swimmingly, except at the critical point, nothing happened. It wasn't too hard to realise that what has happened is that the containing

  • Why does my nano ipod shuffle itself?

    My nano 7th gen shuffles itself even though all shuffle options are off. It does it after I've finished listening to a disc left it off for a while and then I press the side button to restart. 

  • Mail won't relinquish default mailer status

    Eudora has been my default mailer for many years. Yet after the last Safari update a few days ago, the browser suddenly ignores Eudora's default status although it is clearly checked in Eudora's preferences. Instead, Safari thinks Mail is my default

  • Problem while triggering DTP

    When I am triggering the DTP, job is not getting started but it automatically getting cancelled. Any help..