Skip to Content
Author's profile photo Former Member

Can we display holidays in F4 help for date?

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.

Assigned Tags

      45 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Jelena Perfiljeva
      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.

      Author's profile photo Former Member
      Former Member
      Blog 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.

      Author's profile photo Jelena Perfiljeva
      Jelena Perfiljeva

      Well, technically it's optional, but without IMPORTING how would you pass selected value to the parameter?

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      updated the code.. 🙂

      Author's profile photo John K
      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.

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thank you John..!

      Author's profile photo Former Member
      Former Member
      Blog 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.

      Author's profile photo Former Member
      Former Member

      how about making this changes in Standard F4 Help.

      Author's profile photo Former Member
      Former Member

      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

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      did you pass FACTORY_CALENDER_ID correctly?

      Author's profile photo Former Member
      Former Member

      FACTORY_CALENDER_ID=>'IN' is not found even in SCAL transaction

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Try any other FACTORY_CALENDER_ID which exists in your system. or you can try with 'IE'.

      Author's profile photo Former Member
      Former Member

      Good one..Thank You 🙂

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thank you Satya..!

      Author's profile photo Engin Akdeniz
      Engin Akdeniz

      Good post. Thank You 😉

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thank you Engin... 🙂

      Author's profile photo Kaushalya Perera
      Kaushalya Perera

      Nice post!  It's really helpful trick for the enduser, to show the holidays as highlighted in the calendar picker.

      Thank u for sharing! 🙂

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thank you Kaushalya....!!!!

      Author's profile photo Neha Sinha
      Neha Sinha

      Nice Post 🙂

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thank you Neha..!!

      Author's profile photo John K
      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.

      Author's profile photo Former Member
      Former Member
      Blog 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.

      Author's profile photo Former Member
      Former Member

      Nice one.

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thank you Gurunath..!!

      Author's profile photo Former Member
      Former Member

      Jayshree Mahajan

      Nice Blog 🙂

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thank you Bastin..!

      Author's profile photo Former Member
      Former Member

      Good piece of information... ℹ

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thank you Danny..!!

      Author's profile photo Amarnadh Reddy K
      Amarnadh Reddy K

      thank you Danny..

      Author's profile photo Former Member
      Former Member

      thanks Danny 

      Author's profile photo Former Member
      Former Member

      very useful piece of information.. 🙂

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thank you Abhishek..!!

      Author's profile photo Former Member
      Former Member

      Thanks Jayshree very useful information sharing.

      Regards

      Viswanathan S.

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thank you Viswanathan..!!

      Author's profile photo VIJAYKRISHNA GUDALA
      VIJAYKRISHNA GUDALA

      Hi Jayshree,

      Good blog, very useful info. Thanks

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thank you Vijaykrishna...!!!

      Author's profile photo Former Member
      Former Member

      Hi Jayshree,

      Nice blog...... 🙂

      Author's profile photo Gaurab Banerji
      Gaurab Banerji

      i used to know this when i was a fresher... but i forgot

      thanks for "total recall" 😀

      nice post btw...

      Author's profile photo Debopriya Ghosh
      Debopriya Ghosh

      Hi Jayshree,

      Nice helpful document...

      Regards,

      Debopriya Ghosh

      Author's profile photo Former Member
      Former Member

      Hi,

      really looks simple but very useful in reports.Thanks:)

      Author's profile photo Philip Davy
      Philip Davy

      Hi Jayshree,

      Very useful in real time programming.

      Regards,

      Philip.

      Author's profile photo Former Member
      Former Member

      Nice One

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thank you all.. 🙂

      Author's profile photo Former Member
      Former Member

      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

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thanks for sharing FM name.. 🙂