Dynamic Values for Select Option

Hi, 
  My requirement is that i have to set
  yesterday for the low range of select option
  and today for the high range.
  I tried the selection variables and found that
  only low range can be specified in the
  selection variable.
Thanks,
Siva

Hi,
You mean default display variant.
Then try this.
data w_variant TYPE disvariant.
PARAMETERS P_LAYOUT LIKE DISVARIANT-VARIANT.
INITIALIZATION.
*Get Default display variant
PERFORM F100_DISPLAY_DEFAULT_VARIANTS.
FORM f100_display_default_variants.
  w_variant-report   = sy-repid.
  w_variant-handle   = c_handle.
  CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
       EXPORTING
            i_save        = 'A'
       CHANGING
            cs_variant    = w_variant
       EXCEPTIONS
            wrong_input   = 1
            not_found     = 2
            program_error = 3
            OTHERS        = 4.
  IF sy-subrc EQ 0.
    p_layout = w_variant-variant.
  ENDIF.
ENDFORM.

Similar Messages

  • Set of default values for Select-Options

    Hi Gurus,
    I have a requirement where I need to set default values for select options
    ex: SELECT-OPTIONS: S_MTART FOR MARA-MTART
    default values must be ERSA - HIBE- FHMI - DIEN - GEST
    Please tell me how to do it.
    Effective replies will be rewarded with full points
    Karthik

    Hi,
    For each SELECT-OPTION, you can only specify one DEFAULT.
    You must specify the default value g in its internal format, e.g. "SELECT-OPTIONS DATE FOR SY-DATUM DEFAULT '19931224'", not "... DEFAULT '24.12.1993'".
    The default value g should normally be a literal because, at runtime when you use SUBMIT, it is transferred to the selection options table sel so early that no value can be assigned to the field g. System fields like SY-DATUM are an exception here because the system usually assigns values to them as soon as the report processing starts.
    When you use user-defined selection screens in your programs that you do not call using SUBMIT, the DEFAULT value is transfered when the selection screen is first called. In this case, therefore, you can use other fields g.
    regards,
    sowjanya
    Message was edited by: sowjanya suggula

  • Default  value for select options.

    Hi folks
    I have to default four values in select-options.
    eg.,
    S_lfart for likp-lfart, default zse, zin, znd, zps.
    Thanks in Advance,
    Rao

    Hi,
    Go through the following syntax:
    SELECT-OPTIONS <sel> FOR <f>
                   [DEFAULT <g> [to <h>] [OPTION <op>] SIGN <s>]
                   [MEMORY ID <pid>]
                   [LOWER CASE]
                   [OBLIGATORY]
                   [NO-DISPLAY]
                   [MODIF ID <key>]
                   [NO-EXTENSION]
                   [NO INTERVALS]
                   [NO DATABASE SELECTION].
    Declares a selection table <sel> for the field <f>. For <sel>, places input fields on the corresponding selection screen. The additions allow you to set a default value, accept input in lowercase, define a required field, suppress or modify the display on the selection screen, restrict the selection table to a line or a selection to a single field, or prevent input from being passed to a logical database
    Regards,
    Bhaskar

  • How to assign list of default value for select-option variable???

    Hi every one
    This is Deepak,
    I want to know how to assign list of default value to select-option variable ? please any body tel me solution
    for example
    select-option matnr for mara-matnr default ..............and here i want to give more than 1 values that will be default value and use can choose any one at the time of input .
    Thank you in advance
    Deepak

    Hi.
    Check the following sample code.
    REPORT ztn_test.
    " It is example for list populating.
    TABLES:knvp.
    data: BEGIN OF itab OCCURS 10,
          kunnr like knvp-kunnr,
          END OF itab.
    data: wa_itab like itab.
    TYPE-POOLS: vrm.
    DATA: name TYPE vrm_id,
    list TYPE vrm_values,
    value LIKE LINE OF list.
    PARAMETERS: s_kunnr(20) type c  as LISTBOX VISIBLE LENGTH 40 .
    AT SELECTION-SCREEN OUTPUT.
    SELECT kunnr from knvp  into  CORRESPONDING FIELDS OF TABLE itab WHERE parvw = 'SP'. " SP for ur requirement
    " I have used loop to populate some values from table
    loop at itab into wa_itab.
      name = 'S_KUNNR'.
      value-key = sy-tabix.
      value-text = wa_itab-kunnr.
      append value to list.
      clear wa_itab.
    endloop.
    " If u want individaully assign the values change the code as
    name = 'S_KUNNR'." Select option name
      value-key = 1." Index
      value-text = 'VAL1'.
      append value to list.
    name = 'S_KUNNR'." Select option name
      value-key = 2." Index
      value-text = 'VAL2'.
      append value to list.
    CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING id = name
    values = list.
    Edited by: tahir naqqash on Feb 21, 2009 4:38 PM

  • Restrict F4 help values for select option

    Hi All,
    How to restrict the F4 help for select option in Webdynpro for ABAP based on some input.
    Regards,
    Karthick S

    Hi Karthick,
    Use OVS help. It will take your inputs for search and give you corresponding search value list.
    Refer my blog, it will be helpful.
    [OVS Help in WDA|/people/shruti.rathour/blog/2008/05/05/ovs-help-in-web-dynpro-abap]
    Thanks.

  • Dynamic variant for select option High value

    Hi ,
    Please help me in creating dynamic variable for a select option date field high value.
    II tried the following method:
    1. Enter the values in the selection screen
    2. Save the variant using the SAVE button
    3. In the next screen for the date variable select the 'Selection variable' checkbox (L) and click on the button 'Selection variable' in the toolbar.
    4. Now you will see this variable in the next screen with 3 types of buttons. Click on the middle button (i.e. D - Dynamic date calculation).
    5. Click on the down arrow button and select the option 'Current Date'.
    5. Save the variant.
    But it is saving the date value in Field LOW of select option( From value).
    I need it in TO field( High value).
    Please help.
    regards,
    Sheeba

    Hi Sheeba
        we can do it other way .. Select the same steps as you have done but after the assigning the value current date to low ..click on the selection option push button at the application bar and choose the 'less than or equal to' option to your select option value and try the same ....
    I guess this would throw you same results as that of the value in the high value button
    Cheers,
    Jacks.

  • Default Values for Select-options In Webdynpro-ABAP

    Hi Freinds,
    Kindly,Help me in setting the Default values for the Select-options in Webdynpro ABAP.
    Here the Node and the Attributes are Created Dynamically, and then Displayed Select-options Component View.
    Regards,
    Xavier.P

    Xavier Reddy Penta sent me this question via email and I answered it directly yesterday. Here is the solution that I provided to him, so that it is stored with the original question:
    I believe your problem is that you are not setting the value into the range correctly.  You are setting it directly into the field symbol of the range like such:
    <FS> = L_STRING2.
    But ranges are deep objects. They have four fields: Sign, Option, High, and Low. This is from the online help:
    1.     sign of type c and length 1. The content of sign determines for every row whether the result of the condition formulated in the column is included or excluded in the entire resulting set for all rows. Evaluable values are "I" for include and "E" for exclude.
    2.     option of type c and length 2. option contains the selection option for the condition of the row in form of logical operators. Analyzable operators are "EQ", "NE", "GE", "GT", "LE", "LT", "CP" and "NP" if column high is initial, and "BT", "NB" if column high is not initial. With the options "CP" and "NP", the data type of the columns low and high must be of the data type c, and special rules apply for entries on the selection screen.
    3.     low of the data type defined after FOR. This column is designated for the comparison value or the lower interval limitation.
    4.     high of the data type defined after FOR. This column is designated for the upper interval limitation.
    So when you are moving the value into the field symbol you are setting it into the sign column.
    Here is an example of how you can access the components of the range:
    * create a range table that consists of this new data element
        lt_range_table =
          wd_this->lv_sel_handler->create_range_table(
               i_typename = l_typename ).
        IF l_fieldname = 'CARRID'.
          FIELD-SYMBOLS: <tab>         TYPE INDEX TABLE,
                             <struct>      TYPE ANY,
                             <wa>          TYPE ANY,
                             <option>      TYPE char2,
                             <sign>        TYPE char1,
                             <high>        TYPE ANY,
                             <low>         TYPE ANY,
                             <wa_values>   TYPE ANY.
          ASSIGN lt_range_table->* TO <tab>.
          APPEND INITIAL LINE TO <tab> ASSIGNING <wa>.
          ASSIGN COMPONENT 'OPTION' OF STRUCTURE <wa> TO <option>.
          ASSIGN COMPONENT 'HIGH' OF STRUCTURE <wa> TO <high>.
          ASSIGN COMPONENT 'LOW' OF STRUCTURE <wa> TO <low>.
          ASSIGN COMPONENT 'SIGN' OF STRUCTURE <wa> TO <sign>.
          <sign> = 'I'.
          <option> =  'EQ'.
          <low> = 'AA'.
        ENDIF.

  • Dynamic F4 for Select Options

    Hi,
    I have two Select-Options for Kunnr and Bukrs.
    My requirement is that,
    when I select a particualar Kunnr in the Select Option the Corresponding Bukrs must appear in the F4 for the S_BUKRS.
    Can someone help please.
    Thanks,
    Supriya Manik.

    You might have to code a search help exit to achieve this purpose.
    In the KUNNR search help, have the exit export the selected value to parameter ID KUN.
    Then, from the BUKRS search help, read this value and pass it to the KUNNR field in the F4.
    You can find more info on search help exits at:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ee52446011d189700000e8322d00/frameset.htm
    Hope this helps.
    Sudha

  • How to pass the low value and high  values for select options.

    Hi,
           In selection screen I want to display the first date, last date of this month as a default value in low and high fields.  Please exaplain me how.
    Thanks and Regards,
    Surya

    hI,
         Very thanks ,
            I  did it what u said now. but those contents does not displaying on the screen.
    In this order I write the code. Please explain me
    SELECT-OPTIONS s_date FOR likp-wadat_ist.
    DATA  BEGIN TYPE wadat_ist.
    DATA LAST TYPE wadat_ist.
    initialization.
    s_date-low = BEGIN.
    s_date-high = LAST.
    at selection-screen output.
    CALL FUNCTION 'HRWPC_BL_DATES_MONTH_INTERVAL'
      EXPORTING
        datum                =  SY-DATUM
        month_pst            =  '0'
        month_ftr            =   '0'
    IMPORTING
       BEGDA                =  BEGIN
       ENDDA                =   LAST
    EXCEPTIONS
      INVALID_VALUES       = 1
      OTHERS               = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • Keep previous values for Select-Options

    I am using macros to populate my selections with the previously entered values.  Everything works fine until I want to delete the previous selections for so_snp via the Trash Can button.  The selections come back.  The issue seems to be that the selections are deleted from the so_snp range but then the AT SELECTION-SCREEN OUTPUT executes makro_get_range which re-populates the so_snp selection from the data stored in the buffer because so_snp is initial.  How do I get the AT SELECTION-SCREEN code to execute first so that the makro_set_range can clear out the shared buffer for '/SAPAPO/PT_PLAN_SNP'.  I have included excerpts from my ABAP program.
    Any help would be appreciated.  I struggled with this all day long.
    Best regards,
    Sandy
    DEFINE makro_get_range.
    initialization
      clear:
        lv_line,
        lv_key.
    import SET/GET-parameter from shared buffer
      if &2[] is initial.
        concatenate sy-uname  &1 '_T' into lv_key.          
        import &2[] from shared buffer indx(st) id lv_key.
        if sy-subrc eq 0.
          read table &2 index 1.
        endif.
      endif.
      if &2 is initial.
        get parameter id &1 field &2.
        if sy-subrc ne 0 and &2 is initial.
          refresh &2[].
        endif.
        if not &2   is initial
           and &2[] is initial.
          append &2.
        endif.
      endif.
    END-OF-DEFINITION.
    DEFINE makro_set_range.
    initialization
      clear:
        lv_line,
        lv_key.
      concatenate sy-uname &1 '_T' into lv_key.
    export SET/GET-parameter to shared buffer
      describe table &2[] lines lv_line.
      if lv_line gt 1.
        export &2[] to shared buffer indx(st) id lv_key.
      else.
        delete from shared buffer indx(st) id lv_key.
        set parameter id &1 field &2.
      endif.
    END-OF-DEFINITION.
    SELECT-OPTIONS so_snp FOR /sapapo/matloc-planner_snp.
    AT SELECTION-SCREEN OUTPUT.
       makro_get_range '/SAPAPO/PT_PLAN_SNP'    so_snp.
    AT SELECTION-SCREEN.
        makro_set_range '/SAPAPO/PT_PLAN_SNP'    so_snp.

    Can you set a flag to indicate that it needs to be done only once like below?
    AT SELECTION-SCREEN OUTPUT.
    IF v_flag_get_done_once IS INITIAL.
    *-- get the values from the shared buffer
      makro_get_range '/SAPAPO/PT_PLAN_SNP' so_snp.
      v_flag_get_done_once = 'X'.
    ELSE.
    *-- user manipulated the selection screen values, so
    *   don't do it again. Do Nothing.
    ENDIF.
    Srinivas

  • Specific default values for select-options high and low

    Hi
    My requirement is in the selection screen i have a select-options field for which i need to give default values as mentioned below.
    Description                              Data Type       Default Value     Mandatory?             Sel Scrn Type     
    Delivery/BOL Date        ekab-bedat                         1st DOM to current day     Y              Range     
    The datatype is ekab-bedat.
    In the low value field ,it should be 1st Date of month(DOM) and in the high value field it should be current day.
    Give me the code for the same asap.

    >
    sreedeep.sreekumar wrote:
    > Dont mistake my intensions. When i tried to write it in the form of a request it showed me that it cannot me posted beacuse the words that i am using (please,kindly) is not following the terms and conditions of the words to be written in the threads
    Sounds quite vague to me.
    >
    sreedeep.sreekumar wrote:
    > I was asking help for this as i am a novice in SAP-ABAP and i couldnt find solutions for it and also i have seen people directly writing codes for the queries.
    Becuase you see people posting pieces of code doesn't mean you can ask for a solution asap. Besides, whether you're new or a veteran in ABAP, what you need can be solved with some very basic knowlegde of ABAP. Just use a bit of common sense.

  • Default values for Select options

    Hi All,
      I want to have default values X0 and ND for a select-options field.how can i get the same?
    Thanks,
    Rakesh.

    Initialization.
    s_akont-low = 'X0'.
    s_akont-sign = 'I'.
    s_akont-option = 'EQ'.
    APPEND s_akont.
    s_akont-low = 'ND'.
    APPEND s_akont.

  • Help on Dynamic values in select options

    Hi All,
    I need help for the following.
    1. I have two select options for fields VBAK-VBELN and VBAK-ERDAT one after the other.
    2. When I select VBELN through F4 in the first select option then the corresponding ERDAT should be displayed in second select option.
    Please let me know how to do this

    Use the below code
    tables: pa0000, pa0001.
    parameters: p_chk1 as checkbox user-command rusr,
    p_chk2 as checkbox user-command rusr,
    p_chk3 as checkbox user-command rusr,
    p_chk4 as checkbox user-command rusr,
    p_chk5 as checkbox user-command rusr.
    selection-screen: begin of block blk1 with frame.
    select-options: s_pernr for pa0000-pernr modif id ABC,
    s_stat2 for pa0000-stat2 modif id DEF,
    s_werks for pa0001-werks modif id GHI,
    s_persg for pa0001-persg modif id JKL,
    s_persk for pa0001-persk modif id MNO.
    selection-screen: end of block blk1.
    AT SELECTION-SCREEN output.
    LOOP AT SCREEN.
    IF SCREEN-GROUP1 = 'ABC'.
    IF p_chk1 = 'X'.
    SCREEN-ACTIVE = 1.
    ELSE.
    SCREEN-ACTIVE = 0.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    IF SCREEN-GROUP1 = 'DEF'.
    IF p_chk2 = 'X'.
    SCREEN-ACTIVE = 1.
    ELSE.
    SCREEN-ACTIVE = 0.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    IF SCREEN-GROUP1 = 'GHI'.
    IF p_chk3 = 'X'.
    SCREEN-ACTIVE = 1.
    ELSE.
    SCREEN-ACTIVE = 0.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    IF SCREEN-GROUP1 = 'JKL'.
    IF p_chk4 = 'X'.
    SCREEN-ACTIVE = 1.
    ELSE.
    SCREEN-ACTIVE = 0.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    IF SCREEN-GROUP1 = 'MNO'.
    IF p_chk5 = 'X'.
    SCREEN-ACTIVE = 1.
    ELSE.
    SCREEN-ACTIVE = 0.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    *Note
    *Titles for check boxes and select options
    *P_CHK1 Personal Number
    *P_CHK2 Employment Status
    *P_CHK3 Personnel Area
    *P_CHK4 Employee Group
    *P_CHK5 Employee Sub group
    *S_PERNR Personal Number
    *S_PERSG Employee Group
    *S_PERSK Employee Sub group
    *S_STAT2 Employment Status
    *S_WERKS Personnel Area

  • Dynamic SQL for selection-option???

    Hi,
    I am trying to select a table from the parameters (range ) , but every time i run it give me a dump witn error in  where ...(itab)
    First i declare :
    data : cond(72) TYPE C,
             itab LIKE TABLE OF cond .
    select-options: p_auart  FOR vbak-auart ,
                          p_vkorg FOR vbak-vkorg.
    --->
    If not p_auart is initial.
        cond = 'auart IN p_auart' .
    APPEND cond To itab.
    endif.
    the i do select:
    Select * from vbak where (itab).
    ---> I give a dum in where clause....
    So could you please help me out of this
    Thanks

    Hi Friend,
    Make the following corrections.Your code will work fine.
    By the statement- 'itab LIKE TABLE OF cond .' you meant to create a table of the type 'COND' which should be a structure.
    So, here lies the problem.In your case COND is a char type variable and you are trying to mimic the table 'itab' from it.
    As a rule of thumb,a table should mimic a std., table or a structure.
    So remove the following lines:
    data : cond(72) TYPE C,
    itab LIKE TABLE OF cond .
    Include the following lines:
    type: begin og itab_record,
            cond(72) TYPE C,
            end of itab_record."Declaration of structure itab_record.
    data: itab type standard table of itab_record initial size 0 with header line."Declaration of the table itab which mimics the       structure itab_record.
    Modify these two statements,
    cond = 'auart IN p_auart' .
    APPEND cond To itab.
    to
    itab_record-cond = 'auart IN p_auart' .
    append itab_record.
    Other lines are exact,make these changes,execute it and seek my assistance if necessary.
    Regards,
    Lakshmanan

  • Remove screen values for select options after report runs

    I have a report that runs and when it is finished there is garbage in 3 select-option fields.  I put it there because i want the report to run if the field is blank.  here is a sample of that code.
    IF SO_APS = '  '.
        SO_APS = 'IEQn'.
        APPEND SO_APS.
      ENDIF.
    what happens is that there is an displayed after the report is finished, and I don't want to confuse the end users.

    You can try clearing it as the last statement.
    clear  SP_APS.   Refresh SO_APS.
    If that doesn't work, then try FREE MEMORY as the last executable statement.
    Regards,
    Rich Heilman

Maybe you are looking for

  • Question about the new iPod Touch 5G?

    When in October will it come out? On the Apple site it says it will come in October. Does that mean October 1st? Also i'm debating in which color to get I might get yellow or blue, do you think the yellow color looks sorta greenish? Many people are s

  • Problem with adding objects to a collection

    Hi Been using this forum for a couple of years now to help me with my code, but it's the first time that I've had a problem which I couldn't find the answer for! I'm trying to create two classes one called Reminder and one called Engagement. The Remi

  • Internal table structure/ALV Problem

    Hello, Im new to ABAP (third day) so careful explination would be greatly appreciated. So I'm trying to display two tables together that I've joined into an ALV.  Im creating an internal table to hold the information that I want to display from the j

  • 0REPORT_TEMPLATE_BROADCASTING variable reset issue

    I am broadcasting a formatted report (created in report designer) as a pdf. The broadcast runs fine but the result is always fixed to a specific time period. The variables are not resetting. I checked the default template 0REPORT_TEMPLATE_BROADCASTIN

  • Ios 6 orientation doesn't work and boot time increases. How to solve these issues for dummy? I don't understand code and strings suggested by others.

    I just upgraded from ios 5 to ios 6 on my ipad2. Now orientation doesn't work properly. Boot time increase, it takes longer time to boot. Is there any configuration to solve these issues? I can't understand the explanation with code and strings found