cancel
Showing results for 
Search instead for 
Did you mean: 

Get workday

flvia_s
Participant
0 Kudos

Hello there,

I'm trying to find out a function that returns the first workday of a month. Does anyone know how to do it?

I've found function 'BKK_GET_NEXT_WORKDAY' but I don't know were to find the information to fill field I_CALENDAR1.

I would apreciate any information!

Regards,

Flavia

Accepted Solutions (1)

Accepted Solutions (1)

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You can do something like this.



report zrich_0001.

data: wdind(1) type c.
parameters: p_datum type sy-datum default '20060401'.

start-of-selection.

  do.

    call function 'DATE_CONVERT_TO_FACTORYDATE'
         exporting
              date                 = p_datum
              factory_calendar_id  = 'P6'  " use a valid fact cal
         importing
              workingday_indicator = wdind
         exceptions
              others               = 7.

    if wdind = space.
      write:/ 'First Working Day of Month is:',  p_datum.
      exit.
    endif.

    p_datum = p_datum + 1.

  enddo.

Regards,

Rich Heilman

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You can get a valid factory calendar by checking out T001W.

Regards,

Rich Heilman

Answers (2)

Answers (2)

flvia_s
Participant
0 Kudos

You were all right. I was using a wrong Calendar code.

Regards,

Flavia

flvia_s
Participant
0 Kudos

Rich,

Thanks for your help!

I think that your example is not working, the condition "if wdind = space" seems always to be true, even to dates like 20061225.

Regards,

Flavia

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

It all depends on your factory calendar. In my system that code works really good.

Regards,

Rich Heilman

suresh_datti
Active Contributor
0 Kudos

Hi,

Rich's code works perfect.. Pl check the Facctory Calendar that is relevant in your case in the Table TFACD and pass that value to the above funcion module.

Regards,

Suresh Datti