Application Development and Automation 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: 
Read only

date interval in select-option

Former Member
0 Likes
1,188

hi..

i need to select the month interval in select-option.. it should not exceed the particular month..

for eg..

in selection screen:

date : 10.03.2009 to ________________

the high end should be the last day of that particular month..

how to do it..

hi..

i need to select the month interval in select-option.. it should not exceed the particular month..

for eg..

in selection screen:

date : 10.03.2009 to ________________

the high end should be the last day of that particular month..

how to do it..

5 REPLIES 5
Read only

Former Member
0 Likes
779

HI,

use this FM LAST_DAY_OF_MONTHS

Tables syst.
select-OPTIONS : s_date for syst-datum.

DATA l_date TYPE sy-datum.

INITIALIZATION.
CALL FUNCTION 'LAST_DAY_OF_MONTHS'
  EXPORTING
    day_in                  = sy-datum
 IMPORTING
   LAST_DAY_OF_MONTH       = l_date
 EXCEPTIONS
   DAY_IN_NO_DATE          = 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.

s_date-sign = 'I'.
s_date-option = 'BT'.
s_date-low = sy-datum.
s_date-high = l_date.
append s_date.

Read only

GauthamV
Active Contributor
0 Likes
779

Use the fm RP_LAST_DAY_OF_MONTHS to get last day of month

in select options high field and use validation at selection screen to restrict it.

Read only

Former Member
0 Likes
779

Hi,

do coding like this.

DATA: I_DATUM type sy-datum,
          high_date type sy-datum.

  DATA: DATMM TYPE I,
        DATJJ TYPE I,
        REST  TYPE I,
        ZW_TT TYPE I.

i_datum = sy-datum.
  DATMM = I_DATUM+4(2).

  CASE DATMM.
    WHEN 1.  ZW_TT = 31.
    WHEN 2.  ZW_TT = 28.
    WHEN 3.  ZW_TT = 31.
    WHEN 4.  ZW_TT = 30.
    WHEN 5.  ZW_TT = 31.
    WHEN 6.  ZW_TT = 30.
    WHEN 7.  ZW_TT = 31.
    WHEN 8.  ZW_TT = 31.
    WHEN 9.  ZW_TT = 30.
    WHEN 10. ZW_TT = 31.
    WHEN 11. ZW_TT = 30.
    WHEN 12. ZW_TT = 31.
  ENDCASE.

  IF DATMM = 2.
    DATJJ = I_DATUM+0(4).
    REST  = DATJJ MOD 4.
    IF REST = 0.
      ZW_TT = 29.
    ENDIF.
  ENDIF.

  high_date = i_datum.
  high_date+4(2) = zw_tt.

regards,

bharat.

Read only

Former Member
0 Likes
779

select-options: s_date for sy-datum.

initialization.

s_date-low = sy-datum.

CALL FUNCTION 'LAST_DAY_OF_MONTHS'

EXPORTING

day_in = sy-datum

IMPORTING

LAST_DAY_OF_MONTH = s_date-high

  • EXCEPTIONS

  • DAY_IN_NO_DATE = 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.

append s_date.

Read only

Former Member
0 Likes
779

Enough.

Rob