Monday, May 12, 2008

SAP ABAP Function Module to POUP a Calender as per the selected Calender

SAP ABAP Function Module to POPUP a Calender as per the selected Calender

If you wish to display a calender so that the user can choose the date from the POPUP it can be done with the help of the following function module.

F4_DATE

You can select the date from the POPUP, the transaction code SCAL can be used to display Public Holidays, Holiday Calender, Factory Calender.

The following program shows the various Parameters Passed to the function module.


REPORT ZEX_CALENDERPOPUP .


Parameters: p_date like sy-datum.

Data: d_seldate like WORKFLDS-GKDAY,
      d_sweek   like SCAL-WEEK.


      CALL FUNCTION 'F4_DATE'
       EXPORTING
         DATE_FOR_FIRST_MONTH               = p_date
         DISPLAY                            = 'X'
         FACTORY_CALENDAR_ID                = 'BR'
*         GREGORIAN_CALENDAR_FLAG            = ' '
         HOLIDAY_CALENDAR_ID                = '11'
*         PROGNAME_FOR_FIRST_MONTH           = ' '
       IMPORTING
         SELECT_DATE                        = d_seldate
*         SELECT_WEEK                        =
*         SELECT_WEEK_BEGIN                  =
*         SELECT_WEEK_END                    =
        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.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.


No comments:

Post a Comment