Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Dates from Selection-option of type date

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

former_member188829
Active Contributor
0 Kudos

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

4 REPLIES 4

Former Member
0 Kudos

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

amit_khare
Active Contributor
0 Kudos

Refer the links -

Regards,

Amit

Reward all helpful replies.

former_member188829
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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