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

Previous working day

Former Member
0 Likes
789

Hi,

Can anyone please tell me how to get previous working day which is calculated by Mon to Fri working day calendar.

Many Thanks,

Sharath

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
706

Hello

Try this



  CALL FUNCTION 'DAY_IN_WEEK'
    EXPORTING
      datum = your_date
    IMPORTING
      wotnr = day.

CHECK DAY BETWEEN 1 AND 5.

OR---->

  SELECT datum
  INTO   day
  FROM   thoc
  WHERE  ident EQ 'IC' AND
         datum EQ your_date.
  ENDSELECT.

  IF sy-subrc EQ '0'.
    ANS = 'F'. " Holiday
  ELSE.
    ANS = 'X'. " Labor day
  ENDIF.

Cheers!

Gabriel P.

Edited by: Gabriel Fernando Pulido V. on Sep 9, 2008 1:42 PM

Use FM BKK_ADD_WORKINGDAY

Pass negative 1 in the I_DAYS parameter.

Like:


  DATA:            C_DATE      TYPE I VALUE  -1.
  CALL FUNCTION 'BKK_ADD_WORKINGDAY'
    EXPORTING
      I_DATE            = SY-DATUM
      I_DAYS            = C_DATE
      I_CALENDAR1       = C_FCAL
*     I_CALENDAR2       =
    IMPORTING
       E_DATE           = WA_WORKDAYS

Regards,

Naimesh Patel

2 REPLIES 2
Read only

Former Member
0 Likes
707

Hello

Try this



  CALL FUNCTION 'DAY_IN_WEEK'
    EXPORTING
      datum = your_date
    IMPORTING
      wotnr = day.

CHECK DAY BETWEEN 1 AND 5.

OR---->

  SELECT datum
  INTO   day
  FROM   thoc
  WHERE  ident EQ 'IC' AND
         datum EQ your_date.
  ENDSELECT.

  IF sy-subrc EQ '0'.
    ANS = 'F'. " Holiday
  ELSE.
    ANS = 'X'. " Labor day
  ENDIF.

Cheers!

Gabriel P.

Edited by: Gabriel Fernando Pulido V. on Sep 9, 2008 1:42 PM

Read only

naimesh_patel
Active Contributor
0 Likes
706

Use FM BKK_ADD_WORKINGDAY

Pass negative 1 in the I_DAYS parameter.

Like:


  DATA:            C_DATE      TYPE I VALUE  -1.
  CALL FUNCTION 'BKK_ADD_WORKINGDAY'
    EXPORTING
      I_DATE            = SY-DATUM
      I_DAYS            = C_DATE
      I_CALENDAR1       = C_FCAL
*     I_CALENDAR2       =
    IMPORTING
       E_DATE           = WA_WORKDAYS

Regards,

Naimesh Patel