`
zjut_xiongfeng
  • 浏览: 287303 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Function modules: Date and Time

阅读更多
if (window.name != "content") document.write("

Click here to show toolbars of the Web Online Help System: show toolbars

"); <!-- !chm2web! -->

Function modules: Date and Time

Get a date

  • DATE_GET_WEEK Returns week for a date
  • WEEK_GET_FIRST_DAY Returns first day for a week
  • RP_LAST_DAY_OF_MONTHS Returns last day of month
  • FIRST_DAY_IN_PERIOD_GET Get first day of a period
  • LAST_DAY_IN_PERIOD_GET Get last day of a period
  • RP_LAST_DAY_OF_MONTHS Determine last day of month

Date calculations

  • DATE_COMPUTE_DAY Returns a number indicating what day of the week the date falls on. Monday is returned as a 1, Tuesday as 2, etc.
  • DATE_IN_FUTURE Calculate a date N days in the future.
  • RP_CALC_DATE_IN_INTERVAL Add days/months to a date
  • RP_CALC_DATE_IN_INTERVAL Add/subtract years/months/days from a date
  • SD_DATETIME_DIFFERENCE Give the difference in Days and Time for 2 dates
  • MONTH_PLUS_DETERMINE Add or subtract months from a date. To subtract a month, enter a negative value for the 'months' parameter.

  • DATE_CREATE Calculates a date from the input parameters:

Example: DATE_CREATE

CALL FUNCTION 'DATE_CREATE'
 EXPORTING
   anzahl_jahre  = 1
   anzahl_monate = 2
   anzahl_tage   = 3
   datum_ein     = '20010101'
 IMPORTING
   datum_aus     = l_new_date.
   Result:
   l_new_date = 20020304

Example: MONTH_PLUS_DETERMINE

data: new_date type d.

CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
months = -5 " Negative to subtract from old date, positive to add

olddate = sy-datum
IMPORTING
NEWDATE = new_date.

write: / new_date.


Hollidays

  • HOLIDAY_GET Provides a table of all the holidays based upon a Factory Calendar &/ Holiday Calendar.
  • HOLIDAY_CHECK_AND_GET_INFO Useful for determining whether or not a date is a holiday. Give the function a date, and a holiday calendar, and you can determine if the
    date is a holiday by checking the parameter HOLIDAY_FOUND.

Example: HOLIDAY_CHECK_AND_GET_INFO

data: ld_date                 like scal-datum  default sy-datum,
      lc_holiday_cal_id       like scal-hcalid default 'CA',
      ltab_holiday_attributes like thol occurs 0 with header line,
      lc_holiday_found        like scal-indicator.

CALL FUNCTION 'HOLIDAY_CHECK_AND_GET_INFO'
  EXPORTING
    date                               = ld_date
    holiday_calendar_id                = lc_holiday_cal_id
    WITH_HOLIDAY_ATTRIBUTES            = 'X'

  IMPORTING
    HOLIDAY_FOUND                      = lc_holiday_found
  tables
    holiday_attributes                 = ltab_holiday_attributes
  EXCEPTIONS
    CALENDAR_BUFFER_NOT_LOADABLE       = 1
    DATE_AFTER_RANGE                   = 2
    DATE_BEFORE_RANGE                  = 3
    DATE_INVALID                       = 4
    HOLIDAY_CALENDAR_ID_MISSING        = 5
    HOLIDAY_CALENDAR_NOT_FOUND         = 6
    OTHERS                             = 7.

if sy-subrc = 0 and

   lc_holiday_found = 'X'.
  write: / ld_date, 'is a holiday'.
else.
  write: / ld_date, 'is not a holiday, or there was an error calling the function'.
endif.

Checking dates

  • DATE_CHECK_PLAUSIBILITY Check to see if a date is in a valid format for SAP. Works well when validating dates being passed in from other systems.

Converting dates

  • DATE_CONV_EXT_TO_INT Conversion of dates to SAP internal format e.g. '28.03.2000' -> 20000328 Can also be used to check if a date is valid ( sy-subrc <> 0 )

Function to return literal for month

he table you want to use is T247. You can also use the function MONTH_NAMES_GET. [ Monique Goodrich ,posted to SAP listserver]

You can also try table T015M. It has the month number in it's key.
[Walter Barr , posted to SAP listserver]

Formatting

  • DATUMSAUFBEREITUNG Format date as the user settings

Other

  • MONTH_NAMES_GET It returns all the month and names in repective language.

分享到:
评论

相关推荐

    Python 2.6 Quick Reference (Letter) (2009).pdf

    named tuples, date/time ?Advanced types ?Statements: assignment, conditional expressions, control flow, exceptions, name space, function def, class def ?Iterators; Generators; Descriptors; ...

    Google C++ Style Guide_英文版.pdf

    - **Other C++ Features:** Explore other advanced C++ features like concepts, modules, and coroutines as they become standardized. - **Non-standard Extensions:** Avoid non-standard extensions unless ...

    python3.6.5参考手册 chm

    PEP 471 - os.scandir() function – a better and faster directory iterator PEP 475: Retry system calls failing with EINTR PEP 479: Change StopIteration handling inside generators PEP 485: A function...

    LCTF软件备份VariSpec™ Liquid Crystal Tunable Filters

    a) there is a conflict when one uses the implicit palette to set wavelengths, and also defines palette states explicitly using the VsDefinePalette() function. When the explicitly set palette state ...

    智慧教室电气与环境监测模块开发.doc

    Lastly, the entire system undergoes testing, including power consumption tests for terminal devices, function tests for individual modules, and real-world operation tests for the entire system, ...

    EurekaLog_7.5.0.0_Enterprise

    1)....Fixed: Added workaround for codegen bug in Delphi 7 (possibly - other), bug manifests itself as wrong date-time in reports or integer overflows 2)....Fixed: Some MAPI DLLs may not be loaded ...

    Program in LUA 2nd Edition.rar

    22.1 Date and Time 201 22.2 Other System Calls 203 23 The Debug Library 205 23.1 Introspective Facilities 205 23.2 Hooks 210 23.3 Proles 211 IV The C API 215 24 An Overview of the C API 217 ...

    Practical Mod Perl

    Handling Server Timeout Cases and Working with $SIG{ALRM} Section 6.11. Generating Correct HTTP Headers &lt;br&gt; Section 6.12. Method Handlers: The Browse and See, Browse and View Example ...

    bem-time:一个简单的 BEM 库来处理日期和时间

    bem-time提供以下块包: fmtTime 根据给定的格式化日期。 fmtTime ( '%d.%m.%Y' , Date . now ( ) ) ; 应用程序接口 范围 类型 描述 格式 String 格式字符串(参见下面的“”) 日期 Number或Date 要格式化的...

    php.ini-development

    You can redirect all of the output of your scripts to a function. For ; example, if you set output_handler to "mb_output_handler", character ; encoding will be transparently converted to the ...

    Turbo C 2.00[DISK]

    restored each time the screen is swapped. In general, you don't need to use this switch unless your program modifies the EGA palette registers, or unless your program uses BGI to change the ...

    Foundations for Analytics with Python O-Reilly-2016-Clinton W. Brownley

    The final chapter covers some additional built-in and add-in Python modules and functions that are important for data processing and analysis tasks, as well as some additional data structures that ...

    Turbo C 2.01[DISK]

    o The cprintf() function now works as documented. It does not translate line-feeds into CR/LF combinations. o Some compatibles had a problem under Version 1.5 because it used interrupt 18H. ...

    Python 2.6 Quick Reference.pdf

    - **日期/时间 (Date/Time)**:处理日期和时间的模块。 - **高级类型 (Advanced Types)**:如用户定义的对象和类。 - **语句 (Statements)**: - **赋值 (Assignment)**:变量赋值。 - **条件表达式 (Conditional...

    Python Cookbook, 2nd Edition

    Calculating Time Periods in a Date Range Recipe 3.4. Summing Durations of Songs Recipe 3.5. Calculating the Number of Weekdays Between Two Dates Recipe 3.6. Looking up Holidays Automatically ...

    前端面试文件content_1636425212663(1).docx

    + 表单控件:calendar、date、time、email、url、search 等 + 新技术:web worker、websocket、Geolocation 等 * 如何处理 HTML5 新标签的兼容性问题:使用 Polyfill 或者使用 CSS 来处理兼容性问题 * 如何区分 ...

    Universal-USB-Installer

    stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any ...

    linux全志R16的linux系统编译的资料_20170502_1655.7z

    Preparing to unpack .../libhttp-date-perl_6.02-1_all.deb ... Unpacking libhttp-date-perl (6.02-1) ... Selecting previously unselected package libfile-listing-perl. Preparing to unpack .../libfile-...

    WizFlow网页编辑

    stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a ...

    hibernate-shards.jar

    stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a ...

Global site tag (gtag.js) - Google Analytics