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: 

Previous working day

Former Member
0 Kudos

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

Former Member
0 Kudos

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

2 REPLIES 2

Former Member
0 Kudos

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

naimesh_patel
Active Contributor
0 Kudos

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