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

Getting Dates from Selection-option of type date

Hi Experts,

I have a requirement where I need to create a select-option for date as below.

select-options s_date for sy-datum.

I have to use this select option and pass each date to a function module. For example, if I give 01-Jan-08 and 10-Jan-08 in the low and high values of select options It need to loop through all the values from 01-Jan to 10-Jan and send it to the function module individually.

Please let me know whether there is any simple way to do this. In this it need to consider extensions as well. Like Single values multiple values, include exclude.

Thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Jan 08, 2008 at 11:45 AM

    Hi,

    TABLES:MARA.

    SELECT-OPTIONS:S_ERDAT FOR MARA-ERSDA.

    DATA:DAY_ATTRIBUTES LIKE CASDAYATTR OCCURS 0 WITH HEADER LINE.

    INITIALIZATION.

    S_ERDAT-LOW = '20080101'.

    S_ERDAT-HIGH = '20080201'.

    S_ERDAT-SIGN = 'I'.

    S_ERDAT-OPTION = 'BT'.

    APPEND S_ERDAT.

    START-OF-SELECTION.

    CALL FUNCTION 'DAY_ATTRIBUTES_GET'

    EXPORTING

    DATE_FROM = S_ERDAT-LOW

    DATE_TO = S_ERDAT-HIGH

    TABLES

    DAY_ATTRIBUTES = DAY_ATTRIBUTES

    EXCEPTIONS

    FACTORY_CALENDAR_NOT_FOUND = 1

    HOLIDAY_CALENDAR_NOT_FOUND = 2

    DATE_HAS_INVALID_FORMAT = 3

    DATE_INCONSISTENCY = 4

    OTHERS = 5

    .

    IF SY-SUBRC <> 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    LOOP AT DAY_ATTRIBUTES.

    WRITE:/ DAY_ATTRIBUTES-DATE. "Pass this date individually

    ENDLOOP.

    Edited by: Vishnu Reddy on Jan 8, 2008 6:10 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2008 at 11:42 AM

    Hi Eswar,

    U can use Single values multiple values both. No problem.

    Store in the range. & append into int table.

    loop at itab.

    call function 'xxxxxx........'

    endloop.

    If it is usefull reward pts pls.

    Regards

    Srimanta

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 08, 2008 at 11:42 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2008 at 12:38 PM

    Hi you can do this,

    Loop at s_date.

    pass s_date-low to FM.

    pass s_date-high to FM.

    ENDLOOP.

    This is the most easiest method.

    let me if it is useful and reward if helful.

    Thanks & Regards,

    Ramya

    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.