Introduction ABAP Dates
description
Transcript of Introduction ABAP Dates
![Page 1: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/1.jpg)
Introduction ABAP Dates
![Page 2: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/2.jpg)
Slide 2
Lecture Overview I go into more depth than your book
about how currency and quantity values work
![Page 3: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/3.jpg)
Slide 3
Introduction (Dates) If you come from a .NET or most worlds,
dates are treated much differently from what you are used to
In SAP, dates are not numerical. They are just a special character type Arithmetic operations are performed by
SAP converting data internally for you
![Page 4: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/4.jpg)
Slide 4
Dates (Data Type) We have a couple of ways to deal with
dates The primary date data type System fields for date and time that come
from the SYST struct
![Page 5: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/5.jpg)
Slide 5
The SYST Structure (Illustration)
![Page 6: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/6.jpg)
Slide 6
The SYST Structure (Illustration)
![Page 7: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/7.jpg)
Slide 7
The Date (D) Data Type (1) It’s just an 8 character string
![Page 8: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/8.jpg)
Slide 8
The Date (D) Data Type (2) The internal format is YYYYMMDD There are ABAP dictionary fields for
dates sy-datum gets the value of the system
date Example to print the current date
![Page 9: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/9.jpg)
Slide 9
The Date (D) Data Type (3) We can perform arithmetic on dates Add 30 days to the current date
![Page 10: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/10.jpg)
Slide 10
The Date (D) Data Type (4) We extract parts using positional
params +n denotes the starting position (offset
specification) (n) denotes the number of characters to
get
![Page 11: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/11.jpg)
Slide 11
Manipulating Date Parts When subtracting two dates, you get
the number of elapsed days Adding an integral value adds days to a
date
![Page 12: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/12.jpg)
Slide 12
The Time (T) Data Type The Time (T) data type stores the time
as a character string HHMMSS ABAP dictionary types store timestamps
in UTC format TIMESTAMP (YYYMMMDDDhhmmss) TIMESTAMPL
(YYYMMDDhhmmssmmmuuun) sy-uzeit gets the system time
![Page 13: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/13.jpg)
Slide 13
The Time (T) Data Type (Example) Declare a time variable and store the
current time in it
![Page 14: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/14.jpg)
Slide 14
The Time (T) Data Type (Example) Get the time parts (hour, minute,
second)
![Page 15: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/15.jpg)
Slide 15
Introduction to Reference Fields Quantity and currency amounts use
reference fields Quantities work with UNIT (units) Currency fields work with (a currency key)
CUKY The reference table contains a field with
the currency key (CUKY) Or unit of measure UNIT
![Page 16: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/16.jpg)
Slide 16
Introduction to Reference Fields From help.sap.com
![Page 17: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/17.jpg)
Slide 17
Quantity and Currency Fields They are not primary data types They are components of a structure in
the ABAP dictionary
![Page 18: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/18.jpg)
Slide 18
Currency Fields They are used to convert amounts from
one currency to another
They are really packed (P) BCD numbers A currency must also have currency key,
which designates the currency CUKY type
Use of the CURR data type is discouraged
![Page 19: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/19.jpg)
Slide 19
Currency Tables
![Page 20: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/20.jpg)
Slide 20
Currency Tables TCURC currency codes TCURF conversion factors TCURR exchange rate
![Page 21: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/21.jpg)
Slide 21
Currency (Example) Using the table ZEKEDAHLTEST
PRICE is of type CURR
![Page 22: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/22.jpg)
Slide 22
Currency (Example) Reference table is TCURL (Leading
Currency)
![Page 23: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/23.jpg)
Slide 23
Currency (Example) The TCURL Table (Edit using IMG)
![Page 24: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/24.jpg)
Slide 24
Currency (Example) And finally the leading currency in an
exchange quotation
![Page 25: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/25.jpg)
Slide 25
Currency (Configuring) Exchange ratios are maintained using
transaction code OBBS Exchange rates are maintained using
OB08 Transactions are cleared between
company codes
![Page 26: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/26.jpg)
Slide 26
Currency (Configuring Exchange Ratios) OBBS – Translation ratios define the unit
ration between the from and to currencies
![Page 27: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/27.jpg)
Slide 27
Currency (Configuring Exchange Rates) OB08 – Note that ratios and rates are
keyed by the exchange rate type
![Page 28: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/28.jpg)
Slide 28
Steps in Currency Configuration1. Check Currency Codes - OBY32. Set Decimal Places for Currencies - OBY4 3. Check Exchange Rate Types - OB07 4. Enter Exchange Rates - OB08 5. Define Translation Ratios for Currency Translation - OBBS 6. Define Additional Local Currencies - OB22 7. Define Accounts for Exchange Rate Differences - OB09
![Page 29: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/29.jpg)
Slide 29
It’s About Units of Measure There are four “units of measure” for
“things” Base unit of measure is used for all
material stocks All quantities entered in other units are
“converted” to the base unit of measure Basic view of the material definition
Sales unit of measure allows materials to be sold in different units
Material master sales view
![Page 30: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/30.jpg)
Slide 30
It’s About Units of Measure Purchase unit of measure is used for
“purchasing increments” Material master, purchasing view
Unit of issue is the quantity issued from the warehouse
Material master, work scheduling view
Alternate unit of measure is defined in table MARM
![Page 31: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/31.jpg)
Slide 31
Creating a Unit of Measure Define / use a dimension
The seven base dimensions are length, weight, time, electrical current, temperature, molecular mass, brightness
We rarely need to create these Create units of measure for the
dimension
CUNI is the transaction code
![Page 32: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/32.jpg)
Slide 32
Unit of Measure (Example) Let’s use time First, Check Units of Measurement from
IMG
![Page 33: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/33.jpg)
Slide 33
Unit of Measure (Example) Look at the Units of measure for time
![Page 34: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/34.jpg)
Slide 34
Unit of Measure (Example)
Everything is measured relative to seconds
![Page 35: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/35.jpg)
Slide 35
Unit of Measure (Example) The conversion factor for minutes.
There are 60 seconds in a minute
![Page 36: Introduction ABAP Dates](https://reader036.fdocuments.net/reader036/viewer/2022081505/568160e6550346895dd019e1/html5/thumbnails/36.jpg)
Slide 36
Unit of Measure (Example) The conversion factor for months