Skip to Content

The answer is yes.

We can display/highlight public holidays in F4 help for date based on the country calendar.

This can be done by assigning factory calendar Id to the function module “F4_DATE”.

Before assigning the factory calendar id, the F4 help for date is as below.

/wp-content/uploads/2013/06/1_233332.png

Here is the sample code –


PARAMETERS p_date TYPE workflds-gkday.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_date.
  CALL FUNCTION 'F4_DATE'
    EXPORTING
      date_for_first_month         = sy-datum
      factory_calendar_id          = 'IN'  " 'IN' for India
    IMPORTING
      select_date = p_date
    EXCEPTIONS
      calendar_buffer_not_loadable = 1
      date_after_range             = 2
      date_before_range            = 3
      date_invalid                 = 4
      factory_calendar_not_found   = 5
      holiday_calendar_not_found   = 6
      parameter_conflict           = 7
      OTHERS                       = 8.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

 

Output:

Execute the program and press F4.

/wp-content/uploads/2013/06/2_233345.png

In this way, we can highlight the holidays based on the country in the date input help.

Note: We can see all the factory calendar ids at the transaction SCAL.

To report this post you need to login first.

45 Comments

You must be Logged on to comment or reply to a post.

  1. Jelena Perfiljeva

    I actually didn’t know about this option – thanks for sharing. The only thing in the code example I believe you’re missing IMPORTING part. Also you might want to highlight the code (there is an option in the editor), so that it doesn’t look like plain text.

    (0) 
    1. Jayshree Mahajan Post author

      Thank you Jelena. I have edited the piece of code as per your suggestions. No need  to add IMPORTING parameter, it serves our purpose.

      Thanks,

      Jayshree.

      (0) 
  2. John K

    Hi,

      It’s very helpful to know the new things on ABAP. And also is it possible to Highlight the day of Saturday and Sunday of each month.

    Warm Regards,

    John.

    (0) 
    1. Jayshree Mahajan Post author

      Hi John,

      To highlight Saturday and sunday of each month I think we need to define the Factory calender and assign such holiday calender to it.

      Thanks,

      Jayshree.

      (0) 
    1. Ravi Shankar

      Hi,

      I tried this in SE37, for me it shows ordinary calendar not showing leave details please help me how to do it.

      Regards,

      Ravi Shankar L

      (0) 
  3. John K

    Hi Jayshree,

        I’m using same code like below, while pressing F4 help it will not display and highlighted  the date but with out passing the factory_calendar_id = ‘IN’ it display the date. Kindly help me.

    I’m using your same code.

    Warm Regards,

    John.

    (0) 
    1. Jayshree Mahajan Post author

      Hi John,

      Please go to transaction SCAL and check whether IN factory calender id exists or not, in your system or try with calender id IE.

      Thanks and Regards,

      Jayshree.

      (0) 
  4. Shai Sinai

    Hi,

    Thanks for sharing. I wasn’t aware of this feature.

    It seems that you may achieve the same result with less effort:

    Just call FM CALENDER_FOR_F4_DATE during INITIALIZATION (Instead of implementing VALUE-REQUEST by yourself).

    FYI,

    Shai

    (0) 

Leave a Reply