1 / 36

Introduction ABAP Dates

Introduction ABAP Dates. Lecture Overview. I go into more depth than your book about how currency and quantity values work. Introduction (Dates). If you come from a .NET or most worlds, dates are treated much differently from what you are used to

tomai
Download Presentation

Introduction ABAP Dates

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction ABAP Dates

  2. Lecture Overview • I go into more depth than your book about how currency and quantity values work

  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

  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

  5. The SYST Structure (Illustration)

  6. The SYST Structure (Illustration)

  7. The Date (D) Data Type (1) • It’s just an 8 character string

  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

  9. The Date (D) Data Type (3) • We can perform arithmetic on dates • Add 30 days to the current date

  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

  11. Manipulating Date Parts • When subtracting two dates, you get the number of elapsed days • Adding an integral value adds days to a date

  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

  13. The Time (T) Data Type (Example) • Declare a time variable and store the current time in it

  14. The Time (T) Data Type (Example) • Get the time parts (hour, minute, second)

  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

  16. Introduction to Reference Fields • From help.sap.com

  17. Quantity and Currency Fields • They are not primary data types • They are components of a structure in the ABAP dictionary

  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

  19. Currency Tables

  20. Currency Tables • TCURC currency codes • TCURF conversion factors • TCURR exchange rate

  21. Currency (Example) • Using the table ZEKEDAHLTEST • PRICE is of type CURR

  22. Currency (Example) • Reference table is TCURL (Leading Currency)

  23. Currency (Example) • The TCURL Table (Edit using IMG)

  24. Currency (Example) • And finally the leading currency in an exchange quotation

  25. Currency (Configuring) • Exchange ratios are maintained using transaction code OBBS • Exchange rates are maintained using OB08 • Transactions are cleared between company codes

  26. Currency (Configuring Exchange Ratios) • OBBS – Translation ratios define the unit ration between the from and to currencies

  27. Currency (Configuring Exchange Rates) • OB08 – Note that ratios and rates are keyed by the exchange rate type

  28. Steps in Currency Configuration 1. Check Currency Codes - OBY3 2. 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

  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

  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

  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

  32. Unit of Measure (Example) • Let’s use time • First, Check Units of Measurement from IMG

  33. Unit of Measure (Example) • Look at the Units of measure for time

  34. Unit of Measure (Example) Everything is measured relative to seconds

  35. Unit of Measure (Example) • The conversion factor for minutes. There are 60 seconds in a minute

  36. Unit of Measure (Example) • The conversion factor for months

More Related