Default date on selection-screen.

Hi ABAPers,
My requirement is that, i have one period(date) select-option in my selection screen.
Now the problem was basing on the month the first and last date of that particular month should be initialised.
For Ex:- present month was may, so in selection screen the date should be,
PERIOD    05/01/2007    TO   05/31/2007
Can any one send me the code for that.
Thanks in Advance.
Regards,
Ramana Prasad. T

Hi,
you can use this code just copy paste and run
SELECT-OPTIONS: s_date FOR sy-datum OBLIGATORY.
                               DATA: l_date TYPE sy-datum.
                               INITIALIZATION.
                                 s_date-sign   = 'I'.
                                 s_date-option = 'EQ'.
                                 s_date-low  = sy-datum.
                                 s_date-low+6(2) = '01'.
                                 s_date-sign   = 'I'.
                                 s_date-option = 'EQ'.
                                 s_date-high = sy-datum - l_date+6(2)  .
                                 s_date-high4(2) =  s_date-high4(2).
                                 CASE sy-datum+4(2).
                                   WHEN '1' OR '3' OR '5' OR '7' OR '8' OR '10' OR '12'.
                                     s_date-high+6(2) = '31'.
                                   WHEN '4' OR '6' OR  '9' OR  '11'.
                                     s_date-high+6(2) = '30'.
                                   WHEN '2' .
                                     s_date-high+6(2) = '28'.
                                 ENDCASE.
                                 APPEND s_date.
regards ,
Sudha.
reward points if useful.

Similar Messages

  • Symbol as default in a selection screen in alv

    hi all,
    how to bring GE(>=) symbol as default in a selection screen in alv report.
    by
    Ramesh.

    Hai Ramesh,
    Create Pushbuttons in selection screen ,In pushbutton write the ' >=' instead of providing the text.
    Try like this may be u will find the answer,
    REPORT DEMO.
    TABLES SSCRFIELDS.
    DATA FLAG.
    SELECTION-SCREEN:
      BEGIN OF SCREEN 500 AS WINDOW TITLE TIT,
        BEGIN OF LINE,
          PUSHBUTTON 2(10) BUT1 USER-COMMAND CLI1,
          PUSHBUTTON 12(10) TEXT-020 USER-COMMAND CLI2,
        END OF LINE,
        BEGIN OF LINE,
          PUSHBUTTON 2(10) BUT3 USER-COMMAND CLI3,
          PUSHBUTTON 12(10) TEXT-040 USER-COMMAND CLI4,
        END OF LINE,
      END OF SCREEN 500.
    AT SELECTION-SCREEN.
      CASE SSCRFIELDS.
        WHEN 'CLI1'.
          FLAG = '1'.
        WHEN 'CLI2'.
          FLAG = '2'.
        WHEN 'CLI3'.
          FLAG = '3'.
        WHEN 'CLI4'.
          FLAG = '4'.
      ENDCASE.
    START-OF-SELECTION.
      TIT  = 'Four Buttons'.
      BUT1 = 'Button 1'.
      BUT3 = 'Button 3'.
      CALL SELECTION-SCREEN 500 STARTING AT 10 10.
      CASE FLAG.
        WHEN '1'.
          WRITE / 'Button 1 was clicked'.
        WHEN '2'.
          WRITE / 'Button 2 was clicked'.
        WHEN '3'.
          WRITE / 'Button 3 was clicked'.
        WHEN '4'.
          WRITE / 'Button 4 was clicked'.
        WHEN OTHERS.
          WRITE / 'No Button was clicked'.
      ENDCASE.
    This example defines four pushbuttons on a selection screen that is displayed as a dialog box. The selection screen is defined in a statement chain for keyword SELECTION-SCREEN.
    If the text symbols TEXT-020 and TEXT-040 are defined as 'Button 2' and 'Button 4', the four pushbuttons appear as follows on the selection screen displayed as a dialog box.
    CLI1, CLI2, CLI3 and CLI4 are used for <ucom>. When the user clicks one of the pushbuttons, the AT SELECTION-SCREEN event is triggered, and the FLAG field is set. The FLAG field can be further processed during subsequent program flow after the user has chosen Execute.
    Refer the above code, and make change just to clear all the fields in the selection screen, when corresponding push button is clicked..
    May be this answer is helpful to u.
    Regards,
    Skumari

  • Default value on Selection Screen

    Hi experts,
    I want to put sy-datum + 1 as a default value on selection screen.
    I tried this but it didnt work. Please help me.
    DATA : tarih like sy-datum.
    initialization.
    tarih = sy-datum  + 1.
    SELECTION-SCREEN BEGIN OF BLOCK 3 WITH FRAME TITLE TEXT-002.
    parameters : h_tarih like sy-datum obligatory default tarih.
    SELECTION-SCREEN END OF BLOCK 3.
    Thanks

    Hi,
    Do it in INITIALIZATION event.
    SELECTION-SCREEN BEGIN OF BLOCK 3 WITH FRAME TITLE TEXT-002.
    parameters : h_tarih like sy-datum obligatory default tarih.
    SELECTION-SCREEN END OF BLOCK 3.
    INITIALIZATION.
    h_tarih = sy-datum + 1.
    In this case no need to have one more extra variable. U can directly assign to ur parameter.
    In data declaration u can only default hard coded values. But not calculated values. This is because first selection screen will be triggered and later ur calculations. So at the time of selection screen is triggered ur variable dont have any value. Thats why it was not working. Change ur code to like above. It will work fine.
    Thanks,
    Vinod.
    Edited by: Vinod Reddy Vemuru on Jun 27, 2008 12:37 PM

  • How to pass a default value in selection screen of logical database pnpce

    Dear All,
    Can any one tell me how to pass a default value in selection screen of logical database pnpce .
    Regards
    Rakesh Singh

    Hi Rakesh,
    Go to SE36 (logical database Builder).First enter PNPCE in Logical Database and press documentation,here you will get the details of exactly what is PNPCE and how it works.After that select selections in subojects in se36 only and enter display ,there you have the include from where you acn get the idea.
    Regards,
    Rahul

  • HOW TO PASS THE DATA FROM SELECTION SCREEN TO STANDARD TRANSACTION?

    HI,
    HOW TO PASS THE DATA FROM SELECTION SCREEN TO STANDARD TRANSACTION?
    thanks,
    samba.

    By selection screen, what do you mean?   There is no selection screen in WDA as there was in classic dynpro. Do you mean you are using the Select-Options reusable component?  Are you wanting to call a standard transaction via ITS - SAPGUI for HTML?  Please provide more details to your question.

  • Set Default Layout in Selection Screen of  FBL3N

    Dear All,
    Here in FBL3N presently i we have a default layout is /balaji.
    But now i want to change this as a standard layout 1sap.
    I can try this in path SETTING->ADMINISTRATOR->SET DEFAULT LAYOUT.
    But after done this and save this procedure when i run this Transaction again
    no change effected.
    Means my change is not effect in selection screen of FBL3N.
    So can anybody tell me how can i change my default layout in selection screen of FBL3N .
    Please kindly help me ....
    Thanks
    Keyur

    Hi,
    Try with below navigation
    Run the report and go to the menu settings->Layout->Choose
    and also go through this link
    http://wiki.sdn.sap.com/wiki/display/ERPFI/Howtochange-setdefaultlayoutintransactionFBL1N%2CFBL3NandFBL5N
    regards
    kk

  • How to get default values on selection screen(multiple ranges)?

    i want to know how to maintain default ranges in selection screen...like 2000 to 3000 and 7000 to 8000 and 11000 to 15000
    all the above ranges must get by default how to provide those to selection screen by default...please give me idea...with example...

    Hi Suresh,
    You can either use select-options or Ranges. If you want the selection screen to be displayed with allwoing user to enter values apart for the default ones use select options else use ranges. With ranges what ever values use hard code would be set and the end user will not be able to add any more values (or range of values).
    Simply write the following code
    tables : <name of the table from which the field belongs>
    select-options <fieldname> for <tablename>-<fieldname>.
    <fieldname>-sign = 'I'.
    <fieldname>-option = 'BT'.
    <fieldname>-low = '7000'.
    <fieldname>-high = '8000'.
    append <fieldname>..
    similiarly add all the ranges that you need to include as default and in your select statement use the IN operator inthe where clause to include the range.
    If using range replacethe select-option with the range statement.
    Thanks.

  • To change Default Setting of Selection Screen while Filtering on infoobject

    Dear Guru's,
    I just want to know where can I change the Deafult Setting from 100 to 500 which we get in the Selection Screen when we want to Filter on Info-Object level in the Workbook.
    Hope this will clear the question , incase any further information required please let me know.
    Many thanks.

    Hi Kasi,
    Please do not post the same question twice. You can see my reply at:
    Re: To change Default Setting of Selection Screen while Filtering on infoobject

  • Default value for selection screen field

    Hi all,
      I am using LDB PNPCE. I want to give default value for field Personnel area on selection screen.
    How can I do it?
    Thanks
    Rahul

    Hi Rahul,
    In the INITIALIZATION event we can set the default values for selection screen fields.
    INITIALIZATION.
    loop at screen.
    if screen-name = 'S_MATNR-LOW'.
    CLEAR S_MATNR.
    s_matnr-low = '1234'.
    s_matnr-option = 'EQ'.
    s_matnr-sign = 'I'.
    append s_matnr.
    CLEAR S_MATNR.
    s_matnr-high = '5678'.
    s_matnr-option = 'EQ'.
    s_matnr-sign = 'I'.
    append s_matnr
    clear s_matnr.
    endif.
    endloop.
    Hope it helps.
    Mark if useful
    Regards,
    Saumya

  • Logic based on Date on Selection-Screen

    Dear friends,
    I've been writing a report in which I have the date field on selection-screen. By default I have been displaying the system date on the selection-screen.
    The reqiurement is that the user cannot execute the code for a date in past (less than the system date) or cannot give a date less than the sytem date
    but can execute the same for a date in future (greater than the system date).
    Can any one give me the logic for the same.
    Regards,
    Alok.

    Hi
    This is the code for u.
    PARAMETERS : P_DATE TYPE SY-DATUM .
    INITIALIZATION.
      MOVE SY-DATUM TO P_dATE.
    AT SELECTION-SCREEN ON P_DATE.
       IF P_DATE < SY-DATUM.
                  MESSAGE 'Entered date cannot be in Past' Type 'E'.
    **Raise any message that u created otherwise 
       ENDIF.
    <b>Reward if Helpful</b>

  • Regarding dates and selection screen

    Hi all,
    In my selection screen i have 2 date fields(ranges). I have a requirement wherein i have to allow user to select only one date i.e. let the date fields be date1 and date2 when the user enters date1 he should not be allowed to enter date2 and when the user enters date2 then he should not be allowed to enter date1.
    when user enters date1 and tries to enter date2 then a message should be displayed.
    pls urgent requirement and points are gauranteed.
    Regards,
    Ravi

    try this code
    slect-options : sdate1 for mkpf-budat,
                          sdate2 for mkpf-budat.
    parameters : rdate1 radiobutton group rb1 user-command date default 'X',
                       rdate1 radiobutton group rb1.
    at selection-screen output.
    if rdate1 = 'X'.
    loop at screen.
    if screen-name = sdate2-low or screen-name = sdate2-high.
    screen-input = '0'.
    modify screen.
    elseif rdate2 = 'X'.
    loop at screen.
    if screen-name = sdate1-low or screen-name = sdate1-high.
    screen-input = '0'.
    modify screen.
    endif.
    at selection-screen.
    if rdate1 = 'X'.
    clear sdate2[].
    elseif rdate2 = 'X'.
    clear sdate1[].
    endif.
    START-OF-SELECTION.
    regards
    shiba dutta

  • Personalization and Default values in selection screen variables

    Hi everyone,
    I have certain questions regarding Front end part:-
    1)     Can we have multiple personalizations for a single user in Web templates; I know it is quite possible in BEx using Variants. Is there any such approach or any other solutions regarding it?
    2)     In our project we had a range selection screen customer exit variable on 0CALMONTH, which is showing a default value of 07.2007 to 09.2007, although we have removed the default values from the query variable and also checked the customer exits where it is used, but still it’s showing the value. We can’t delete and recreate the variable as such, as it is used in number of function module. Also these values are also transported to Quality system, where also it’s showing the same value.
    Did anyone face such a situation before?
    Eagerly waiting for a solution.....
    Thanks in advance

    Hi Chiran,
    Please try with following approach for multiple   personalizations for a single user in Web templates.
    While Defining Variable Choose the Option Copy personalization data from variable .
    The Features  of above approach is as follows.
    1)It will personalize variable values for Input Variables for each user.
    2)These values are saved for each variable as well as for user.
    3) At the time of defining variable it will allow us to enter one or more default values.All these values are appear in the variable screen when u execute the query or Web Application.
    So you can see the variable values in web also.Just try with this approach.
    May be it will resove u r issue some extent.
    Regarding u r Second Query Just try with Some tables, all the default values entries were saved in those tables. Delete default values from those entries.
    Thanks & Regards,
    Chandu.

  • Default values on selection screen of a SAP Query

    Hello,
    I have a selection screen which is designed in SAP Query.
    How to get default values for the fields on selection screen.
    Regards,
    Satya

    hi....
    you can go with following type of code..
    ITS A TESTED CODE AND WILL SERVE YOUR PURPOSE
    tables: sflight.
    data: t_table like standard table of sflight.
    select-options:
       s_carrid for sflight-carrid.
    parameters:
      p_fldate type d.
    initialization.
    p_fldate = sy-datum - 7.
    s_carrid-sign = 'I'.
    s_carrid-option = 'BT'.
    s_carrid-low = 'AA'.
    s_carrid-high = 'LH'.
    append s_carrid.
    start-of-selection.
    select carrid
              connid
              fldate
    from   sflight
    into corresponding fields of  table t_table
    where carrid in s_carrid
    and fldate < p_fldate.

  • Not accepting date in selection screen

    Hi,
    I'm trying to submit rkaep000 with values to order, expected debit date and display variant in the selection screen. I'm able to fill values to order and display variant but not to the date. Why am I not able to pass the dates????? Tried directly passing then passing as range but still it takes the default date.
            submit rkaep000  via selection-screen
                   WITH p_tcode = 'KOB2'
                   WITH aufnr   in r_aufnr
                 WITH r_obdat in r_date
                    WITH r_obdat-low EQ '01032003'
                    WITH r_obdat-high EQ '01032007'
                    WITH p_disvar = 'SCORP 1404'
                   to sap-spool spool parameters params
                   without spool dynpro
                   and return .

    if r_obdat is a select option have you also tried:
    r_date-low = '20030301'.
    r_date-high = '20070301'.
    r_date-sign = 'I'.
    r_date-option = 'BT'.
    append r_date.
    submit rkaep000 via selection-screen
    WITH p_tcode = 'KOB2'
    WITH aufnr in r_aufnr
    WITH r_obdat in r_date
    WITH p_disvar = 'SCORP 1404'
    to sap-spool spool parameters params
    without spool dynpro
    and return .

  • Validating the Program Run Date on selection screen

    Hi ,
    REGUH-LAUFD field has to be validate on selection screen parameter, for this filed no check table available in REGUH.
    Finally date should be validate through any table as per my concern.
    Could please anyone tell me that which table i have to go for validate the above field.
    Regards,
    sud

    >
    sudsap wrote:
    > Hi ,
    >
    > REGUH-LAUFD field has to be validate on selection screen parameter, for this filed no check table available in REGUH.
    >
    > Finally date should be validate through any table as per my concern.
    >
    > Could please anyone tell me that which table i have to go for validate the above field.
    >
    >
    > Regards,
    > sud
    REGUH-LAUFD is the date that the payment run has created. There is no such foreign key check for this date. If you want, you create your own table and do your checks but not advisable.
    What is your requirement anyway?

Maybe you are looking for