cancel
Showing results for 
Search instead for 
Did you mean: 

customer exit on 0calday

Former Member
0 Kudos

Hi,

This is Madhavi. Plz help me to find out the solution for this.

Create an exit on 0CALDAY. Default this value to Be current Monday of the week and popup to user.Validate User input with the Monday of the week.If its not a Monday give an error asking to enter Monday of that week

Thanks and Regards,

Madhu

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

try the following:



DATA: loc_var_range LIKE rrrangeexit.

WHEN 'YOURVAR'.

IF I_STEP = 1.

  DATA: l_curr_week LIKE SCAL-WEEK.
  DATA: l_day TYPE DATS.

  CALL FUNCTION 'DATE_GET_WEEK'
    EXPORTING
      date               = SY-DATUM
   IMPORTING
     WEEK               = l_curr_week.

  CALL FUNCTION 'WEEK_GET_FIRST_DAY'
    EXPORTING
      week               = l_curr_week
   IMPORTING
     DATE               = l_day.

  CLEAR l_s_range.
  l_s_range-sign = 'I'.
  l_s_range-opt = 'EQ'.
  l_s_range-low = l_day.
  append l_s_range to e_t_range.
ENDIF.

IF I_STEP = 3.

  DATA: l_weekday LIKE  SCAL-INDICATOR.
 
  READ TABLE I_T_VAR_RANGE INTO loc_var_range 
  WITH KEY vnam = 'YOURVAR'.

  CALL FUNCTION 'DATE_COMPUTE_DAY'
    EXPORTING
      DATE = loc_var_range-low
    IMPORTING
      DAY = l_weekday.

    IF l_weekday <> 1.
        raise THIS_IS_NOT_A_MONDAY.
    ENDIF.

ENDIF.

this should work...

Olivier.

Former Member
0 Kudos

Hi,

Thank u very much for ur quick replies.

assigned points.

Thanks and Regards,

Madhu

Former Member
0 Kudos

Hi,

Try the below code, this may help you.

data: l_curr_day type SCAL-DATE,

l_date type /BI0/OICALDAY,

l_no_day type SCAL-indicator,

l_day1 type P,

l_diff type P,

l_daym type /OSP/DT_DAY,

l_day(2),

l_month type /BI0/OIFISCPER3,

l_year(4),

l_curr_month type i,

l_curr_year type i,

l_month_temp type i,

l_year_temp type i,

l_s_range type rsr_s_rangesid,

l_s_var_range type line of rrs0_t_var_range.

if i_step = 1. "Before Selection screen is shown

l_curr_day = sy-datum.

l_curr_month = sy-datum+4(2).

l_curr_year = sy-datum+0(4).

CALL FUNCTION 'DATE_COMPUTE_DAY'

EXPORTING

DATE = l_curr_day

IMPORTING

DAY = l_no_day.

if l_no_day = 1.

l_s_range-sign = 'I'.

l_s_range-opt = 'EQ'.

l_s_range-low = l_curr_day.

l_s_range-high = ''.

append l_s_range to e_t_range.

else.

l_day1 = sy-datum+6(2).

l_diff = l_day1 - l_no_day + 1.

if l_diff > 0.

clear l_date.

l_day = l_diff.

l_month = l_curr_month.

l_year = l_curr_year.

concatenate l_year l_month+1(2) l_day into l_date.

else.

l_month_temp = l_curr_month - 1.

if l_month_temp > 0.

l_day = l_day1.

l_month = l_month_temp.

l_year = l_curr_year.

concatenate l_year l_month+1(2) l_day into l_date.

CALL FUNCTION '/OSP/GET_DAYS_IN_MONTH'

EXPORTING

IV_DATE = l_date

IMPORTING

EV_DAYS = l_daym.

l_diff = l_diff + l_daym.

l_day = l_diff.

concatenate l_year l_month+1(2) l_day into l_date.

else.

l_year = l_curr_year - 1.

l_day = l_day1.

concatenate l_year '12' l_day into l_date.

CALL FUNCTION '/OSP/GET_DAYS_IN_MONTH'

EXPORTING

IV_DATE = l_date

IMPORTING

EV_DAYS = l_daym.

l_diff = l_diff + l_daym.

l_day = l_diff.

concatenate l_year '12' l_day into l_date.

endif.

endif.

clear l_s_RANGE.

l_s_range-sign = 'I'.

l_s_range-opt = 'EQ'.

l_s_range-low = l_date.

l_s_range-high =''.

append l_s_range to e_t_range.

endif.

endif.

if i_step = 3. " Validate user input

read table I_T_VAR_RANGE into l_s_var_range with key vnam = 'YTSTDAY'.

if sy-subrc = 0.

l_curr_day = l_s_var_range-low.

CALL FUNCTION 'DATE_COMPUTE_DAY'

EXPORTING

DATE = l_curr_day

IMPORTING

DAY = l_no_day.

if l_no_day <> 1.

raise NOT_MONDAY.

endif.

endif.

endif.

endfunction.

regards

rajesh