Thursday, February 21, 2008

Modifying the F4 standard calendar using sap abap

When you press F4 on any date field the standard calendar opens in order for you to choose a date. When you do not want the user to choose a weekend day or a holiday, you can do it.

Two different type of calendars are defined in SAP, the holiday calendar and the factory calendar.

These calendars are defined in the customizing under :

SPRO -> General settings -> maintain calendar

in this screen, all the default holidays are predefined by country, you can add or delete holiday as you want. I tried to create the Dany's day in ISP but I'm stuck on a small access problem... stupid security !

Because a holiday can be different by country, the factory calendar is stored for each plants, in table T001W, field FABKL.

here is a small example on how to call the calendar :

CALL FUNCTION 'F4_DATE'
   EXPORTING
     date_for_first_month = '20031208'
holiday_calendar_id = 'CA'           "<<==-- Here is how you point on a holiday calendar
*     factory_calendar_id = T001W-FABKL    "<<==-- ... or a factory one
     display = ' '
   IMPORTING
     select_date = select_date
   EXCEPTIONS
     OTHERS = 4.

Here is an example of the result, a red square marks each holiday.

When you press F4 on any date field the standard calendar opens in order for you to choose a date. When you do not want the user to choose a weekend day or a holiday, you can do it.

Two different type of calendars are defined in SAP, the holiday calendar and the factory calendar.

These calendars are defined in the customizing under :

SPRO -> General settings -> maintain calendar

in this screen, all the default holidays are predefined by country, you can add or delete holiday as you want. I tried to create the Dany's day in ISP but I'm stuck on a small access problem... stupid security !

Because a holiday can be different by country, the factory calendar is stored for each plants, in table T001W, field FABKL.

here is a small example on how to call the calendar :

CALL FUNCTION 'F4_DATE'
   EXPORTING
     date_for_first_month = '20031208'
holiday_calendar_id = 'CA'           "<<==-- Here is how you point on a holiday calendar
*     factory_calendar_id = T001W-FABKL    "<<==-- ... or a factory one
     display = ' '
   IMPORTING
     select_date = select_date
   EXCEPTIONS
     OTHERS = 4.

Here is an example of the result, a red square marks each holiday.

No comments:

Post a Comment