ABAP Programs: Date and Time
REPORT ZSOURCE0405.
* Date fields are type d with the fixed length 8 and the internal
* representation YYYYMMDD (year, month, and day).
* The initial value of a date field is 00000000.
DATA TODAY TYPE D.
* The write command formats dates according to personal settings of
* the end user.
TODAY = SY-DATUM.
WRITE (10) TODAY.
* Using date fields to perform computations
DATA ULTIMO TYPE D.
* Set variable to first day of current month.
ULTIMO = SY-DATUM.
ULTIMO+6(2) = ’01′.
* Set variable to last day of previous month.
SUBTRACT 1 FROM ULTIMO.
WRITE / ULTIMO.
* Time fields are type t with the fixed length 6
* and the format HHMMSS (hours, minutes, and seconds)
DATA MY_TIME TYPE T.
WRITE /(8) MY_TIME.
———————
ABAPer, mail: abap.community@gmail.com http://www.erpdb.info
If you like this post, you may as well like these too:
- ABAP Programs: Converting date fields * Using the built-in calendarDATA: RECEIVING_DATE TYPE D, LAST_ADMISSIBLE_DATE TYPE D. RECEIVING_DATE = ’19980223′.LAST_ADMISSIBLE_DATE = RECEIVING_DATE + 10.WRITE / LAST_ADMISSIBLE_DATE. RECEIVING_DATE = ’19980305′.LAST_ADMISSIBLE_DATE = RECEIVING_DATE + 10.WRITE / LAST_ADMISSIBLE_DATE. RECEIVING_DATE...
- How to generate a long date like "2 januari 2007" from "20070102". DATA my_date TYPE DATUM.my_date = ’20070502′. DATA wa_dates LIKE TABLE OF T247 WITH HEADER LINE.DATA wa_date LIKE TABLE OF T247 WITH HEADER LINE.DATA long_date TYPE STRING. CALL FUNCTION ‘MONTH_NAMES_GET’ EXPORTING...
- ABAP Source Code: Syntax of ABAP/4 Programs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 * Declaration...
- ABAP Programs: Exporting to the ABAP/4 Memory REPORT ZSOURCE1401. * Work areas TABLES: CUSTOMERS, BOOKINGS. * Internal tables which will be exported DATA: ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE, ALL_BOOKINGS LIKE BOOKINGS OCCURS 10 WITH...
- ABAP Programs: Importing from the ABAP/4 Memory REPORT ZSOURCE1402. * Internal tables which will be imported DATA: ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE, ALL_BOOKINGS LIKE BOOKINGS OCCURS 10 WITH HEADER LINE, NEW_BOOKINGS LIKE BOOKINGS OCCURS...
- Different types of ABAP Programs There are nine types of ABAP Programs in SAP: 1 Executable Programs (ABAP Reports) I INCLUDE Program M Module Pool/Dialogue programs S Sub-Routine Pool J Interface Pool K Class Pool...
- Ending ABAP Programs The execution of an ABAP program is always ended when the corresponding process in the runtime environment ends. From an ABAP programmer’s perspective, this is when the last of the...
- ABAP Programs for Beginners Here is the list of Programs available in the ABAP Master Code Book (PDF). How to define types and data objects A Few Simple Examples Working with database tables and...
- Some Cool Programs in ABAP and the link is :- http://www.kabai.com/abaps/q.htm...
- ABAP Programs: Using where clauses REPORT ZSOURCE1104.* Work areasTABLES: BOOKINGS, CUSTOMERS.* Internal tablesDATA CUSTOMER_ORDERS LIKE BOOKINGS OCCURS 100 WITH HEADER LINE.DATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE.* Selecting data with a simple where...
- ABAP Programs: Using colors REPORT ZSOURCE0807. * Display the header using an appropriate color (grayish blue)WRITE ‘Header’ COLOR COL_HEADING. * Switch the standard colorFORMAT COLOR COL_TOTAL. * Make the color less brightWRITE / ‘total...
- SAP HR Time Management The SAP Time Management module manages all Human Resources(HR) processes that involve the planning, recording, and valuation of internal and external Employees’ work performed and absence times. The presentations cover...



















Leave a Reply