其他分享
首页 > 其他分享> > ABAP DAY_ATTRIBUTES_GET 计算工作日数

ABAP DAY_ATTRIBUTES_GET 计算工作日数

作者:互联网

 

DATA :P_FROM TYPE SY-DATUM,
      P_TO   TYPE SY-DATUM,
      IT_TAB TYPE STANDARD TABLE OF CASDAYATTR,
      L_DAYS TYPE I.

CALL FUNCTION 'DAY_ATTRIBUTES_GET'
    EXPORTING
        DATE_FROM                  = P_FROM "开始日期
        DATE_TO                    =  P_TO "结束日期
        LANGUAGE                   = SY-LANGU
    TABLES
        DAY_ATTRIBUTES             = LT_TAB
    EXCEPTIONS
        FACTORY_CALENDAR_NOT_FOUND = 1
        HOLIDAY_CALENDAR_NOT_FOUND = 2
        DATE_HAS_INVALID_FORMAT    = 3
        DATE_INCONSISTENCY         = 4
        OTHERS                     = 5.
IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DELETE LT_TAB WHERE WEEKDAY = 6 OR WEEKDAY = 7. 
DESCRIBE TABLE LT_TAB LINES L_DAYS.
L_DAYS = L_DAYS - 1.
CLEAR LT_TAB[].

 

标签:SY,GET,LT,DAYS,ABAP,TAB,DATE,ATTRIBUTES,TYPE
来源: https://www.cnblogs.com/rainysblog/p/16244823.html