Skip to Content
author's profile photo Former Member
Former Member

providing month in select options

In select-options i want to provide months instead of date field,how can i achieve this . and how do i use that in select query .

is there any way like this

SELECT-OPTIONS:s_erdat FOR vbak-erdat+4(2),

SELECT SUM( BDMNG ) AS BDMNGT FROM RESB INTO CORRESPONDING FIELDS OF IT_MRP

where month( erdat ) in s_erdat.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

9 Answers

  • Best Answer
    Posted on Apr 29, 2010 at 10:31 AM

    Hi,

    In the selection screen place a listbox starting from Jan to Dec.

    If the user select Jan then the corresponding value must be 1. That we are setting when we are appending the values to the listbox.

    PARAMETERS : dr1 as LISTBOX VISIBLE LENGTH 20,

    dr2 as LISTBOX VISIBLE LENGTH 20.

    DATA : lv_values TYPE vrm_values,

    lv_values1 TYPE vrm_values,

    gw_values like LINE OF lv_values.

    AT SELECTION-SCREEN OUTPUT.

    gw_values-key = '1'.

    gw_values-text = 'Jan'.

    append gw_values to lv_values.

    gw_values-key = '2'.

    gw_values-text = 'Feb'.

    append gw_values to lv_values.

    gw_values-key = '3'.

    gw_values-text = 'Mar'.

    append gw_values to lv_values.

    CALL FUNCTION 'VRM_SET_VALUES'

    EXPORTING

    ID = 'dr1'

    VALUES = lv_values

    EXCEPTIONS

    ID_ILLEGAL_NAME = 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.

    Provide a parameter for entering the year and the date.

    Then concatenate all these three into a another variable.

    use the concatenated variable for selecting the value.

    With Regards,

    Sumodh.P

    Edited by: Sumodh P on Apr 29, 2010 12:32 PM

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Sumodh,

      In the selection screen place a listbox starting from Jan to Dec.

      Provide a parameter for entering the year and the date.
      
      Then concatenate all these three into a another variable.
      
      use the concatenated variable for selecting the value.

      How would it be different than directly giving the DATE itself on selection screen?

      Sumit.

  • author's profile photo Former Member
    Former Member
    Posted on Apr 29, 2010 at 10:17 AM

    HI,

    for selection screen take it type i and put a check that value should not be greater than 12 and less than eq 0.

    and in select query i have never seen offset so jst select data an filter it based on offset +4(2) as per selection criteria.

    reply for further help.

    Edited by: gaurav.singh on Apr 29, 2010 12:23 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 29, 2010 at 11:24 AM

    Hi,

    Try this code,

    
    data w_month type AM_MONAT.
    select-options s_month for w_month.
    

    AM_MONAT is data element with Month Values.

    Hope This helps You.

    Regards,

    Raghava Channooru

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 29, 2010 at 10:19 AM

    HI,

    Try this--

    1) Get the month number(from selection screen) and pass it to FM HR_E_NUM_OF_DAYS_OF_MONTH.
    You will get the number of days in month say V_DAYS_NO.
    
    2) Concatenate 01 with the month(on sel screen) and year (has to be on selection screen) and copy into FRM_DATE(type D).
    
    3) Then concatenate   V_DAYS_NO with month and year and copy into TO_DATE(type D).
    
    
    4) Now fire the select query--
    
    SELECT SUM( BDMNG ) AS BDMNGT FROM RESB INTO CORRESPONDING FIELDS OF IT_MRP
    where erdat >= FRM_DATE and erdate <= TO_DATE.

    It will fetch the records for all dates between these two dates.

    Regards,

    Sumit.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 29, 2010 at 10:20 AM

    Hi

    You can do this:

    Just afterwards you should loop on s_erdat and concatenate month with day and year because of the field format.

    Best Regards

    Yossi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 29, 2010 at 10:26 AM

    hi,

    for this you have to append the value in the select in the initialization.

    hope this helps

    Regards

    Ritesh

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 29, 2010 at 10:56 AM

    Hi,

    Create your select option with character type and length 2. Provide explicit F4 help by getting the data from table T015M (where you have language dependent month descriptions also) and FM F4IF_INT_TABLE_VALUE_REQUEST.

    Thanks,

    Vinod.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 04, 2010 at 06:33 AM

    Thanks Everyone...

    I created a field called months in the ITAB and appended months from budat and then i checked with months in select options

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 03, 2012 at 05:48 AM

    Kindly Try this code for Month and year as input and having standard F4 help..

    INCLUDE RMCS0F0M.

    TYPES : BEGIN OF TY_SELECT,

    MONTH TYPE FTI_MONTH_YEAR,

    END OF TY_SELECT.

    DATA : WA_SELECT TYPE TY_SELECT.

    SELECTION-SCREEN : BEGIN OF BLOCK SANDEEP WITH FRAME.

    SELECT-OPTIONS : S_MONTH FOR WA_SELECT-MONTH OBLIGATORY NO INTERVALS NO-EXTENSION.

    SELECTION-SCREEN : END OF BLOCK SANDEEP.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_MONTH-LOW.

    PERFORM MONAT_F4.

    -


    SANDEEP JAIN

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.