ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 关于时间简单的FUNCTION

关于时间简单的FUNCTION

原创 Linux操作系统 作者:hzq2010 时间:2011-06-25 21:32:00 0 删除 编辑

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME. TITLE TEXT-T01.
  PARAMETERS: P_DATE  TYPE DATUM,               "日期
              P_WEEK  TYPE KWEEK,                        "周
              P_MONTH TYPE KMONTH.                     "月份
SELECTION-SCREEN END OF BLOCK B1.

*&---------------------------------------------------------------------*
*&      Form  FRM_GET_MONTH
*&---------------------------------------------------------------------*
*       text  F4帮助,弹出对话框,选择月份
*----------------------------------------------------------------------*
FORM. FRM_GET_MONTH .

  CALL FUNCTION 'POPUP_TO_SELECT_MONTH'
    EXPORTING
      ACTUAL_MONTH                     = SY-DATUM+0(6)
      LANGUAGE                              = SY-LANGU
    IMPORTING
      SELECTED_MONTH                   = P_MONTH
    EXCEPTIONS
      FACTORY_CALENDAR_NOT_FOUND       = 1
      HOLIDAY_CALENDAR_NOT_FOUND       = 2
      MONTH_NOT_FOUND                            = 3
      OTHERS                                                = 4.

  IF SY-SUBRC <> 0.
    LEAVE LIST-PROCESSING.
  ENDIF.

ENDFORM.                    " FRM_GET_MONTH

*&---------------------------------------------------------------------*
*&      Form  FRM_CHECK_DATE
*&---------------------------------------------------------------------*
*       text  日期检查
*----------------------------------------------------------------------*
FORM. FRM_CHECK_DATE .

  DATA: LC_CHK_DATE TYPE DATUM.

  CONCATENATE P_MONTH '01' INTO LC_CHK_DATE.

  CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
    EXPORTING
      DATE                            = LC_CHK_DATE
    EXCEPTIONS
      PLAUSIBILITY_CHECK_FAILED       = 1
      OTHERS                          = 2.

  IF SY-SUBRC <> 0.
    MESSAGE '非法月份 ' TYPE 'E'.
  ENDIF.

ENDFORM.                    " FRM_CHECK_DATE
*&---------------------------------------------------------------------*
*&      Form  FRM_GET_WEEK
*&---------------------------------------------------------------------*
*       text  F4帮助,弹出对话框,选择周
*----------------------------------------------------------------------*
FORM. FRM_GET_WEEK .

  DATA: LC_MONDAY TYPE SY-DATUM.

* F4帮助,弹出对话框,选择周,返回周一所在日期
  CALL FUNCTION 'POPUP_CALENDAR_SDB'
   EXPORTING
*     SEL_DAY                    =
     SEL_WEEK                   = 'X'
*     SEL_MONTH                  =
*     SEL_INTERVAL               =
*     DAY_INFO                   =
*     SEL_ONLY_MARKED_DAYS       =
     FOCUS_DAY                  = SY-DATUM
   IMPORTING
     BEGIN_DATE                 = LC_MONDAY
*     END_DATE                   =
            .

* 通过日期得到周数
  CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'
    EXPORTING
      DATE          = LC_MONDAY
    IMPORTING
      WEEK          = P_WEEK
*     MONDAY        =
*     SUNDAY        =
            .

ENDFORM.                    " FRM_GET_WEEK

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/leechirslcc/archive/2009/08/05/4410486.aspx

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23495244/viewspace-700734/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 文本编辑器
下一篇: sap 导入 execl技术
请登录后发表评论 登录
全部评论

注册时间:2010-03-11

  • 博文量
    196
  • 访问量
    168719