Sappress Abap An Introduction
Sappress Abap An Introduction
Index
The Authors
www.sap-press.com/4955
Chapter 12
Working with Dates, Times,
Quantities, and Currencies
This chapter explains how to handle business data that represents date
and time, quantities in different units of measure, and amounts in differ-
ent currencies.
12.1 Dates
In this section, we’ll cover the details on how the date type ( d) works and
some different ways to use dates in ABAP programs. Chapter 3 introduced
the date data type (d), showing how to define a date and that it is stored in a
YYYYMMDD format where the first four digits represent the year, the sec-
ond two represent the month, and last two represent the day.
465
12 Working
Working with Dat
Dates,
es, Times
Times,, Quantit
Quantities,
ies, and Currencie
Currenciess 12
2..1 Da te
te s
year
year TYPE
TYPE i,
month TYPE i, start_date = '20200101'.
day
day TYTYPE
PE i. my_date = start_date + 70.
year = substring( val = my_date off = 0 len = 4 ). WRITE: / 'Date in a leap year:', 25 my_date.
my_month = substring( val = my_date off = 4 len = 2 ).
Listing 12.4 Date Calculation Comparing Regular and Leap Years
my_day = substring( val = my_date off = 6 len = 2 ).
Listing 12.1 Using SUBSTRING to Get Year, Month, and Day Because 2020 is a leap year, the same operation results in a different date
(March 11 instead of March 12), as shown in Figure 12.1.
The code in Listing 12.1 can be used regardless of the user’s date format pref-
12
erences; the value when working with the date data type will always be the
same.
Adding/subtracting Adding days to a date data type can be done by adding an integer to the
days date; the date data type will handle updating the day, month, and year val- Figure 12.1 Result of Date Calculation in Regular versus Leap Year
ues, as shown in Listing 12.2, in which the new date is February 6, 2019.
You can also subtract days from a date variable in a similar fashion. In the DATA: my_date TYPE d VALUE ‘20190101’.
example shown in Listing 12.3, the result will be January 2, 2019.
466 467
12 Workin
Working
g with Dates,
Dates, Times, Quantiti
Quantities,
es, and Currencies
Currencies 12 ..11 Dat e
ess
Other date Dates also can be compared using the regular comparison operators, such days cannot be calculated. The example in Listing 12.7 demonstrates this
operations as < or >=. The example in Listing 12.6 will always return “True” because effect.
you’re adding 1 to the date and then comparing the result. If you change the
DATA: my_integer TYPE i,
sign from + to - in this example, it will always return “False”.
my_date TYPE d.
DATA: one_date TYPE d VALUE '20190801',
'20190801', my_date = ‘20190230’.
another_date
another_date TYPE d. my_integer = my_date.
IF my_integer = 0.
another_date = one_date + 1.
another_date WRITE: / 'Date is invalid'.
IF another_date > one_date.
one_date. ENDIF.
WRITE: 'True'.
Listing 12.7 Assigning Invalid Date to Integer Variable
ELSE.
WRITE: 'False'.
ENDIF. 12.1.2 Factory Calendars
Listing 12.6 Comparing Dates There may be a situation in which you need to write a program that will act
differently based on which days are working days for a given company. Fac- 12
Date variables are quite amazing in ABAP: you can use string functions with tory calendar days will take into account any public holidays and any rele-
them just like with any character type variables, yet you can perform calcu- vant working days, allowing you to complete date ca lculations based on the
lations with them, just like with the numeric fields. number of actual working days.
But this versatility can sometimes tempt ABAP developers to cut corners Factory calendars are client-independent and typically are created for each Viewing factory
and underestimate the complexity of the task. For example, one might relevant country or region in which a company operates. This allows for a calendars
think: Instead of using a bulky function to add a month to a date, couldn’t factory calendar to incorporate the local public holiday schedule. To view
we just derive the month value (just like we did in Listing 12.1), add 1 to it, all of the calendars in an ABAP system, enter Transaction SCAL, select the
and be done? Factory Calendar radio button, and click the Display button , as pic-
The developers who attempt this quickly realize that when dealing with a tured in Figure 12.2.
date in December they also need to consider the year change. After adding
an IF… condition to increase the year as well, a developer could be very
pleased with the result. It might take several months before worried users
start asking why they’re seeing the date February 30 on their screens.
This brings us to the next point: it’s feasible to assign an incorrect date to
such a variable, and this will not cause a runtime error. There are various
ways to test date validity; using the DATE_CHECK_PLAUSIBILITY function
module is one of them. But there is also an interesting approach that
exploits the fact that when a variable of type d contains an invalid date and
is assigned to a variable of type i (integer), the value of the integer variable
becomes 0. This is because integer presentation of a date is the number of
days since the beginning of SAP time, and for an invalid date the number of Figure 12.2 Initial Screen for Transaction SCAL
468 469
12 Workin
Working
g with Dates,
Dates, Times, Quantiti
Quantities,
es, and Currencies
Currencies 1 22.. 1 D at
at es
es
In the next screen, you’ll see a list of the factory calendars defined in the
system. These are usually based on country or region and will have Valid
From and Valid To dates. Select the calendar you’re interested in viewing
(USA in this example) and click the Calendar button, as shown in Figure 12.3.
Next, select a relevant year for the calendar that you want to view and click
the Year button, as shown in Figure 12.4.
Now that you understand what a factory calendar is and how to set one up, Converting
you can use factory dates in your ABAP code with the help of some standard factory dates
function modules.
Figure 12.4 Selecting Calendar Year in Transactio
Transaction
n SCAL
Use function module DATE_CONVERT_TO_FACTORYDATE to convert a regular
date into a factory date. The factory date will be a number representing the
Now you’ll see a calendar display for the selected year, showing which days
number of working days since the factory calendar began. If you convert a
are considered working days and which days are nonworking days, includ-
date that isn’t a working day, the next working day will be used.
ing a list of public holidays for the year (Figure 12.5).
You can then perform some calculations using the factory date and convert
it back to a calendar date using the FACTORYDATE_CONVERT_TO_DATE function
module. An example of this is shown in Listing 12.8, which calculates a date
10 working days in the future.
470 471
12 Working
Working with Dates,
Dates, Times, Quantiti
Quantities,
es, and Currencies
Currencies 12
2.. 1 Da te
te s
472 473
12 Worki
Working
ng with Dates
Dates,, Times, Quan
Quantities
tities,, and Currenc
Currencies
ies 12 ..11 D at
at e
ess
Datum formatting Instead of using the d date type, you can use the datum date type, which will 12.1.4 System Date Fields
be displayed per the style of the user’s date preference any time it’s dis-
There are three system date fields: sy-datum , sy-datlo , and sy-fdayw . All
played to the user (see Listing 12.9 and the resulting output shown in Figure
these system dates return values related to the current date. sy-datum
12.7).
returns the current system date. The system date is dependent on the sys-
DATA: my_datum TYPE datum VALUE '20190801'
'20190801'.. tem’s current time zone. If you’re concerned about the date for the logged
WRITE: 'Type DATUM:', my_datum. in user’s time zone, you can use sy-datlo . Finally, sy-fdayw will return the
factory day of week as an integer, meaning 0 for Sunday and 6 for Saturday.
DATA: my_date TYPE d VALUE '20190801'
'20190801'..
These system date fields can all be directly assigned to valid variables and
WRIT
WRITE:
E: /'Type D:',
D:', my_date.
my_date.
can also be used in the variable declaration, as shown in Listing 12.10.
Listing 12.9 Demonstrating Date Type Differences
DATA
DATA:
: toda
today
y type sy-datum,
sy-datum,
today_local
today_local type sy-datlo,
sy-datlo,
factory_day
factory_day TYPE sy-fdayw.
sy-fdayw.
today = sy-datum.
12
today_local
today_local = sy-datlo.
sy-datlo.
Figure 12.7 Output ofListing 12.9 factory_day
factory_day = sy-fdayw.
sy-fdayw.
to date fields indicating the dates between which the record is considered database
valid. There are many reasons that a table may contain date-limited
records; for example, a table may contain promotional discounts that are
only valid between two dates, or a table containing an employee’s position
in the company may be date-limited so that it can contain all current and
past positions.
Often, you don’t know when a record will no longer be valid, in which case
the valid_to date will be set to the latest date possible, which is December
Figure 12.8 User’s Date and Time Preferences 31, 9999. An HR record displaying an employee’s current position would
have a valid_to date like that; if the employee’s position changes, the
It’s better to use the datum data type in your program instead of the d data valid_to date is updated to show the last day at that position.
type whenever you’ll be displaying a date to the user. The datum and d date Selecting a date-limited record valid today is easy. First, determine if you
types can be used interchangeably in your code; the underlying data will be will be using the system date (sy-datum ) or the local date ( sy-datlo ).
exactly the same.
474 475
12 Working
Working with Dat
Dates,
es, Times
Times,, Quantit
Quantities,
ies, and Currencie
Currenciess 12 ..2
2 T iim
meess
In the following example, we’ll select a record from user table USR02
USR02,, which 12.2 Times
has optional Valid From and Valid To fields, as shown in Figure 12.9.
In this section, we’ll cover how the time data type ( t) works and some addi-
tional functions for calculating time, as well as other time data types. Chap-
ter 3 introduced the time data type (t), and that time is stored with two
characters for hours, two characters for minutes, and two characters for sec-
Using dates To select only the records that have a limited validity and are valid for
in SELECT today, you need to select records with a valid from date less than or equal to
12.2.1 Calculating Time
12
today and a valid to date greater than or equal to today. For this example, Just as with dates, you can compare time using the regular comparison
the valid from field is GLTGV and the valid to field is GLTGB
GLTGB,, as shown in Lis- operators and calculate time using regular math expressions. The example
ting 12.11, which will only return the record for user BGRFC_SUPER
BGRFC_SUPER.. in Listing 12.12 creates two variables of type t and fills in one of them with
the current system time using the sy-uzeit system field. Then the number
“New Open SQL
5 is added to that variable and placed in the another_time variable. At the
SELECT *
end, the variable values are compared for equality.
FROM USR02
INTO TABLE @DATA(results) DA
DATA
TA:: one_
one_ti
time
me TYPE
TYPE t,
WHERE GLTGV <= @sy-datum another_time TYPE t.
AND GLTGB >= @sy-datum.
one_time = sy-uzei
one_time sy-uzeit.
t.
“old Open SQL WRITE: / 'Current time:', one_time.
DATA: results TYPE STANDARD TABLE OF USR02.
476 477
12 Working
Working with Dat
Dates,
es, Time
Times,
s, Quantities,
Quantities, and Cur
Currenci
rencies
es 12
2.. 2 Ti me
me s
Figure 12.10 shows an example of executing this program. Note that calcu- GET TIME STAMP FIELD my_timestampl.
lations with time occur in seconds; therefore, adding the number 5 to a GET TIME STAMP FIELD data(my_inline_timestamp).
time variable adds five seconds as a result.
Listing 12.13 GET TIME STAMP FIELD
The regular comparison operators can only be used between two time- Comparing
stamps, not between a timestamp and a date or time. The comparisons will timestamps
DATA: my_t
my_timestamp
imestamp TYPE times
timestamp,
tamp,
12.2.2 Timestamps my_timestampl TYPE timestampl.
my_timestamp
my_timest amp = '2019010
'20190101000000'.
1000000'.
A timestamp is a combination of date and time for the Coordinated Univer-
my_timestampl
my_timest ampl = '2019010
'20190101000000.
1000000.0000001'.
0000001'.
sal Time (UTC) time zone. This can be used to record the exact date and time
IF my_times
my_timestampl
tampl > my_timest
my_timestamp.
amp.
when an action was completed by a user without having to rely on the local 12
WRITE: 'True'.
time zone for the user or the server. ENDIF.
Creating
timestamps There are two types of timestamp data types: timestamp and timestampl. Listing 12.14 Comparing TIMESTAMP and TIMESTAMPL Data Types
timestamp is a short-form timestamp, which represents only the date and
time combined with a format of YYYYMMDDHHMMSS. timestampl is a
You can also convert a timestamp to a local date and time variable using the Converting
long-form timestamp and will include up to seven decimal places to cap- timestamps
CONVERT TIME STAMP function. When using this function, you must specify a
ture the time with the precision of up to 100 ns using a format of YYMM-
time zone that exists in table TTZZ. The result can be stored in explicitly
DDHHMMSS.SSSSSSS.
defined date and time variables or using inline declarations, which will be
created as date and time variables. You also can store a Boolean value for
Actual Time Precision whether or not daylight saving time is in ef fect. The example in Listing 12.15
The maximum time precision depends on the operating system of the gets the current UTC timestamp, converts it to a Pacific Standard Time (PST)
application server and can be less precise than allowed by the long-form time zone date and time, and captures the daylight savings indicator. The
timestamp format. DATE, TIME, and DAYLIGH
DAYLIGHTT SAVING TIME additions are all optional, so you can
use only the ones that you need.
You can get the current timestamp using the GET TIME STAMP FIELD func- GET TIME STAMP FIELD DATA(my_utc).
tion, as shown in Listing 12.13. This function will work with both timestamp CONVERT TIME STAMP my_UTC TIME ZONE 'PST'
and timestampl data types. If an inline data declaration is used, timestamp , INTO DATE DATA(my_pst_date)
not timestampl, will be used. TIME DATA(my_
DATA(my_pst_time)
pst_time)
DAYLIGHT SAVING TIME DATA(my_dst).
DATA: my_
my_timestamp
timestamp TYPE timestamp,
timestamp,
my_timestampl
my_timestampl TYPE timestampl.
timestampl. Listing 12.15 Converting Timestamp from UTC to PST Date and Time
GET TIME STAMP FIELD my_timestamp.
my_timestamp.
478 479
12 Working
Working with Dates
Dates,, Times, Quantitie
Quantities,
s, and Currencies
Currencies 12
2.. 2 T im
ime s
my_pst_time type t,
my_pst_time date and time and always uses a comma as the seconds
decimal. Format: YYYY-MM-DDTHH:MM:SS,ZZZZZZZ.
my_dst type abap_boo
abap_bool.
l.
For example, 2019-01-01T12:00:00.0000000.
GET TIME STAMP FIELD my_utc.
CONVERT TIME STAMP my_UTC TIME ZONE 'PST' USER Based on the user’s preferences, which can be changed
INTO DATE my_pst_da
my_pst_date
te by going to System • User Profile • Own Data under the
TIME my_pst_ti
my_pst_time
me Defaults tab. For example: 01/01/2019 12:00:00 PM
DAYLIGHT SAVING TIME my_dst.
ENVIRONMENT Based on the user’s currently selected language envi-
Listing 12.16 Converting Timestamp from UTC to PST Date and Time without ronment. Will display the default for that country,
Inline Declarations regardless of the user defaults. For example: 01/01/ 12
2019 12:00:00 PM.
You also can convert the time used in the string template to reflect a given
Timestamp When outputting timestamps to a string template, there are special format-
time zone by adding TIMEZON
TIMEZONEE = followed by the desired time zone, as
formatting ting options that can be applied to display the timestamp in a more user-
shown in Listing 12.19, which will return 2019-01-01T04:00:00.0000000 .
friendly format. Table 12.1 provides a list of all the possible formatting
options. my_string = |{ unformatted TIMESTAMP = ISO
TIMEZONE
TIMEZONE = 'PST
'PST'' }|.
Listing 12.19 Setting Timestamp Output and Time Zone for Output in String
Template
480 481
12 Workin
Working
g with Dates,
Dates, Times, Quantiti
Quantities,
es, and Curr
Currencies
encies 12
12.3
.3 Qu
Quan
anti
titi
ties
es
There are some additional timestamp-related functions that use the CL_ You can see the different possible units of measure that are set up in your Display units of
ABAP_TSTMP system class. This class should be used if you want to add or sub- ABAP environment by entering Transaction CUNI, shown in Figure 12.11. measure
tract seconds from a timestamp, calculate the difference between two time- From there, select a dimension such as Length from the dropdown, and
stamps, or convert a long timestamp to a short timestamp or vice versa. click Units of Measurement .
Listing 12.20 Declaring and Getting System Time and Local Time Data
12.3 Quantities
Quantitative fields are used in SAP ERP systems to track and convert the
results of different types of measurements, ranging from lengths (e.g.,
meters and inches) to masses (e.g., grams and pounds) and units of packag-
ing (e.g., box and pallet). These fields are always associated with a unit of
Figure 12.12 List of Length Units of Measurement from Transaction CUNI
measure (UOM), which allows for converting the quantitative values from
one unit to another.
482 483
12 Working
Working with Dat
Dates,
es, Times
Times,, Quanti
Quantities,
ties, and Cur
Currenci
rencies
es 12
12.3
.3 Quant
Quantit
itie
iess
12.3.1 Quantity Fields in Data Dictionary
When storing quantities in transparent tables, you need to store the quan-
tity as a QUAN data type and the unit of measure as a UNIT data type. Then,
when creating the table using Transaction SE11, you need to relate the two
fields in the Currency/Quantity Fields tab.
Transparent table To demonstrate this, create table ZQUANTITY , shown in Figure 12.13, using
ZQUANTITY Transaction SE11. The table should contain field MANDT with data element
MANDT, field ID with data element INTEGER, field QUANTITY with data element
BASMN (type QUAN), and field UNIT_OF_MEASURE with data element CGSUNIT (type
UNIT). If some of the data elements don’t look familiar, don’t worry: they’re
SAP-standard data types that should exist in any ABAP system. Figure 12.14 Currency/Quantity Fields Data for Assigning Units to Quantities
sure and then convert the value into a different unit of measure so long as
both are part of the same dimension. For example, you can convert one
length unit, such as centimeters (cm), into another length unit, such as
meters (m).
You can complete the conversion using the UNIT_CONVERSION_SIMPLE func- ABAP unit
tion module, which allows you to pass in a quantity with a unit to convert conversion
from and a unit to convert to. This function module will also round results
Figure 12.13 Table Containing Quantity and Unit of Measure if necessary, and you can optionally pass in a + or – to force it to round up or
down. Listing 12.21 demonstrates converting a quantity of 5 from meters (M)
Next, click the Currency/Quantity Fields tab, and you’ll see that only the to centimeters (CM). The unit of measure used can also be seen in the length
QUANTITY field has an editable row. From here, you can add a reference to units of measure list in Figure 12.12.
the table and field that will describe the quantity’s unit. For this example,
enter the current table, “ZQUANTITY”, and the field, “UNIT_OF_MEAS
“UNIT_OF_MEASURE”,URE”, DATA: my_quantity
my_quantity TYPE i VALUE 5.
CALL FUNCTION 'UNIT_CONVERSION
'UNIT_CONVERSION_SIMPLE'
_SIMPLE'
as pictured in Figure 12.14. Assigning a corresponding unit of measure field EXPORTING
for any quantity data type is required to activate the table. input = my_quantity
Because you store the quantity and unit in the same table, different records unit_in = 'M'
can have data stored in different quantities. unit_out = 'CM'
IMPORTING
It’s possible to store the unit of measure in one table and ref erence it within output = my_quantity
a quantity in another table, if this is required by your business rules. In this EXCEPTIONS
case, you would enter a different table name in the Reference Table field in conversion_not_fo
conversion_not_found
und = 1
Transaction SE11. div
divisi
ision_
on_by
by_ze
_zero
ro = 2
484 485
12 Working
Working with Dat
Dates,
es, Time
Times,
s, Quantities,
Quantities, and Cur
Currenci
rencies
es 12
12.4
.4 Cu
Curr
rren
enci
cies
es
inp uut
t_ i
innva l
li
id = 3 The SAP ERP currency codes are listed in the Currency column and corre-
o ut
ut pu
pu t_
t_ in
in va
va li
li d = 4 sponding ISO currency codes in the ISO column. Note that even though
overflow = 5 most SAP currency codes match the ISO standard, there could be some-
type_invalid = 6 times multiple internal SAP codes for one ISO currency code.
uni tts
s_ m
miiss i
in
ng = 7
When converting amounts across different currencies, the current
un
unit_
it_in_
in_not
not_fo
_founund
d = 8
unit
unit_out
_out_not
_not_fou
_found
nd = 9
exchange rate can be found in Transaction OB08. Because exchange rates
others = 10 regularly change, it’s possible to have the exchange rates in your system
. automatically updated on a daily or weekly basis, which is a topic outside
IF sy-subrc
sy-subrc <> 0. the scope of this book. Figure 12.16 shows that the currency exchange rate
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno between the US dollar and the euro is 0.94 euros to 1 US dollar.
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
WRITE: my_quant
my_quantity.
ity.
12.4 Currencies
Currencies work a lot like quantities; they’re used to capture both a value 12.4.1 Currency Fields in Data Dictionary
(amount) and a type (currency code). In today’s world of global business, Just as quantities use a QUAN data type to keep track of the quantity and a
transactions can be captured in one currency and then transferred to UNIT data type to keep track of the unit of measure, a currency value
another. This makes it very important to keep track of the currency being requires that the amount of currency be stored in a field with a CURR data
referenced in any financial transaction, which is easy with an ABAP system. type, and the currency key needs to be stored with a CUKY data type. You can
Display currencies You can see a list of currencies defined in your system by entering Transac- then relate the fields in the Currency/Quantity Fields tab in the Change
Table screen from Transaction SE11.
tion OY03. The results will be displayed as shown in Figure 12.15.
To demonstrate this, let’s create table ZCURRENCY , shown in Figure 12.17, Currency in a trans-
using Transaction SE11. The table should contain field MANDT with data ele- parent table
ment MANDT , field ID with data element INTEGER , field PRICE with data ele-
ment PREIS (type CURR), and field CURRENCY with data element USRCUKY (type
CUKY). If some of the data elements don’t look familiar, don’t worry: they’re
standard SAP data types that should exist in any ABAP system.
486 487
12 Working
Working with Date
Dates,
s, Times, Q
Quantit
uantities,
ies, and Currencies
Currencies 12
12.4
.4 Curr
Curren
encie
ciess
OB08. You can do so using the CONVERT_TO_LOCAL_CURRENCY function mod-
ule.
When using CONVERT_TO_LOCAL_CURRENCY , you’re required to pass a date that Currency conver-
will be used to determine the exchange rate for converting foreign_amount sion in ABAP
information from the function module, such as the exchange rate used, or
you can specify an exchange rate to be used in the conversion.
Figure 12.17 Table ZCURRENCY Using Currency Data Types DATA: local_amount
local_amount TYPE P DECIMALS 2.
IF sy-subrc
sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
Figure 12.18 Currency/Quantity Fields Tab for Table ZCURRENCY WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Because you have a field for currency in the table, each record in the table
can have any currency denomination. And just like with quantity fields, Listing 12.22 Currency Conversion
you also can reference the currency key in another table.
488 489
12 Worki
Working
ng with Date
Dates,
s, Times, Qua
Quantiti
ntities,
es, and Currencies
Currencies 12.5 Updating
Updating th
the
e Shopp
Shopping
ing Ca
Cart
rt Exa
Example
mple
12.5.1 Updating the Database
factor would be applied to the amounts when stored in the database. This
means that the amount of 100 JPY, for example, would be stored as 0.01 in You’re now ready to update the transparent tables to match the updated
the database. ERD diagram. This section will walk through the steps to accomplish that.
Some currencies may also use a different number of decimals than two, or Let’s start by creating data elements for the new fields and then add those
no decimals at all. The information about decimal places in currencies is data elements to the transparent tables.
stored in table TCURX. First, create the data element for the product price field. To begin, enter Price data element
The good news is that the standard SAP functionality incorporates this Transaction SE11, select the Data Type radio button, enter “ZPRODUCT_
configuration into currency field display and conversion. That’s why it’s PRICE” in the corresponding
corresponding textbox, and click the Create button. Select the
important to always reference the currency code when dealing with cur- Data Element radio button in the Data Type popup and click the Continue
rency-specific amounts in ABAP code. button.
In the Change Data Element screen, enter “Product Price for Shopping Cart
You should now be familiar with currencies and the aspects required for Example” in the Short Description textbox. Then, with the Data Type tab
storing and converting them. In the next section, we’ll update the shopping selected, choose the Elementary Type radio button and the Built-in Type
cart example with currencies and quantities. radio button. Enter the Data Type “CURR”, Length “11”, and Decimal Places
12
“2”. We’re using the built-in type option instead of a domain in the new data
elements because we don’t need any of the additional settings available
490 491
12 Working
Working with Dates,
Dates, Times, Quantiti
Quantities,
es, and Currencies
Currencies 12.5 Updating
Updating th
the
e Shopping
Shopping Cart
Cart E
Example
xample
populated, as shown in Figure 12.23. Click the Activate button to activate the
data element.
Currency data Next, return to Transaction SE11, select the Data Type radio button, enter
element “ZPRODUCT_CURRENCY”
“ZPRODUCT_CU RRENCY” in the correspon
corresponding
ding textbox, and click the Cre- Figure 12.23 ZPRODUCT_CURR
ZPRODUCT_CURRENCY
ENCY Field Label Settings
ate button. Select the Data Element radio button in the Data Type popup
12
and click the continue button. Next, return to Transaction SE11, select the Data Type radio button, enter UOM data element
In the Change Data Element screen, enter “Product Currency for Shopping “ZPRODUCT_UOM” in the corresponding textbox, and click the Create but-
Cart Example” in the Short Description textbox. Then, with the Data Type ton. Select the Data Element radio button in the Data Type popup and click
tab selected, choose the Elementary Type radio button and the Built-in Type the Continue button.
radio button. In the Data Type field, use the input help dropdown and select In the Change Data Element screen, enter “Product UOM for the Shopping
the CUKY type. The Length field will be automatically set to 5. Your data ele- Cart Example” in the Short Description textbox. Then, with the Data Type
ment should look like the one pictured in Figure 12.22. tab selected, choose the Elementary Type radio button and the Built-in Type
radio button. Enter the Data Type “UNIT” and Length “3”. Your data element
should look like the one pictured in Figure 12.24.
Next, select the Field Label tab and enter “Currency” for all Field Label text- Figure 12.24 ZPRODUCT_UOM Data Type Settings
boxes. Then press (Enter) and the Length textboxes will be automatically
492 493
12 Working
Working with Dates, Times,
Times, Quantities
Quantities,, and Currencies
Currencies 12.5 Updating
Updating the Shopping
Shopping Cart Example
Example
Next, select the Field Label tab and enter “Unit” for the Short Field Label text
box and “Unit of Measure” for all other Field Label textboxes. Then press
(Enter) and the Length textboxes will be automatically populated, as
shown in Figure 12.25. Click the Activate button to activate the data ele-
ment.
12
Quantity data Next, return to Transaction SE11, select the Data Type radio button, enter
element “ZCART_QUANTITY” in the corresponding textbox, and click the Create
button. Select the Data Element radio button in the Data Type popup and
click the Continue button.
In the Change Data Element screen, enter “Cart Quantity for the Shopping Figure 12.27 ZCART_QUANT
ZCART_QUANTITY
ITY Field Label Options
Cart Example” in the Short Description textbox. Then, with the Data Type
tab selected, choose the Elementary Type radio button and the Built-in Type Now that you’ve created the new data elements, let’s update the transpar- Updating table
radio button. Enter the Data Type “QUAN”, Length “13”, and Decimal Places ent tables that use those data elements. First, update transparent table ZPRODUCT
“3”. Your data element should look like the one pictured in Figure 12.26. ZPRODUCT . To do this, go back to Transaction SE11, select the radio button for
Next, select the Field Label tab and enter “Quantity” for all the Field Label Database Table, and enter “ZPRODUCT” in the corresponding textbox.
textboxes. Then press (Enter) and the Length textboxes will be automati- Then press the Change button.
cally populated, as shown in Figure 12.27. Click the Activate button to acti- With the Fields tab selected, add Field “PRICE” with Data element “ZPRO-
vate the data element. DUCT_PRICE”, Field “CURRENCY” with Data element “ZPRODUCT_CUR-
RENCY”, and Field “UOM” with Data element “ZPRODUCT_UOM”, as shown
in Figure 12.28.
494 495
12 Workin
Working
g with Dates
Dates,, Times, Q
Quantit
uantities,
ies, and Currenci
Currencies
es 12.5 Updating
Updating the Shoppin
Shopping
g Cart Example
Figure 12.30 Table ZCART Fields Tab Settings
Figure 12.28 ZPRODUCT Fields Tab Settings
Now, select the Currency/Quantity Fields tab and enter Reference Table
Next, select the Currency/Quantity Fields tab and enter Reference Table
“ZPRODUCT” and Reference Field “UOM” for Field “Quantity”. This will set
“ZPRODUCT” and Reference Field “CURRENCY” for the Field “PRICE”, as
the UOM field in table ZPRODUCT as the unit for the QUANTITY field in this table,
shown in Figure 12.29. This will set the CURRENCY field as the currency key for 12
as shown in Figure 12.31.
the PRICE field.
496 497
12 Working
Working with Date
Dates,
s, Times
Times,, Quantit
Quantities,
ies, and Currencies
Currencies 12.5 Updating
Updating the S
Shoppin
hopping
g Cart Ex
Exampl
ample
e
ADD_PRODUCT method to take an additional parameter for quantity and will Next, update the GET_CART method to return the quantity and unit of mea- Updating GET_CART
need to update the GET_CART method to return the quantity and unit of sure. To do this, first update the t_cart definition to include the quantity
measure for all the items in the cart. and unit of measure variables, as shown in bold in Listing 12.25.
Updating First, let’s update the ADD_PRODUCT method. To do this, update the method …
add_product definition to include the IMPORTING parameter ip_quantity as shown in Lis- PUBLIC SECTION.
method
ting 12.23. Add the new parameter as an optional parameter so that other TYPES: BEGIN OF t_cart,
prod
product
uct TYPE zpro
zproduct
duct-pro
-product
duct,
,
programs aren’t impacted by the change. description
descript ion TYPE zproduct_text-de
zproduct_text-descriptio
scription,
n,
…
quantity
quantity TYPE zcart-qu
zcart-quantiantity,
ty,
add_product
add_product IMPORTING ip_product
ip_product TYPE zproduct-product
zproduct-product
u om
om T YP
YP E z pr
pr od
od uc
uc t-
t- uo
uo m,
m,
ip_quantity
ip_quant zcart-quantity OPTIONAL,
ity TYPE zcart-quantity
END OF t_cart,
…
…
Listing 12.23 Updated Definition for ADD_PRODUCT Method
Listing 12.25 Updates to T_CART Definition in ZCL_SHOPPING_CART
Now you can update the ADD_PRODUCT method implementation. The change 12
Now in the GET_CART method, add the new fields to the SELECT statement, as
will be to check if ip_quantity has a value and, if it does, to use that value in
shown in Listing 12.26.
the local structure; otherwise, set the local structure quantity to 1. You can
also now change the INSERT statement to a MODIFY statement. This will allow METHOD
“using get_cart.
get_cart
new Open.SQL
the ADD_PRODUCT method to be called to change the quantity and to add new
products. This is accomplished using the code in Listing 12.24, which has the SELECT zcart~product,
zcart~product, description , quantity, uom
description,
specific changes in bold. FROM zcart
INNER JOIN zproduct
METHOD add_prod
add_product.
uct. ON zcart~product
zcart~product = zproduct~product
zproduct~product
DATA
DATA:
: cart
cart TYPE zcart.
zcart. INNER JOIN zproduct_text
zproduct_text
cart-customer
cart-customer = customer. ON zcart~product
zcart~product = zproduct_text~pro
zproduct_text~product
duct
cart-product
cart-product = ip_product.
ip_product. WHERE zproduct_text~la
zproduct_text~language
nguage = @sy-langu
@sy-langu
IF ip_quantity IS NOT INITIAL
INITIAL.
. AND zcart~customer = @customer
@customer
cart-quantitity
cart-quantitity = ip_quan
ip_quantity.
tity. INTO TABLE @rt_cart.
@rt_cart.
ELSE.
cart-quantity
cart-quantity = 1. “using old Open SQL
ENDIF. SELECT zcart~product description quantity uom
zcart~product description
INTO TABLE rt_cart.
MODIFY zcart FROM ls_cart. FROM zcart
ENDMETHOD. INNER JOIN zproduct
ON zcart~product
zcart~product = zproduct~product
zproduct~product
Listing 12.24 Updated ADD_PRODUCT Method Implementation
INNER JOIN zproduct_text
zproduct_text
ON zcart~product
zcart~product = zproduct_text~pro
zproduct_text~product
duct
498 499
12 Workin
Working
g with Dates,
Dates, Times, Quantiti
Quantities,
es, and Currencies
Currencies 12.5 Updating
Updating the Shoppi
Shopping
ng Cart
Cart Exam
Example
ple
WHERE zproduct_text~language
zproduct_text~language = sy-langu
AND zcart~customer
zcart~customer = customer.
customer.
ENDMETHOD.
12.5.3 Updating the ABAP Programs Figure 12.32 Updated Selection Texts in ZPRODUCT_MAIN
ZPRODUCT_MAINT
T
ZPRODUCT_MAINT You’re now ready to update the maintenance ABAP programs. First, let’s
parameters update the ZPRODUCT_MAINT program. In Listing 12.27, we add the additional
parameters needed for price, currency, and unit of measurement, all shown 12
in bold.
…
SELECTION-SCREEN
SELECTION-SCREEN BEGIN OF BLOCK product WITH FRAME TITLE text-001
text-001.
.
PARAMETERS:
PARAMETERS: p_prod TYPE zproduc
zproduct-product
t-product,
,
p_desc TYPE zproduct_text-d
zproduct_text-descripti
escription
on
LOWER CASE,
p_price TYPE zproduct-price,
zproduct-price,
p_curr TYPE zproduct-curr
zproduct-currency,
ency,
p_uo
p_uom
m TYPE zproduc
zproduct-uo
t-uom.
m.
SELECTION-SCREEN
SELECTION-SCREEN END OF BLOCK product. Figure 12.33 Updated ZPRODUCT_MAINT Selection Screen
Press the Activate button to activate the program so that you can add the
selection texts for the new parameters. …
product-product
product-product = p_prod.
ZPRODUCT_MAINT Next, navigate to the text elements using Goto • Text Elements • Selection
selection text product-price
product-price = p_price.
Texts in SAP GUI or right-click and choose Open Others • Text Elements in
product-currency
product-currency = p_curr.
Eclipse. In the Selection Texts tab, select the checkbox for DDIC Reference
product-uom
product-uom = p_uom.
for all of the new parameters listed, as shown in Figure 12.32. Then click the
product_text-pro
product_text-product
duct = p_prod.
Activate button to activate the new texts.
product_text-des
product_text-description
cription = p_desc.
You can now test the updated selection screen by running the program. It …
should look like Figure 12.33.
Listing 12.28 Updated Code to Save New Parameters in ZPRODUCT_MAINT
500 501
12 Workin
Working
g with Dates, Times,
Times, Quantitie
Quantities,
s, and Currencies
Currencies 12.5 Updating
Updating th
the
e Shopp
Shopping
ing Ca
Cart
rt Exa
Example
mple
When using inline data declarations, the SELECT statement can be quickly Next, let’s update the ZCART_MAINT program to utilize the new currency and ZCART_MAINT
updated to display the new fields, as shown in Listing 12.29. quantity options. In Listing 12.31, you can see that we added a new parame- changes
ter for the quantity and added it as a parameter when calling the ADD_PROD-
…
UCT method. Notice that we now have to indicate which parameters we’re
SELECT zproduct~
zproduct~product,
product, descripti
description,
on, price, currency, uom
passing when calling the ADD_PRODUCT method.
FROM zproduct
INNER JOIN zproduct_text …
ON zproduct~product
zproduct~product = zproduct
zproduct_text~pr
_text~product
oduct PARAMETERS:
PARAMETERS: p_cust TYPE zcart-customer
zcart-customer OBLIGATORY,
WHERE language = @sy-lang
@sy-languu zcart-product,
p_prod TYPE zcart-product
INTO TABLE @DATA(products). p_qty TYPE zca
zcart-quant
rt-quantity.
ity.
… …
ELSEIF p_add = abap_true.
abap_true.
Listing 12.29 Updating SELECT Statement with Inline Data Declarations
o_cart->add_product( ip_product = p_prod ip_quantity = p_qty ).
…
When not using inline data declarations, you need to update the type defi-
nition before you can update the SELECT statement, as shown in Listing Listing 12.31 Updates for Program ZCART_MAINT
12.30. 12
Now, press the Activate button to activate these changes and make the new
ELSEIF p_dis = abap_true.
parameter available in the selection texts screen.
TYPES: BEGIN OF t_produc
t_products,
ts,
pro
product
duct TYPE zpr
zproduc
oduct-pr
t-produc
oduct,
t, Navigate to the selection screen texts, as described earlier for the ZPRODUCT_ ZCART_MAINT
description
descript ion TYPE zproduct_
zproduct_text-des
text-description
cription,, MAINT program, and check the DDIC Reference checkbox for the new param- selection texts
pri
price
ce TYP
TYPEE zpr
zprod
oduct
uct-pr
-pric
ice,
e, eter. After activating the changes, the selection screen should look as
currency
currency TYPE zproduct
zproduct-cur-currenc
rency,
y, shown in Figure 12.34.
u om
om T YP
YP E z pr
pr od
od uc
uc t
t-
-uuo
omm,
,
END OF t_products.
SELECT zproduct~
zproduct~product
product description
description price currency uom
INTO
INTO TABLE prod
products
ucts
FROM zproduct
INNER JOIN zproduct_text
ON zproduct~
zproduct~product
product = zproduct
zproduct_text~pr
_text~product
oduct
WHERE language = sy-langu.
You can now press the Activate button to activate the program. The ZPRO-
DUCT_MAINT ABAP program is now ready to handle currencies and quantities.
502 503
12 Workin
Working
g with Dates,
Dates, Times, Quantiti
Quantities,
es, and Currencies
Currencies
The ZCART_MAINT program is now ready to handle quantities. Add data using
both programs to test the new functionality.
12.6 Summary
This chapter covered some important steps and tools for working with
dates, times, and timestamps. With the information covered here, you can
now create ABAP applications that can accurately calculate dates and times
across various time zones and consider working days to calculate import-
ant dates.
We also covered how to work with quantities and currencies in both the
ABAP Dictionary and in ABAP programs and how to read and convert quan-
tities and currencies.
Finally, we updated the shopping cart program from Chapter 10 and Chap-
ter 11 to use quantities and currencies.
In the next chapter, you’ll learn to work with classic dynpro screens.
504
Contents
Preface .....................................................................................................
...............................................................................
.......................... 17
1 Intr
Introd
oduc
ucti
tion
on to SA
SAP’
P’ss ERP
ERP Syst
System
emss 23
1.1
1.1 What
What Are SA
SAP
P and
and AB
ABAP
AP?? ...........................................................................
........................... 23
1.2 Curren
Currentt State
State of SAP’
SAP’ss ERP
ERP System
Systemss ........
...........
...........
...........
..........
...........
...........
...........
............
.......... 24
1.3
1.3 “Old
“Old”” vers
versus
us “Ne
“New”
w” ABA
ABAP
P .........................................................................
......................... 26
1.4 Navig
Navigati
ating
ng SAP ERP Sys
System
temss ....................................................................
................. 28
1.4.1 Overview of SAP GUI ..........
Overview ...........
...........
...........
............
...........
...........
...........
..........
...........
...........
..........
..... 29
1.4.2 Overview
Overview of SAP Fiori .........
...........
...........
..........
...........
...........
...........
...........
..........
...........
...........
..........
..... 33
1.5 Summary ...................................................................................................
.............................................................
........ 34
2 Crea
Creati
ting
ng Yo
Your
ur Fi
Firs
rstt Pr
Prog
ogra
ram
m 35
2.1
2.1 “Hel
“Hello
lo,, W orl
orld!
d!”” ...............................................................................................
........................................... 35
2.1.1 Creating a New Program with Eclipse ...........
Creating ...........
..........
...........
...........
..........
..... 35
2.1.2 Creating
Creating a New Program in Transac
Transaction
tion SE80 ........... ..........
...........
...... 40
2.1.3 Writing a “Hello
“Hello,, World!” Program ...........
...........
...........
..........
..........
...........
...........
...... 45
2.1.4 Adding Featu
Features
res to Your First Program ...........
............
...........
..........
...........
.......... 46
2.2 Summary ...................................................................................................
.............................................................
........ 49
3 ABAP 101 51
3.1 Variab
Variables
les and Con
Consta
stants
nts in ABAP
ABAP .........
...........
...........
..........
...........
...........
..........
...........
...........
...........
....... 51
3.1.1 The DATA Keywor
Keywordd ...........
............
...........
...........
...........
..........
...........
...........
...........
............
...........
...........
...... 51
3.1.2 Numericc Data Types ..........
Numeri ...........
...........
...........
............
...........
...........
...........
..........
...........
...........
..........
..... 53
3.1.3 Character-like
Character-like Data Types ...........
............
............
...........
...........
...........
..........
...........
...........
..........
..... 55
Contents Contents
3.1.4 Boole
Boolean
an ..........
..........
...........
...........
..........
............
...........
...........
...........
..........
...........
...........
...........
.............
..........
...........
.......... 57 3.9
3.9 Tyin
Tying
g IItt All
All Toge
Togeth
ther
er .....................................................................................
................................... 117
3.1.5 Struc
Structure
turess and Internal
Internal Tables Tables .......... ..........
............
..........
...........
...........
..........
............
........
... 58 3.9.1 The Problem .....................................................................................
................................... 118
3.1.6 Inli
Inline
ne Data Declarat
Declarations ions ......... ...........
..........
...........
...........
...........
............
...........
............
...........
.........
... 61 3.9.2 The Solution .....................................................................................
.................................. 119
3.1.7 Const
Constants
ants ...........
...........
..........
............
..........
..........
...........
............
..........
............
...........
...........
...........
..........
...........
.........
... 62
3.
3.10
10 Sum
Sum m
mar
ary
y ..................................................................................................
..............................................................
........ 120
3.1.8 System
System Fields
Fields and Pred Predefine efined d Const
Constants ants .......................
...........
..........
.........
... 63
3.2 Arithmet
Arithmetic
ic an
and
d Ba
Basic
sic Math Functio
Functions ns ................
...........
..........
............
..........
...........
...........
..........
...... 65
3.2.1 Arith
Arithmeti
meticc Oper
Operation
ationss ...... ..........
...........
..........
...........
...........
...........
............
...........
............
..........
..........
..... 65
3.2.2 Math Functions
Functions .......
...........
.........
...........
............
..........
...........
..........
...........
...........
...........
............
...........
............
...... 68 4 Da
Data
ta Dict
Dictio
iona
nary
ry Ob
Obje
ject
ctss 121
3.2.3 CLEAR Command
Command .......
............
..........
...........
..........
...........
..........
...........
...........
...........
...........
..........
...........
..........
.... 70
4.1
4.1 Wh
What
at Is a Dat
Datab
abas
ase?
e? .....................................................................................
................................... 121
3 .3
.3 F lo
lo w C on
on ttrr ol
ol .....................................................................................................
...................................................... 72
3.3.1 IF Statements
Statements ........................
.........
...........
...........
...........
............
...........
...........
...........
..........
...........
............
..........
...... 72 4.2 Wha
Whatt Is
Is a Dat
Data
aDDict
iction
ionary
ary?? ........................................................................
.......................... 122
3.3.2 CASE State
Statement
mentss ......... ..........
..........
...........
...........
...........
..........
...........
............
..........
............
...........
...........
.......... 76 4.
4.3
3 Da
Data
taba
base
se D
Des
esii g
gn
n ............................................................................................
........................................... 123
3.3.3 DO Loops .........
...........
............
...........
.........
...........
...........
...........
.............
..........
...........
...........
..........
............
..........
...........
...... 79 4.3.1 Entity Relationship Diagrams ..................................................... ........ 123
3.3.4 WHIL
WHILE E Loops
Loops ............
...........
............
..........
..........
...........
...........
...........
............
...........
...........
............
............
..........
....... 79 4.3.2 Database Normalization ................................................................................ 124
3.4
3.4 Selec
Selectio
tion
n Scre
Screen
en Progra
Programmi
mming
ng ................................................................
.......... 80 4.3.3 Relationships in ERDs ....................................................................
................. 126
3.4.1 PARAM
PARAMETER
ETER ............ ...........
............
...........
...........
...........
...........
..........
...........
...........
...........
............
............
..........
.......... 81 4.4 Naviga
Navigatio
tion
n to ABAP
ABAP Dict
Diction
ionary
ary Objec
Objects
ts .............................................. 127
3.4.2 SELE
SELECT-OP
CT-OPTIONS
TIONS ............ .........
...........
...........
...........
............
...........
...........
...........
..........
...........
...........
............
..... 85
3.4.3 Sele
Selection
ction Texts ........ ..........
...........
...........
...........
...........
...........
..........
...........
...........
...........
............
...........
............
...... 87 4.5 Table,
Table, Dat
Dataa Eleme
Element,
nt, and Dom ain .........................................................
Domain .......... 129
3.4.4 SELE
SELECTION-
CTION-SCREE
SCREEN N .....................
...........
...........
...........
..........
...........
...........
...........
...........
..........
...........
.......... 88 4.6 Train
Training
ing Data Model and Examp
Example le D
Defini
efinition tion .....................
...........
...........
............
........... 132
3.4.5 BLOCK .......
...........
...........
............
...........
...........
..........
..........
...........
...........
...........
............
...........
............
..........
..........
...........
.......... 88 4.6.1 SAP Flight
Flight an
and
d Booking
Booking Data Model
Model .......... ...........
...........
.........
............
...........
..........
.... 133
3.4.6 Other Sele
Selection
ction Screen Screen Elem Elements ents ............
..........
..........
...........
...........
...........
............
.......... 91 4.6.2 Train
Training
ing Example:
Example: Enhancin
Enhancing g the SAP Model Model .......... ..........
...........
........
... 134
3 .5
.5 Ev
ve
e nt
nt Bl
Bl oc
oc k
kss .....................................................................................................
...................................................... 92 4.7
4.7 Cr
Crea
eati
ting
ng a Ne
New
w Doma
Domain
in .............................................................................
.......................... 135
3.5.1 INITI
INITIALIZA
ALIZATION TION .......................
.........
...........
............
...........
...........
............
...........
...........
...........
..........
............
........
... 93 4.8 Creati
Creating
ng a N
New
ew Dat
Data
a Elem
Element
ent ..................................................................
.................. 139
3.5.2 AT SELE
SELECTION-
CTION-SCREE SCREEN N ...........
...........
...........
...........
..........
...........
...........
...........
............
...........
...........
...... 93
4.9 Creati
Creating
ng and Edi
Editin
tingg Tabl
Tables
es ......................................................................
.................. 144
3.5.3 START
START-OF-S
-OF-SELEC ELECTION TION ........... ..........
...........
............
..........
............
...........
...........
...........
..........
...........
.......... 95
4.9.1 Viewing
Viewing th
the
e Flight
Flight Table Configurat
Configuration ion ......................
..........
............
...........
...... 144
3 ..6
6 Form
Format
atti
ting
ng Co
Code
de ............................................................................................
............................................ 95 4.9.2 Creating an Append Structure ................................................... ........ 151
4.9.3 Creating
Creating a Custom
Custom Transpar
Transparent ent Table .......... ..........
..........
...........
...........
...........
..... 154
3.7 ommen ttss .........................................................................................................
C om ...................................................... 97
3.7.1 Comm
Common on CommCommentin enting g Mist
Mistakes akes .......... ............
..........
...........
............
...........
...........
.......... 98 4.1
4.10
0 Docum
Document
entati
ation
on ...............................................................................................
........................................... 161
3.7.2 Using Comments while Programming Programming .................................... 100
4.11 Viewi
Viewing
ng Data
Data in the
the Database
Database Tables
Tables .................................................. 162
3 ..8
8 D ebu
ebugg
ggin
ing
gBBas
asic
icss ...........................................................................................
............................................ 100 4.11.1 Data Preview in Eclipse .................................................................
.................. 162
3.8.1 Program to Debug ...........................................................................
......................... 101 4.11.2 Data Browser in SAP GUI ..............................................................
................... 164
3.8.2 Breakpoints in Eclipse ....................................................................
................. 103 4.11.3 Setting Up the Flights Example Data ....................................... 169
3.8.3 Breakpoints in the SAP GUI .......................................................... ....... 108
4.12 Table Maint
Maintenanc
enance
eDDialo
ialogs
gs .......................................................................
.................. 170
3.8.4 Watchpoints in Eclipse ..................................................................
................ 113
4.12.1 Generating Maintenance Dialog for a Table ......................... 170
3.8.5 Watchpoints in SAP GUI ................................................................
.................. 116
4.12.2 Table Maintenance Transaction SM30 ................................... 172
8 9
Contents Contents
4.13 Struct
Structures
ures and Table Types .......................................................................
....................... 174 6 St
Stor
orin
ing
gDDat
ata
a in
in W
Wor
orki
king
ng Me
Memo
mory
ry 229
4.13.1 Creating Structures ........................................................................
....................... 174
4.13.2 Creating Table Types .....................................................................
........................ 176
6.1 Using
Using ABAP
ABAP D
Dict
iction
ionary
ary Data
Data T
Type
ypess ........................................................
......... 229
4.14
4.14 Sear
Search
ch Hel
Help
p .......................................................................................................
.................................................. 177
6.2 Creati
Creating
ng Data
Data Typ
Types
es wi
with
th the T
TYPE
YPE Ke
Keywo
yword
rd ..........
...........
...........
...........
............
........... 231
4 .1
.1 5 V iie
e ws
ws ....................................................................................................
...................................................................
............... 181
6.3
6.3 Fi
Fiel
eld
d Sym
Sym b
bol
olss ...................................................................................................
.................................................... 233
4.16
4.16 Su
Sum
m mar
mary
y ...................................................................................................
..........................................................
........ 184
6.4 Def
Defini
ining
ng Intern
Internal
al Tables .............................................................................
Tables .......................... 234
6.4.1 Defining Standard Tables ............................................................. ....... 234
6.4.2 Keys in Internal Tables ..................................................................
................ 236
5 Acce
Access
ssin
ing
g the
the Da
Data
taba
base
se 185 6.4.3 Defining Sorted Tables .................................................................
................. 238
6.4.4 Defining Hashed Tables ...............................................................
................. 240
5.1
5.1 SQ
SQLL Con
Conso
sole
le iin
n Ec
Ecli
lips
pse
e .................................................................................
.................................. 186 6.5 Rea
Readin
ding
g Da
Data
ta fr
from
om IInte
nterna rnall Table
Tabless ........................................................
......... 241
6.5.1 READ TABLE .......................................................................................
................................... 241
5 .2
.2 Re a
ad
d in
in g Da a ...................................................................................................
Da tta ................................................... 187
6.5.2 LOOP AT .............................................................................................
............................................ 247
5.2.1 SELECT Statements ........................................................................
....................... 188
5.2.2 INNER JOIN ........................................................................................
......................................... 192 6.6 Modify
Modifying
ing Intern
Internal
al Tables
Tables .........................................................................
.......................... 250
5.2.3 LEFT OUTER JOIN .............................................................................
................................ 197 6.6.1 Inserting/Appendi
Inserting/Appending ng Rows ......................................................... .......... 250
5.2.4 FOR ALL ENTRIES IN ........................................................................
...................... 199 6.6.2 Changing Rows ................................................................................
.................................... 253
5.2.5 With SELECT-OPTIONS ..................................................................
...................... 201 6.6.3 Deleting Rows ..................................................................................
................................... 255
5.2.6 Aggre
Aggregate
gate Expression
Expressionss iin n SSELECT
ELECT State Statement mentss ............... ............
...... 203 6.7 Other
Other Inte
Interna
rnall Table
Table Ope Operat rationionss .............................................................
......... 257
5.2.7 New Open SQL .................................................................................
................................ 205 6.7.1 Copying Table Data ........................................................................
......................... 257
5.2.8 ABAP CDS Views ..............................................................................
............................... 207 6.7.2 SORT ....................................................................................................
.................................................... 258
5.3
5.3 Chhan
angg iing
ng Da
Data
ta ................................................................................................
.................................................. 210 6.7.3 DELET
DELETEE AADJACE
DJACENT NT DUPL
DUPLICATE ICATESS FROM ............ ............
...........
..........
.............
......... 260
5.3.1 INSERT ................................................................................................
.................................................. 210 6.8 Which
Which Tab
Table
le Should
Should Be U
Used
sed?? ..................................................................
.................. 261
5.3.2 MODIFY/UPDATE ............................................................................
.................................. 211
6.9 Upd
Updati
ating
ng ABAP
ABAP Di
Dicti
ctiona
onary
ry Table
Table Type
Type ................................................. 263
5.3.3 DELETE ................................................................................................
.................................................. 213
6.10 Obsol
Obsolete
ete Wor
Working
king Memory Syntax
Syntax ................................................................ 265
5 .4
.4 Ta
abb le
le L o
occ k
kss .........................................................................................................
................................................. 214
6.10.1 WITH HEADER LINE ........................................................................
......................... 266
5.4.1 Viewing Table Locks .......................................................................
....................... 216
5.4.2 Creating Table Lock Objects ........................................................ ............... 218 6.10.2 OCCURS ..............................................................................................
........................................... 266
6.10.3 Square Brackets ...............................................................................
.................................. 267
5.4.3 Setting Table Locks ........................................................................ ............... 220
6.10.4 Short Form Table Access ..............................................................
.................. 267
5.5
5.5 Pe
Perfo
rform
rman
ance
ce Topi
Topics
cs ......................................................................................
................................. 224 6.10.5 BINARY SEARCH ...............................................................................
................................. 267
5.6 Obs
Obsole
olete
te Da
Datab
tabase
ase Acces
Accesss Key
Keywor
words ds ...................................................
........ 226 6.11
6.11 Sum
Sum m
mar
ary
y ..................................................................................................
.............................................................
......... 268
5.6.1 SELECT…ENDSELECT .......................................................................
........................ 226
5.6.2 Short Form Open SQL ....................................................................
............... 227
5.7 Summary ...................................................................................................
..........................................................
........ 227
10 11
Contents Contents
7.1
7.1 Sepa
Separa
rati
tion
on of
of Conc
Concern
ernss ................................................................................
............................ 269 8 .3
.3 Exce
Except
ptio
ion
n Cla
Class
sses
es ...........................................................................................
........................................... 341
8.3.1 Unhandled Exceptions ..................................................................
................. 342
7. 2 S ub
ub ro
ro u
utt in
ine s ..................................................................................................
.......................................................
.... 272
8.3.2 TRY/CATCH Statements ................................................................................ 348
7.3 Introd
Introductio
uction
n to Object-
Object-Orient
Oriented ed Progra
Programmin mming g ........
...........
..........
...........
............
..... 274 8.3.3 Custom Exception Classes ........................................................... ................ 350
7.3.1 What Is an Object? ..........................................................................
........................... 274
8.4
8.4 No
Non-C
n-Clas
lass-
s-Bas
Based
ed Ex
Excep
cepti
tions
ons .....................................................................
................. 355
7.3.2 Modul
Modulariz
arizing
ing with Obje
Object-Or
ct-Oriente
iented
d Prog
Programm
ramming
ing .......
..........
..... 276
8.5 Summary ...................................................................................................
..............................................................
....... 358
7.4
7.4 St
Stru
ruct
ctur
urin
ing
g Cla
Class
sses
es .........................................................................................
..................................... 277
7.4.1 Implementati
Implementation on versus Definition ........................................... 278
7.4.2 Creating Objects ..............................................................................
.......................... 278
7.4.3 Public and Private Sections .......................................................... ......... 280 9 Pres
Presen
enti
ting
ng Data
Data Usin
Using
g tthe
he
7.4.4 Class Methods ..................................................................................
..................................... 282
ABAP List Viewer 361
7.4.5 Impor
Importing,
ting, Returnin
Returning, g, Export
Exporting, ing, and Chan Changing ging ...........
............
....... 286
7.4.6 Constructors ......................................................................................
................................... 293
9 .1
.1 W ha
ha t I s A LLV
V ? ....................................................................................................
................................................... 361
7.4.7 Recursion ...........................................................................................
............................................ 295
7.4.8 Inheritance ........................................................................................
............................................ 297 9.2 Rep
Report
ort Exa
Example
mple Usi
Using
ng a
an
n SA
SALV
LV T
Table
able ................................................... 366
12 13
Contents Contents
10.3 Accessi
Accessing
ng th
the
e Data
Database
base S
Soluti
olution
on ...........................................................
.............. 405 12.1.3 Datum Date Type .............................................................................
.......................... 473
12.1.4 System Date Fields ..........................................................................
.......................... 475
10.4 Creati
Creating
ng a Mess
Message
age Class
Class for the So
Solutio
lution
n ......................................... 415
12.1.5 Date-Limited Records .....................................................................
.................. 475
10.5 Creati
Creating
ng Cla
Classic
ssic Screens
Screens for the
the Solut
Solution
ion ........................................... 416
1 2. ime s .........................................................................................................
2. 2 T im ................................................................
......... 477
10.5.1 Product Maintenance Program .................................................
..... 417
12.2.1 Calculating Time ..............................................................................
.......................... 477
10.5.2 Shopping Cart Maintenance Program ..................................... 423
12.2.2 Timestamps .......................................................................................
................................... 478
10
10.6
.6 Su
Sum
m mar
mary
y ......................................................................................................
........................................................
...... 429 12.2.3 SY-UZEIT (System Time versus Local Time) ............................ 482
12.3
12.3 Quan
Quantitities .........................................................................................................
ties ...................................................... 482
12.3.1 Quantity Fields in Data Dictionary ........................................... 484
11 Wor
Workin
king
g wit
with
h Str
String
ingss and T
Text
extss 431 12.3.2 Converting Quantities ................................................................... .................. 485
12.4
12.4 Curre
Currenc iess .........................................................................................................
ncie ...................................................... 486
11.1
11.1 Str
String
ing Man
Manipu
ipulat
lation
ion ......................................................................................
...................................... 431 12.4.1 Currency Fields in Data Dictionary ........................................... 487
11.1.1 String Templates ............................................................................
................................ 432 12.4.2 Converting Currencies ................................................................... .................. 488
11.1.2 String Functions ..............................................................................
.............................. 435
12.5 Upda
Updating
ting the
the Shopping
Shopping C
Cart
art Example ..................................................
Example 490
11
11.2
.2 Text
Text Symb
Symbol
olss ....................................................................................................
................................................ 437 12.5.1 Updating the Database .................................................................
................. 491
11.2.1 Creating Text Symbols ...................................................................
...................... 437 12.5.2 Updating the Global Class ............................................................
........ 497
11.2.2 Translatin
Translating g Text Symbols ............................................................. ............. 442 12.5.3 Updating the ABAP Programs .....................................................
........ 500
11.3 Trans
Translatin
lating
gDData
ata in Tables ..........................................................................
.................... 445 12.6
12.6 Sum
Sum m
mary ...........................................................................................................
ary ..................................................... 504
11.4
11.4 Transl
Translati
ating
ng Messa
Messages
ges ..................................................................................
............................... 451
11.5 Obsole
Obsolete
te Stri
String
ng an
and
d Text Comma
Commands
nds ...................................................
...... 453
11.6 Updat
Updating
ing the
the Shop
Shopping
ping C
Cart
art Example
Example ................................................. 454 13 Use
Userr Interf
Interface
ace Tech
Technol
nologi
ogies
es 505
11.6.1 Updating the Database .................................................................
............. 454
11.6.2 Using the Text Table .......................................................................
..................... 460 13.1 Worki
Working
ng wi
with
th Classic
Classic Dynpro Screens ..................................................
Dynpro 505
11
11.7
.7 Su
Sum
m mar
mary
y ......................................................................................................
........................................................
...... 463 13.1.1 Dynpro Screen Events ....................................................................
.................. 506
13.1.2 Creating a Dynpro Screen .............................................................
......... 508
13.2
13.2 Modern
Modern UI Tec
Techno
hnolog ies ..............................................................................
logies ........................... 528
13.2.1 Web Dynpro .......................................................................................
................................... 529
12 Workin
Workinggwwith
ith Dates
Dates,, Tim
Times,
es, Quanti
Quantities,
ties, 13.2.2 SAP Screen Personas .......................................................................
.......................... 531
and Currencies 465 13.2.3 SAP Gateway, SAPUI5, and SAP Fiori .........................................
.............................. 532
13.3
13.3 Sum
Sum m
mary ...........................................................................................................
ary ..................................................... 534
12
2.. 1 D at
at es
es ......................................................................................................
................................................................
.............. 465
12.1.1 Date Type Basics ..............................................................................
............................. 466
12.1.2 Factory Calendars ...........................................................................
.............................. 469
14 15
Contents
14 Wor
Working
king with
with ABAP
ABAP Profes
Professio
sionall
nally
y 535
14.1 ABAP System
System Archi
Architecture
tecture Basics ...........................................................
............ 535
14.2
14.2 Tra
Transp
nsport
ort Managem
Management
ent ..............................................................................
............................. 539
14.3 Authorizat
Authorization
ion Conce
Concept
pt ................................................................................
............................. 550
14.3.1 Authorization Object .....................................................................
................... 550
14.9
14.9 Too
Tools
ls of
of the Trade ..........................................................................................
the Trade ...................................... 611
14.10 Backward Compatibility and
and Dealing with Legacy Code ..........
........
... 621
14.11 Summ
Summary
ary .......................................................................................................
.......................................................
.... 623
Appendices 525
A Prepa
Prepari
ring
ng Your
Your Deve
Develo
lopm
pmen
entt Envir
Environ
onme
ment
nt ...................................... 627
B Inter
Interfa
face
ces,
s, Fo
Form
rms,
s, En
Enha
hanc
ncem
emen
ents
ts ..........................................................
............. 645
C Diff
Differ
eren
ences
ces Be
Betw
tween
een AB
ABAP
AP Ve
Vers
rsio
ions
ns ....................................................
.... 661
D Other Re
Resources .............................................................................................
............................................. 667
E The Authors ..................................................................................................
.......................................................
.... 671
Index ....................................................................................................
...................................................................................
.............................. 673
16
Index
A ABAP Unit ..................................................... 593
wizard ........................................................ 598
ABAP ABAP versions ................................................ 28
backward compatibility .................... 621 ABAP Workbench, Transaction
code updates .......................................... 621 SE80 ............................................................ 639
modern syntax ...................................... 622 abap_bool ........................................................ ... 57
obsolete code support ........................ 622 abap_false ........................................................
........... 57
system implementation ..................... 622 abap_true .........................................................
........... 57
versions ....................................................
....... 661 ABAP-based IDEs IDEs ........................................ 639
ABAP CDS ............................................ 207, 663 abapGit .............................................................
............ 99
ABAP clients ............................................ 28, 29 abs .......................................................................
.............................. 69
SAP Fiori ......................................................
.......... 28 Activation log
SAP GUI .......................................................
......... 28 warnings .................................................. 154
SAP NetWeaver Business Client ......... 28 ADD ....................................................................
..................... 68
ABAP daemons
daemons ........................................... 665 Adobe LiveCycle
LiveCycle Designer Designer ..................... 654
ABAP Debugger
Debugger .......................................... 108 Aggregatee expressions ............................ 203
Aggregat
ABAP Development Tools in Aliases ............................................................
........... 194
Eclipse ....................................................... 128 ALV .........................................................
...... 361, 602
ABAP
ABAP on SAPeCloud
packag
package Platform ............... 665
............................................. 540 Application etable
txpressions
able .......................................
Arithmetic expressions .............................146
68
ABAP perspective
perspective ......................................... 36 Arithmetic operations
operations ................................ 65
select ............................................................. 36 AS ............................................................
.................... 194, 206
ABAP report .................................................... 81 AT SELECTION-SCREEN
SELECTION-SCREEN .............................. 93
ABAP statement
statement ............................................ 45 event .............................................................
........... 93
ABAP syntax ................................................... 45 AUTHORITY-CHECK
AUTHORITY-CHE CK ................................. 560
ABAP Test Cockpit
Cockpit ............................ 611, 615 Authorization
ABAP trial
trial .....................................................
........ 628 group .........................................................
............ 170
trace ...........................................................
............ 563
Authorization check check ................................. 550
673
Index Index
Buffering .......................................................
............ 224 CONCATENATE ........................................... 453 f (floating p oint) ....................................... 54 DELETE ........................................ 213, 413, 420
options ......................................................
....... 151 Constants ..................................................
... 52, 62 i .................................................................
.................. 53, 74 FROM...WHERE ....................................... 414
Business Add-Ins
Add-Ins (BAdIs) ........................ 657 abap_false .................................................. 57 n (numeric) ................................... 53, 55, 5 56
6 DELETE ADJACENT DUPLICATES
abap_true ................................................... 57 p (packed) .................................................... ..... 54 FROM ......................................................... 260
C naming ........................................................ 62 s .......................................................................
........................ 53 COMPARING ........................................... 260
Constructor ........................................ 409, 412 string ...................................................... ..... 55, 56 COMPARING ALL FIELDS ................... 260
Calendar Control flow
flow ..................................................... 72 SYST ............................................................... 63 DELETE TABLE
TABLE .................................... 255, 263
factory .......................................................
............ 469 Core data services
services (CDS) ................... 28, 207 t (time) .................................................. 55, 55, 56 hashed table ........................................... 257
fiscal year ................................................. 473 CREATE OBJECT ........................................... 303 Database sorted table ............................................. 257
CALL SELECTION-SCREEN
SELECTION-SCREEN ......................... 88 Crow’s foot notation ................................. 126 definition .................................................... 121 WHERE .......................................................
....... 257
WITH TABLE KEY ................................... 256
674 675
Index Index
Deletion anomaly
anomaly ...................................... 124 Enhancement category ................. 153, 160 File IF ...........................................................................
............................. 72
Delivery and
and maintenance
maintenance .................... 146 Enhancement framework ............ 659, 662 interfaces ................................................. 645 AND ................................................................
.......... 73
DEQUEUE ................................... 216, 220, 223 Enhancements ............................................ 654
Enhancements logical name ........................................... 582 ELSE ................................................................
.......... 73
Design patterns
patterns .......................................... 317 ENQUEUE ....................................................... ..... 220 on application server .......................... 577 ELSEIF ............................................................
.......... 75
DEV environment
environment ..................................... 536 Enterprise resource plan planningning ................. 23 on presentation server ....................... 567 OR ....................................................................
..................... 73
Developmentt guidelines ........................ 582
Developmen Entity ...............................................................
............. 123 transfer protocol ................................... 645 IF statement operators
operators ............................... 76
Developmentt standards
Developmen standards ........................... 42 Entity relationship diagrams Flight model INCLUDE ........................................................ 517
DevOps ........................................................... 535 (ERDs) .........................................................
...... 123 load data .................................................. 169 Initial value .................................... 51, 71, 147
DIV ..................................................................... 66 Entry help/check
help/check ........................................ 159 Floor ...................................................................
................. 69 INITIALIZATION
INITIALIZAT ION ............................................ 92
DIVIDE .............................................................. 68 ERD ..................................... 123, 389, 455, 490
490 Flow control
control ...................................................... 72 Inline data declaration ... 61, 189, 420, 427
DO ...................................................................... 79 crow’s foot notation, relationship Flow logic ...................................................... 516 INNER JOIN .......................................... 192, 414
Documentation
Documentat ion ................................ 161, 586 indication ............................................ 126 FLUSH_ENQUEUE
FLUSH_ENQ UEUE ..................................... 222 Input help ..................................................... 178
Domain .................... 121, 130, 135, 394, 400 normalized ............................................... 125 FOR ALL ENTRIES IIN N ................................. 199 INSERT ......................................... 210, 250, 263
range .......................................................... 137 Event ..................................................................
............... 92 Foreign key key ............................... 126, 148, 399 hashed table ........................................... 252
DSAG guidelines
guidelines ........................................ 584 AT SELECTION SCREEN .......................... 93 cardinality ............................................... 157 INDEX .........................................................
........... 250
Dynamic breakpoints
breakpoints .............................. 106 INITIALIZATION ....................................... 93 create ......................................................... 157 LINES FROM ............................................ 251
Dynamic programprogram ..................................... 505 START-OF-SELECTION ........................... 95 set ................................................................
.................... 156 sorted table ............................................. 252
Dynpro ........................................................... 505 Exception ............................................................ 341 Form ................................................................
.................. 649 Insert anomaly
anomaly ........................................... 125
create screen ........................................... 508 500 SAP interna l server error ........... 343 FORM CHANGING
CHANGING ..................................... 274 Integrateddevelopment
Screen events .......................................... 506 CATCH BEFORE UNWIND ................... 350 FORM...ENDFORM ..................................... 272 environments
environme nts (IDEs) ........................... 627
screen flow diagram ............................ 507 CATCH...INTO .......................................... 349 Format your code ......................................... 96 Internal tables ............................. 59, 229, 261
categories ................................................. 350 frac ......................................................................
................... 69 hashed key ............................................... 237
676 677
Index Index
LENGTH ............................................................. 55 Message class ..................................... 331, 359 FINAL ......................................................... 309 WHERE .......................................................
.......... 191
LOOP AT .................................................... 247 create ..........................................................
......... 333 global classes ...................... 308, 309 309,, 390 WHERE IS NULL ..................................... 198
MODIFY TABLE ...................................... 253 long text .................................................... 337 IMPORTING ................................... 286, 289 WHERE..IN ............................................... 201
MOVE ........................................................... 65 MESSAGE .................................................. 336 INHERITING FROM .............................. 298 Operand .............................................................
.......... 76
OCCURS ..................................................... 266 WITH ...........................................................
......... 339 INTERFACES ............................................ 305 Operator
ON ...............................................................
.................. 193 Method ............................................................
............... 432 method .................................. 275, 282, 283 ADD ................................................................
................. 68
OPEN DATASET… FOR OUTPUT ....... 579 Middleware ....................................................
...... 645 object ......................................................... 274 DIVIDE ...........................................................
......... 68
PARAMETER .............................................. 81 MOD .................................................................. 66 OPTIONAL ............................................... 290 MULTIPLY ..................................................... 68
PERFORM ................................................. 272 Modalities ......................................................
........ 127 private section ....................................... 280 SUBTRACT ................................................... 68
READ TABLE ............................................ 241 MODIFY ............................. 211, 263, 413, 420 protected sec tion ......................... 280, 301 Optimistic lock ........................................... 216
REPORT ................................................ 39, 81 sorted table .............................................. 254 public section ......................................... 280 OR ........................................................................
............................ 73
SELECT-OPTIONS ..................................... 86 MODIFY TABLE ............................................ 253 READ-ONLY attributes ....................... 281 Order of operations
operations ..................................... 66
SORT ........................................................... 258 INDEX ......................................................... 254 REDEFINITION ....................................... 300 Origin of the the input help .......................... 148
TRANSFER ................................................
TYPE ............................................. 51, 97, 579
51, 231 WHERE ........................................................
......... 253 RETURNING ................................... 286, 287 Output
Output implementation
implementation
program ......................... 649
......................................... 649
Modularization ........................................... 269 returning parameters ......................... 293
USING ........................................................
............ 273 Module pool ................................................. 506 506 subclass .....................................................
..... 298
VALUE ................................................... 51, 71 MOVE ................................................................ 65 superclass ................................................ 298 P
WITH HEADER LINE ............................. 266 MOVE-CORRESPONDING
MOVE-CORRESPO NDING ....................... 258 TYPE REF TO ............................................ 278
WITH KEY ................................................. 245 Multi-paradigm programming .............. 27 One-to-many relation
One-to-many relationship ship .................... 127 Package ................................................. 145,
145, 540
WITH TABLE KEY ................................... 245 MULTIPLY ........................................................ 68 One-to-one relationship ......................... 127 $TMP ........................................................ 39, 43
WRITE ..........................................................
........ 45 Online analytical processing
processing (OLAP) .... 25 Packed numbers
numbers ........................................... 54
Online transactional processing Parameter ..................................................
... 80, 81
(OLTP) ........................................................... 25 _COLLECT ................................................. 222
OPEN DATASET…
DATASET… FOR OUTPU OUTPUT T ........... 579 _WAIT ........................................................ 222
678 679
Index Index
Program attributes
authorization group .............................. 42 RICEF ......................................
..........................
........................ 611
645 SAP S/4HANA
forms ................................................
........................................ .................. 26
................ 649 Shared
Short lock ................................................... 215
form
Runtime Analysis .......................................
editor lock .................................................. 42 tables ..........................................................
................ 144 \[\] .........................................................
.........................................................
...... 267
fixed point arit hmetic ........................... 43 S SAP Screen
Screen Personas ................................ 531 LOOP AT .................................................... ........ 267
language version .................................... 43 SAP Solution
Solution Manag Manager er ................... 549, 586 OCCURS ..................................................... ........ 266
logical database ...................................... 42 SAIRPORT .......................................................
........................ 134 SAP Transport Management Management READ TABLE ............................................ 267
selection screen ........................................ 42 SALV .................................................................
........................ 364 System (SAP TMS) ................................ 538 WITH HEADER LINE ............................. 266
start using variant .................................. 43 demo programs ......................................
.......................... 371 SAPBC_DATA_GENERATOR
SAPBC_DATA_GEN ERATOR .................. 169 Short form
form Open SQL ............................... 227
status ............................................................
....... 42 table .............................................................
........................... 366 SAPBC_DATAMODEL
SAPBC_DATAMOD EL ................................
......................... 133 Sign ...........................................................
......... 69, 202
Unicode checks active ........................... 43 tree ...............................................................
........................... 371 SAPscript .............................................. 649, 652 Signature ........................................................ ..... 314
Program lifecycle events .......................... 92 SAP Basis .......................................................... 25 SAPTEXTEDIT
SAPTEXTEDI T ...............................................
.............................. 523 Simple Object Access Protocol
Promote optimistic lock ......................... 216 SAP Build ........................................................
........ 391 SAPUI5 .................................................... 33, 532 (SOAP) ........................................................ ..... 648
Pseudocode ..................................................
.......................................... 412 SAP Business Suite powered by Scope ...............................................................
.............. 216 Single quotes .................................................. 45
Screen Painter ............................................. 509 numeric variables .....................................
............................ 57
SAP HANA .................................................. 26 Screen stack ................................................. 111 Single records buffered ........................... 224
Q SAP Cloud Appliance Library ................ 627
Amazon Web Services ......................... 630 Search help ......................................... 149, 178 Size category ................................................ 160
QA eenvironment
nvironment ........................................ 536 Microsoft Azure ......................................
............................ 630 SELECT ........................................ 187, 224, 414 Smart Forms ................................................ 649
Quantities .....................................................
......................................... 482 trial system ...............................................
.......................... 627 * .....................................................................
...................... 188 SORTED TABLE ............................................ 238
QUAN .........................................................
......................................... 484 SAP ERP COUNT ....................................................... ........ 203 Space category ............................................ 151
UNIT ...........................................................
.......................................... 484 output implementation ...................... 649 INTO CORRESPONDING ........... ...........
..........
..... 374 Spool requests ............................................ 609
UNIT_CONVERSION_SIMPLE .............. 485 SAP ERP ECC ..................................................... 24 INTO TABLE ............................................. 188 SQL ............................................................
.........................................................
....... 185
SAP ERP systems .......................................... 23 MAX ............................................................
............. 204 START-OF-SELECTION
START-OF- SELECTION ................................. 93
SAP FFiori
iori ................................................. 33, 532 MIN .............................................................
................ 204 event ..............................................................
........................ 95
SAP FFiori
iori launchpad
launchpad .................................... 33 SUM .............................................................
................ 204
680 681
Index Index
String .................................................. 45, 56, 61 T Transaction SE80 (Cont.) SUIM (User Information System) ... 564
ALIGN ........................................................
............ 433 create screen ........................................... 509 VOFM ......................................................... 657
chaining strings ..................................... 433 Table edit program ............................................. 44 Translate ........................................................
........ 454
concat_lines_of ..................................... 435 custom transparent ............................. 154 format code ............................................... 96 Transparent table ........ 121, 123, 144, 154,
CONDENSE ............................................... 435 normalized ............................................... 134 form-based v iew ................................... 312 210, 235, 236, 388, 389
DECIMALS ................................................ 435 SBOOK .......................................................
.......... 134 IDE settings ................................................ 44 currency/quantity
PAD ............................................................. 433 SCARR ........................................................
.......... 134 pretty print ................................................. 96 fields ................................... 484, 487, 488
SIGN ............................................................ 434 SCUSTOM ................................................. 134 program attribute s ................................. 41 Transport .......................................................
........ 538
string functions ..................................... 435 SFLIGHT ....................................................
....... 134 source code view ................................... 312 view .............................................................
.................... 548
682 683
Index
Whitespace ..................................................... 66 Z
Wireframe .................................. 391, 417, 423
WRITE ...............................................................
.................. 45 Zero-to-many relationship .................... 127
127
WRITE Hello, World! program ................ 45 Zero-to-one relationship ......................... 127
xUnit ...............................................................
..................... 593
684
First-hand knowledge.
Brian O’Neill is an ABAP developer with more than 10 ye-
ars of experience working across different SAP ERP modules
and custom applications. His experience includes working
in various IT positions, from SAP support to ABAP develop-
reading sample and all its parts are protected by copyright law. All usa-
www.sap-press.com/4955 ge and exploitation rights are reserved by the author and the publisher.