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: 

Select options : period restriction

Former Member
0 Kudos

Hi,

I have one select option Inventory period(S_INVPRD) in my selection screen.

I want to restrict the date range to one year period. i.e the user should not be allowed to enter the date range which is more than one year.

Could you please help on this.

Regards,

Sankar

1 ACCEPTED SOLUTION

Former Member
0 Kudos

in event.

at-selection on S_INVPRD

use FM to find difference between S_INVPRD-high and S_INVPRD-low

if diff is greater than 365 days

give error messafe

tc

saji

4 REPLIES 4

Former Member
0 Kudos

in event.

at-selection on S_INVPRD

use FM to find difference between S_INVPRD-high and S_INVPRD-low

if diff is greater than 365 days

give error messafe

tc

saji

Former Member
0 Kudos

May i know the FM name, because i tried to use the FM /SDF/CMO_DATETIME_DIFFERENCE, but it is returning 0 value.

Former Member
0 Kudos

Hi,

Please you the code below :

data : days type i,
       year type i.

select-OPTIONS : so_budat for bsis-budat.

at SELECTION-SCREEN.

 CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'
   EXPORTING
     beg_da              = so_budat-low
     end_da              = so_budat-high
  IMPORTING
    NO_DAY              = days
*    NO_MONTH            = month
    NO_YEAR             = year
*    NO_CAL_DAY          =
*  EXCEPTIONS
*    DATEINT_ERROR       = 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.

IF YEAR > 1.
  MESSAGE 'More than One Year' type 'E'.
endif.

if days > 0.
  message 'More than one year' type 'E'.
endif.

Thanks,

Sriram Ponna.

Former Member
0 Kudos

Thanks. solved