Working days
form FRM_GET_WORKING_DAYS
TABLES pt_days
CHANGING pv_duration.
DATA:ls_xt001w TYPE t001w,
lv_sdate TYPE sy-datum,
lv_edate TYPE sy-datum.
* Get the factory calendar for specific plant
SELECT SINGLE * FROM t001w INTO ls_xt001w
WHERE werks IN s_plant. " Use your plant
* Set start date
CONCATENATE sy-datum+0(6) '01' INTO lv_sdate.
* End date
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = lv_sdate
days = 0
months = 1
signum = '+'
years = 0
IMPORTING
calc_date = lv_edate
EXCEPTIONS
OTHERS = 2.
* Get working days in between
CALL FUNCTION 'DURATION_DETERMINE'
EXPORTING
factory_calendar = ls_xt001w-fabkl
IMPORTING
duration = pv_duration " In days
CHANGING
start_date = lv_sdate
end_date = lv_edate
EXCEPTIONS
factory_calendar_not_found = 1
date_out_of_calendar_range = 2
date_not_valid = 3
unit_conversion_error = 4
si_unit_missing = 5
parameters_not_valid = 6
OTHERS = 7.
WHILE lv_sdate < lv_edate.
CALL FUNCTION 'DATE_CHECK_WORKINGDAY'
EXPORTING
date = lv_sdate
factory_calendar_id = ls_xt001w-fabkl
message_type = 'I'
EXCEPTIONS
DATE_AFTER_RANGE = 1
DATE_BEFORE_RANGE = 2
DATE_INVALID = 3
DATE_NO_WORKINGDAY = 4
FACTORY_CALENDAR_NOT_FOUND = 5
MESSAGE_TYPE_INVALID = 6
OTHERS = 7
.
IF sy-subrc eq 0.
append lv_sdate to pt_days.
ENDIF.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = lv_sdate
days = 1
months = 0
signum = '+'
years = 0
IMPORTING
calc_date = lv_sdate
EXCEPTIONS
OTHERS = 2.
ENDWHILE.
endform.
We can get working days easily by 'describe table lines ' of pt_days ,this is merely a demo of FM usage,not making an unnecessary move
随机推荐
- MySQL Event--Event and EventScheduler
MySQL Event 创建EVENT语法: CREATE [DEFINER = { user | CURRENT_USER }] EVENT [IF NOT EXISTS] event_name O ...
- Redis 集群知识点及命令
Redis 集群命令 备注 cluster nodes 查看集群包含的节点 cluster meet <ip> <port> 将 ip 和 port 所指定的节点添加到 nod ...
- anaconda 在内网中代理配置
修改anaconda的配置文件,位置在c:\User(或“用户”)\current_user(当前用户)\.condarc,将以下内容拷贝进去, 替换原有内容, 修改 http://proxy.you ...
- ubuntu16.04下docker安装和简单使用
前提条件 操作系统 docker-ce支持的ubuntu版本: Bionic 18.04 (LTS) Xenial 16.04 (LTS) Trusty 14.04 (LTS) 卸载旧版本docker ...
- windows server系统查看tomcat版本
线上服务器系统是windows server版本,由于tomcat进行了apache httpd集群,所以对tomcat进行了统一编号: 在jprofiler中需要监听一个server实例,需要先搞清 ...
- IDEA—— 找不到或无法加载主类Main
最近使用idea,编写了一个项目,发现老是找不到main,网上找了一大圈的解决方案,都不行.灵机一动升级了jdk就可以了,之前用的是1.7的,换成了1.8的就好了.
- 在pycharm_2018.2版本中开启Flask的debug的方法 (不要用命令:python **.py启动)
断点后,先ctl+c关闭控制台程序,再点击debuger调试 问题描述:在pycharm_2018.2版本中,我明确开启了debug,代码如下所示: from flask import Flask a ...
- MySQL Antelope和Barracuda的区别分析
Antelope是innodb-base的文件格式,Barracude是innodb-plugin后引入的文件格式,同时Barracude也支持Antelope文件格式.两者区别在于: 文件格式 支持 ...
- 有哪些你不知道的python小工具
python作为越来越流行的一种编程语言,不仅仅是因为它语言简单,有许多现成的包可以直接调用. python中还有大量的小工具,让你的python工作更有效率. 1.- 快速共享 - HTTP服务器 ...
- CPU与内存互联的架构演变
随着计算机中CPU核数目的增加,传统的UMA(unifonn memory access)架构由于对关键硬件(如中央内存控制器)的竞争加剧出现了性能上的瓶颈,即扩展性不强.而NUMA架构则以其良好的可 ...