0% found this document useful (1 vote)
446 views

Reading Sample Sap Press Complete Abap

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
446 views

Reading Sample Sap Press Complete Abap

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

First-hand knowledge.

Reading Sample
In this sample chapter, you’ll learn how to enable dynamic pro-
grams in ABAP. Dynamic programs return results based on user
inputs. This chapter teaches you how to use field symbols, data
references, specifications, procedure calls, and more in a dynamic
way.

“Dynamic Programming”

Contents

Index

The Author

Kiran Bandari
Complete ABAP
912 pages, 2022, $89.95
ISBN 978-1-4932-2305-3

www.sap-press.com/5567
Chapter 16
Dynamic Programming
A dynamic program returns results based on specific user input that
changes and can only be determined at runtime. This chapter explains
how to enable dynamic programs in ABAP.

Software applications are developed to solve a problem or to help users with their day-
to-day activities. Most of the time, the problem is known beforehand, and the design
and development of the application focuses on solving the problem at hand. For exam-
ple, assume your company follows a vendor-managed inventory model in which if
goods are unsold for 30 days, the company becomes billable to the supplier. At this
point, the company can either pay to keep the inventory or return it to the supplier.
To accommodate this business process, you need to develop a set of applications that
allows a user to capture information when goods arrive in the warehouse and a report
16
that can show the age of the inventory. The report helps the supervisor check the goods
that are reaching the end of the supplier contract period.
To develop applications for this requirement, we know all the information that we
need to process in the program at design time. For example, we know which tables to
update the data in, and we know which tables to query to calculate the age of the inven-
tory for the report. All this information is available statically (beforehand) at design
time.
To show the age of the inventory, we could write the code shown in Listing 16.1.

SELECT item_id item_name in_date INTO it_inv FROM ztabinv WHERE


in_date LE p_date.
WRITE : / 'The following items exceed 30 days'.
LOOP AT it_inv INTO wa_inv.
WRITE: / wa_inv-item_id, wa_inv-item_name, wa_inv-in_date.
ENDLOOP.

Listing 16.1 Sample Code for Inventory Age

To write the code as shown in Listing 16.1, we need to know the table name and the
fields of the table statically. In the program, we statically define the data objects and
access them statically by addressing the name of the data object.

579
16 Dynamic Programming 16.1 Field Symbols

However, sometimes we may not have all the information until runtime. What if the three fields, FIELD1, FIELD2, and FIELD3, and we want to modify the third row of the
table to which we need to write the select query depends on the result of the previous internal table. The code shown in Listing 16.2 handles this scenario.
statement? It isn’t possible to include the table name statically in the query; to handle
DATA wa LIKE LINE OF itab.
such scenarios, we use dynamic programming.
wa-field1 = 'ABC'.
You can handle dynamic programming in various ways. Sometimes, a program may wa-field2 = 'XYZ'.
have mostly static elements, but some part of it may be dynamic, or the complete pro- wa-field3 = 123.
gram itself could be dynamic. Sometimes, you may even need to create new programs MODIFY itab FROM wa INDEX 3.
on the fly dynamically or call procedures dynamically. In this chapter, we’ll explore
Listing 16.2 Modifying an Internal Table Record Using a Work Area
how to handle all these scenarios.
ABAP supports various concepts to make ABAP programs dynamic. We’ll begin by dis- In Listing 16.2, we’re using work area wa to modify the internal table record. Here, wa and
cussing field symbols in Section 16.1. Field symbols act as pointers and can be used to itab are two separate memory locations, and we’re using the MODIFY statement to copy
point to any data object of the program dynamically, allowing you to determine the contents of wa to itab.
dynamically which data object should be accessed at runtime.
Listing 16.3 shows how the same end can be achieved using field symbols.
We’ll discuss data references in Section 16.2, which, similarly to field symbols, allow you
FIELD-SYMBOLS: <wa> LIKE LINE OF itab.
to point dynamically to existing data objects in the program. However, data references
READ TABLE itab ASSIGNING <wa> INDEX 3.
also allow you to create data objects dynamically. Another important aspect of
IF <wa> IS ASSIGNED.
dynamic programming is the ability to determine the type information of an existing
<wa>-field1 = 'ABC'.
data object dynamically or to create a data type dynamically. <wa>-field2 = 'XYZ'.
In Section 16.3, we’ll discuss Runtime Type Services (RTTS) and explore identifying and <wa>-field3 = 123. 16
creating data types dynamically. ENDIF.

Business requirements sometimes demand that you determine dynamically the data- Listing 16.3 Modifying an Internal Table Record Using a Field Symbol
base table from which the data is fetched, which program/transaction should be called
during the program flow, or something similar. ABAP allows you to determine the In Listing 16.3, we defined a <wa> field symbol as a line of itab. The READ statement
database table, procedure, program, transaction, and so on dynamically by providing assigns the third row of the internal table to field symbol <wa>. At this point, field sym-
the token dynamically in the code. bol <wa> points to the third row of the internal table. When we change a field, through
You’ll learn about dynamic token specification in Section 16.4 and dynamic procedure the field symbol, the field of the third row is changed immediately because the field
calls in Section 16.5. Not only can you make the ABAP code within an ABAP program symbol points to the third row directly.
dynamic, but you also can generate the complete ABAP program itself dynamically. We don’t have to copy the contents manually using the MODIFY statement as we did in
We’ll conclude this chapter with a discussion of dynamic program generation in Sec- Listing 16.2 because the <wa> field symbol in Listing 16.3 doesn’t take a separate memory
tion 16.6. space but points to the existing memory, unlike work area wa in Listing 16.2.
After the data object is assigned to the field symbol, we can work with the field symbol
just like the assigned data object and perform operations that can usually be performed
16.1 Field Symbols on the assigned data object. Almost any data object can be assigned to a field symbol.

A field symbol is similar to a pointer, which points to an existing data object. A field As you can see in Listing 16.3, there is a way to define field symbols, assign a data object
symbol isn’t a data object; it doesn’t hold any memory on its own. Instead, when a data to a field symbol, check if the field symbol is assigned before accessing the field symbol,
object is assigned to a field symbol, it points to the memory location of the assigned and more. Before we discuss these aspects, however, let’s look at how field symbols can
data object. help make programs dynamic.

A field symbol serves as a label for its assigned data object, which you can access as you
would access the data object itself. For example, assume there is an internal table with

580 581
16 Dynamic Programming 16.1 Field Symbols

16.1.1 Using Field Symbols to Make Programs Dynamic *---------------------------------------------------------------*


* CLASS lcl_event_handler IMPLEMENTATION
For our example, we’ll use a report to show some basic information about a material. In
*---------------------------------------------------------------*
this report, we’ll use the SAP List Viewer (ALV) object model to display the output. We’ll
CLASS lcl_event_handler IMPLEMENTATION.
provide functionality for the user to double-click in any cell to filter the records based
METHOD on_double_click.
on the value of the cell and show the result in a new container below the displayed out-
DATA : lo_sel TYPE REF TO cl_salv_selections,
put. ls_cell TYPE salv_s_cell,
Most of the components of this report are static as we already know the data to be dis- container_2 TYPE REF TO cl_gui_container,
played in the output and the user input for the report. However, filtering the records lt_mara TYPE STANDARD TABLE OF ty_mara,
based on user action is dynamic. Let’s look at how we can achieve this in a static way lw_mara TYPE ty_mara.
and then look at how to make it dynamic. *Get reference to the user selection.
lo_sel = mo_alv->get_selections( ).
Listing 16.4 shows the code for the report using the ALV object model. The code is long,
*Get the value of the cell
but very straightforward. Take some time to go through the code and try it out in your
ls_cell = lo_sel->get_current_cell( ).
system. *Logic to filter records
REPORT zdemo_salv_static. IF ls_cell-columnname EQ 'MATNR'.
CLASS lcl_event_handler DEFINITION DEFERRED. LOOP AT it_mara INTO lw_mara WHERE matnr EQ ls_cell-value.
DATA: custom_container TYPE REF TO cl_gui_custom_container, APPEND lw_mara TO lt_mara.
splitter TYPE REF TO cl_gui_splitter_container, ENDLOOP.
container_1 TYPE REF TO cl_gui_container, ELSEIF ls_cell-columnname EQ 'ERSDA'.
so_alv TYPE REF TO cl_salv_table, LOOP AT it_mara INTO lw_mara WHERE ersda EQ ls_cell-value.
16
mo_alv TYPE REF TO cl_salv_table, APPEND lw_mara TO lt_mara.
gr_event_handler TYPE REF TO lcl_event_handler, ENDLOOP.
gr_event TYPE REF TO cl_salv_events_table. ELSEIF ls_cell-columnname EQ 'ERNAM'.
TYPES: BEGIN OF ty_mara, LOOP AT it_mara INTO lw_mara WHERE ernam EQ ls_cell-value.
matnr TYPE mara-matnr, APPEND lw_mara TO lt_mara.
ersda TYPE ersda, ENDLOOP.
ernam TYPE ernam, ELSEIF ls_cell-columnname EQ 'LAEDA'.
laeda TYPE laeda, LOOP AT it_mara INTO lw_mara WHERE laeda EQ ls_cell-value.
mtart TYPE mtart, APPEND lw_mara TO lt_mara.
END OF ty_mara. ENDLOOP.
DATA: it_mara TYPE STANDARD TABLE OF ty_mara, ELSEIF ls_cell-columnname EQ 'MTART'.
gv_matnr TYPE matnr. LOOP AT it_mara INTO lw_mara WHERE mtart EQ ls_cell-value.
SELECT-OPTIONS: s_matnr FOR gv_matnr. APPEND lw_mara TO lt_mara.
ENDLOOP.
ENDIF.
*&--------------------------------------------------------------* CALL METHOD splitter->get_container
*& Class LCL_EVENT_HANDLER EXPORTING
*&--------------------------------------------------------------* row = 2
CLASS lcl_event_handler DEFINITION. column = 1
PUBLIC SECTION. RECEIVING
METHODS : on_double_click FOR EVENT double_click OF cl_salv_events_ container = container_2.
table IMPORTING row column.
ENDCLASS. "LCL_EVENT_HANDLER

582 583
16 Dynamic Programming 16.1 Field Symbols

TRY. row = 1
IF so_alv IS BOUND. column = 1
so_alv->set_data( CHANGING t_table = lt_mara ). RECEIVING
ELSE. container = container_1.
CALL METHOD cl_salv_table=>factory *Get ALV Object reference
EXPORTING TRY.
list_display = if_salv_c_bool_sap=>false CALL METHOD cl_salv_table=>factory
r_container = container_2 EXPORTING
IMPORTING list_display = if_salv_c_bool_sap=>false
r_salv_table = so_alv r_container = container_1
CHANGING IMPORTING
t_table = lt_mara. r_salv_table = mo_alv
ENDIF. CHANGING
CATCH cx_salv_no_new_data_allowed. t_table = it_mara.
CATCH cx_salv_msg . CATCH cx_salv_msg .
ENDTRY. ENDTRY.
* Set the event handler here
so_alv->display( ). gr_event = mo_alv->get_event( ).
ENDMETHOD. "on_double_click CREATE OBJECT gr_event_handler.
ENDCLASS. "lcl_event_handler SET HANDLER gr_event_handler->on_double_click FOR gr_event.
*Display output
16
START-OF-SELECTION. mo_alv->display( ).
PERFORM fill_table. ENDMODULE. " STATUS_100 OUTPUT
CALL SCREEN 100. *&--------------------------------------------------------------*
*& Form FILL_TABLE
*&--------------------------------------------------------------*
*&--------------------------------------------------------------* FORM fill_table .
*& Module STATUS_100 OUTPUT SELECT matnr ersda ernam laeda mtart FROM mara INTO TABLE it_
*&--------------------------------------------------------------* mara WHERE matnr IN s_matnr.
MODULE status_100 OUTPUT. ENDFORM. " FILL_TABLE
* Create container object
Listing 16.4 Report to Display Material and Filter Functionality
CREATE OBJECT custom_container
EXPORTING
In Listing 16.4, we’re selecting certain field data from table MARA and displaying the out-
container_name = 'CONTAINER'.
put. We’re using the ALV object model to generate the ALV output.
*Create splitter object
CREATE OBJECT splitter We’ve defined a screen 100 for our program in which we’ve created a custom control.
EXPORTING Because we want to display the filtered records on the same screen, we’re using the CL_
parent = custom_container GUI_SPLITTER_CONTAINER class to split the container into two rows.
rows = 2
We show the complete selected data in the first row and display the filtered data in the
columns = 1.
second row. Figure 16.1 shows the initial display of the report.
*Split the container
CALL METHOD splitter->get_container
EXPORTING

584 585
16 Dynamic Programming 16.1 Field Symbols

When the user double-clicks, the ON_DOUBLE_CLICK method of the LCL_EVENT_HANDLER


local class is called. The code in this method is where our interest lies. If you look at the
code in this method, you’ll notice that we used the IF... ELSEIF... ENDIF block to check
the field name manually and accordingly filter the internal table data.
Because there’s no way to know statically which column the user will double-click, we
had to construct the IF…ELSEIF block to include all the fields of the internal table. Luck-
ily, we only had five fields in the internal table, so it wasn’t that difficult.
However, what if the internal table has 30 fields or 50 fields? What if some new fields
are added to the internal table as part of future enhancement? We have no other option
but to update this logic to include the additional fields. Not only does listing all the
fields statically in an IF…ELSEIF block make the code cumbersome, but hard-coding also
Figure 16.1 Initial ALV Display isn’t a good programming practice and should be avoided as much as possible.
There must be a better way to handle this, right? Of course, this is where field symbols
The user can double-click any cell to show the filtered records in a new container below
come to the rescue. Using field symbols, we can modify the code in the ON_DOUBLE_CLICK
the main display. For example, if the user double-clicks material type HALB in Figure
method of the LCL_EVENT_HANDLER local class, as shown in Listing 16.5. Nothing much has
16.1, the output would look like Figure 16.2.
changed in Listing 16.5, except how we’re filtering the records.
To display the filtered data in a new container per the user’s selection, we need to do a
METHOD on_double_click.
couple of things:
FIELD-SYMBOLS: <field> TYPE any.
1. Identify the user action (double-click). DATA : lo_sel TYPE REF TO cl_salv_selections, 16
2. Identify the column and value of the cell to filter the records. ls_cell TYPE salv_s_cell,
container_2 TYPE REF TO cl_gui_container,
The ALV object model raises the ON_DOUBLE_CLICK event when the user double-clicks the
lt_mara TYPE STANDARD TABLE OF ty_mara,
cell. In the program, we’re setting the event handler and have defined the ON_DOUBLE_
lw_mara TYPE ty_mara.
CLICK event handler method in the LCL_EVENT_HANDLER local class. In this method, we’re
filtering the records based on the value and displaying the filtered records, as shown in
lo_sel = mo_alv->get_selections( ).
Figure 16.2.
ls_cell = lo_sel->get_current_cell( ).

LOOP AT it_mara INTO lw_mara.


ASSIGN COMPONENT ls_cell-columnname OF STRUCTURE lw_mara TO <field>.
IF <field> IS ASSIGNED.
IF <field> EQ ls_cell-value.
APPEND lw_mara TO lt_mara.
ENDIF.
ENDIF.
ENDLOOP.
CALL METHOD splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = container_2.

Figure 16.2 Filtered Output in the New Container

586 587
16 Dynamic Programming 16.1 Field Symbols

TRY. For example, if you want to work with the individual components of a structure as
IF so_alv IS BOUND. shown in Listing 16.6, then the field symbol should be fully typed. Without typing the
so_alv->set_data( CHANGING t_table = lt_mara ). field symbol, there’s no way for the compiler to know what fields it contains when the
ELSE. code is compiled.
CALL METHOD cl_salv_table=>factory
DATA st_mara TYPE mara.
EXPORTING
FIELD-SYMBOLS: <fs_mara> TYPE mara,
list_display = if_salv_c_bool_sap=>false
<fs_matnr> TYPE matnr.
r_container = container_2
ASSIGN st_mara TO <fs_mara>.
IMPORTING
<fs_mara>-matnr = '100'.
r_salv_table = so_alv
ASSIGN st_mara-matnr TO <fs_matnr>.
CHANGING
t_table = lt_mara. Listing 16.6 Working with Structure Components
ENDIF.
CATCH cx_salv_msg . If you plan to use the field symbol to point to any field or structure dynamically, you
ENDTRY. can define the field symbol as a generic type using the TYPE ANY addition, as shown in
so_alv->display( ). Listing 16.7. However, with generic types, the components are known only at runtime,
ENDMETHOD. "on_double_click so you can’t access them statically.
Listing 16.5 Filter Functionality Using Field Symbols DATA st_mara TYPE mara.
FIELD-SYMBOLS: <fs_any> TYPE ANY.
In Listing 16.5, we’ve defined a <FIELD> field symbol as a generic type (we’ll discuss typ- ASSIGN st_mara TO <fs_any>.
ing field symbols in a moment). Within the loop, we’re dynamically assigning the com- 16
* <fs_any>-matnr = '100'. "This will result in syntax error
ponent of the table to the field symbol. Based on which column the user double-clicks, ASSIGN st_mara-matnr TO <fs_any>.
the LS_CELL-COLUMNNAME field will have that field name. The ASSIGN COMPONENT OF state-
Listing 16.7 Generic Type
ment will assign that field to the <FIELD> field symbol.
From here, all we need to do is check the cell value and filter the records. As you can see, You can also assign an internal table to the field symbol. To assign an internal table, the
now our filtering logic is dynamic. The code will filter the records irrespective of which field symbol should be defined as a table. You can type the field symbol fully as shown:
column the user double-clicks. This code will be equally effective when new fields are
FIELD-SYMBOLS <fs_mara> TYPE STANDARD TABLE OF mara.
added to the structure as part of future enhancement because we’re no longer hard-
coding anything.
You can define it as any kind of internal table of any type, just like a data object. You can
Now that you understand how field symbols can be used to make programs dynamic, also perform all the actions and use all the statements that are applicable to an internal
let’s go into further detail about how to define field symbols. table. For example, the syntax checker won’t complain if you use a LOOP statement with
a field symbol.

16.1.2 Defining Field Symbols If you plan to assign any internal table dynamically (for which the line type is known
only at runtime), you can define the field symbol as a generic table using the ANY TABLE
Field symbols are declared using the FIELD-SYMBOLS statement. The name of the field syntax, as shown:
symbol should be enclosed between angled brackets (< and >). You can type the field
symbol just like any other data object using the TYPE reference or LIKE reference. FIELD-SYMBOLS <fs_table> TYPE ANY TABLE.

You can also define a generic field symbol by typing it as ANY. When you define a fully
typed field symbol, only a data object of the same type can be assigned to the field sym- 16.1.3 Assigning a Data Object
bol. This is useful if you plan to access the components of a structure statically. The ASSIGN statement is used to assign the data object to a field symbol, as shown:

ASSIGN dobj TO <fs>.

588 589
16 Dynamic Programming 16.1 Field Symbols

The assignment operation can be performed both statically and dynamically. ASSIGN (class_name)=>(attribute_name) TO <fs>.
ASSIGN (class_name)=>attribute TO <fs>.
If we know the data object name to assign to the field symbol, we can assign the data
object statically, as shown in Listing 16.8. Listing 16.10 Accessing Class Attributes Dynamically

DATA st_mara TYPE mara.


The first line in Listing 16.10 addresses both the class name and the attribute name
FIELD-SYMBOLS: <fs_mara> TYPE mara.
dynamically, whereas the second line addresses the class name dynamically and the
ASSIGN st_mara TO <fs_mara>.
attribute name statically.
Listing 16.8 Static Assignment of a Field Symbol
You can also assign the components of a structure dynamically with the following syn-
tax:
Sometimes, we may know the data object that we want to assign dynamically only at
runtime. For example, say that you’re maintaining some change history in a table in ASSIGN comp OF STRUCTURE struc TO <fs>.
which you’re storing the field name with its old and new values. In your program, you
want to process only those fields for which a record is available in the change history With this statement, the comp component of the struc structure is assigned to the <fs>
table. field symbol. If the comp data object is set as TYPE c or TYPE string, then the content of the
comp field is interpreted to be the component name. For example, in Listing 16.11, the
You can assign the data object dynamically, as shown:
matnr field of the st_mara structure will be assigned to the field symbol.
ASSIGN (name) TO <fs>.
DATA : st_mara TYPE mara,
Here, the name variable contains the name of the data object. The variable should be l_field TYPE string VALUE 'MATNR'.
FIELD-SYMBOLS: <fs_any> TYPE any.
enclosed within parentheses.
ASSIGN l_field OF STRUCTURE st_mara TO <fs_any>. 16
Listing 16.9 shows an example of dynamic assignment. Here, the data object name
stored in the FIELD_NAME variable will be assigned to the field symbol. If the assignment Listing 16.11 Assigning a Structure Field
is successful (i.e., the data object with that field name exists in the program), the SY-
SUBRC system field will be set to 0. However, if the comp data object is of a different type and has a number, then the system
will interpret it as a field position and assign that field to the field symbol.
When using dynamic assignments, it’s important to check if the field symbol is
assigned before accessing the field symbol. Trying to access an unassigned field symbol For example, in Listing 16.12, the third field, mtart, of the st_mara structure will be
will result in a runtime error. assigned to the field symbol because the l_field data object contains the value 3.

DATA field_name TYPE string. TYPES: BEGIN OF ty_mara,


FIELD-SYMBOLS <fs_field> TYPE ANY. matnr TYPE matnr,
SELECT SINGLE ... FROM ... INTO field_name WHERE .... ersda TYPE ersda,
ASSIGN (field_name) TO <fs_field>. mtart TYPE mtart,
END OF ty_mara.
Listing 16.9 Dynamic Field Assignment DATA : st_mara TYPE ty_mara,
l_field TYPE n VALUE 3.
You can use dynamic assignment for the attributes of a class as shown: FIELD-SYMBOLS: <fs_any> TYPE any.
ASSIGN l_field OF STRUCTURE st_mara TO <fs_any>.
ASSIGN oref->(attribute_name) TO <fs>.
Listing 16.12 Dynamic Assignment Based on Field Position
In this assignment, the name of the attribute is derived dynamically. If you’re accessing
a static attribute, you can even derive the class name dynamically, as shown in Listing You can use the field symbol as a work area when working with internal tables. The
16.10. internal table record is assigned to the field symbol using the ASSIGNING addition with
the LOOP or READ statement, as shown in Listing 16.13.

590 591
16 Dynamic Programming 16.1 Field Symbols

READ TABLE itab ASSIGNING <fs>... However, in most situations, you won’t need to access the field symbol immediately
LOOP AT itab ASSIGNING <fs>.. after the assignment but may need to access it later in the code. In such situations,
ENDLOOP. checking the SY-SUBRC system field isn’t useful because SY-SUBRC is updated by many
Listing 16.13 Using the ASSIGNING Addition statements, and it always contains the result of the last statement that updated it.
To be sure that the field symbol is assigned before accessing it, use the IS ASSIGNED
When an internal table record is assigned to a field symbol using the LOOP or READ state- statement with the following syntax:
ment, the field symbol will directly point to the assigned row of the table. For example,
IF <fs> IS ASSIGNED.
in Listing 16.14, we’re assigning the first row of the internal table IT_MARA to the <FS_
ENDIF.
MARA> field symbol.
After this assignment, the field symbol will point to the first row of the internal table, We recommend that you always check if the field symbol is assigned before accessing
and you can change any field in the row directly using the field symbol. it. Trying to access a field symbol that isn’t assigned will result in an untreatable excep-
tion.
In this example, the <FS_MARA>-MTART = 'ROH' statement will change the value of the
MTART field in the first row of the internal table. Unlike a work area, when using a field
symbol, you don’t need to use the MODIFY statement to copy the contents of the work 16.1.5 Unassigning a Field Symbol
area back to the internal table.
If you want to remove the assignment of the field symbol to ensure that no data object
TYPES: BEGIN OF ty_mara, is assigned to it, use the UNASSIGN statement as follows:
matnr TYPE matnr,
UNASSIGN <fs>.
ersda TYPE ersda,
mtart TYPE mtart, 16
After the field symbol is unassigned, it will be initialized, so it won’t point to any data
END OF ty_mara.
object. You shouldn’t access the field symbol after it’s unassigned unless another data
DATA : it_mara TYPE TABLE OF ty_mara.
object is assigned to the field symbol.
FIELD-SYMBOLS: <fs_mara> LIKE LINE OF it_mara.
PARAMETERS p_matnr TYPE matnr. Using the CLEAR statement won’t initialize the field symbol; it will simply clear the con-
SELECT matnr ersda mtart FROM mara INTO TABLE it_mara WHERE matnr EQ p_matnr. tents of the data object assigned to the field symbol.
READ TABLE it_mara ASSIGNING <fs_mara> INDEX 1.
IF <fs_mara> IS ASSIGNED.
<fs_mara>-mtart = 'ROH'.
16.1.6 Casting
ENDIF. When a data object is assigned to a field symbol, the field symbol should be of a type
compatible with the data object. However, you can perform a cast on any data type
Listing 16.14 Assigning an Internal Table Record to a Field Symbol
when the data object is assigned to the field symbol.
Casting allows you to treat a particular data type as another data type. This means that
16.1.4 Checking If a Field Symbol Is Assigned any area of memory can be viewed as having assumed a given type. For example, you
When a data object is assigned to a field symbol, the SY-SUBRC system field is set to 0. If can interpret the value of a character field as a date field when the data object is
you want to check immediately after the assignment, you can check the SY-SUBRC field, assigned to the field symbol by performing a cast.
as shown in Listing 16.15. CASTING is used to perform a cast, as shown:
ASSIGN dobj TO <fs>. ASSIGN dobj TO <fs> CASTING.
IF sy-subrc IS INITIAL.
<fs> = 123. When you use CASTING, a data object of a different type can be assigned to the field sym-
ENDIF. bol. Casting allows you to assign a data object to the field symbol that isn’t compatible
Listing 16.15 Checking the SY-SUBRC Field with the field symbol.

592 593
16 Dynamic Programming 16.2 Data References

Listing 16.16 shows sample code in which a field of TYPE C is assigned to the field symbol, DATA dref TYPE REF TO dtype
which is of TYPE D. After the data object is assigned, the contents of the data object will DATA dref LIKE REF TP dobj
be interpreted as TYPE D. DATA dref TYPE REF TO DATA

DATA text(8) TYPE c VALUE '20111201'. Listing 16.17 Defining a Data Reference Variable
FIELD-SYMBOLS <fs> TYPE sy-datum.
ASSIGN text TO <fs> CASTING. In Listing 16.17, the first statement uses the data type reference, and the second state-
WRITE <fs>. ment uses the data object reference. The data reference variables are fully typed and
can point to data objects of this type. The third statement is defined as a generic type,
Listing 16.16 Casting
DATA, and can point to any data object.

Casting can be performed implicitly or explicitly. If the field symbol is fully typed or is Similar to object references, a data reference can be a static type or a dynamic type. A
typed generically using one of the built-in ABAP types (c, n, p, or x), then CASTING can be static type of data reference should be a fully typed or fully generic type, as shown in
used with the ASSIGN statement, which performs an implicit casting to cast the assigned Listing 16.17. A dynamic type should be either equal to the static type or more special
memory to the type of the field symbol. than its static type (not generic).

If the field symbol is typed generically, then you can perform an explicit casting by When the data reference variable is defined, it’s initial; in other words, the data refer-
specifying the data type in the ASSIGN statement as follows: ence variable doesn’t point to any data object. A reference to a data object should be
supplied to the data reference variable.
ASSIGN dobj TO <fs> CASTING [TYPE data_type|LIKE dobj].
After the data reference is supplied, it holds the memory location of the referenced
After the CASTING addition, you can specify the data type or a data object. The casting data object and not its content. To access the contents of the referenced data object, the
will be performed per the specified type. Your specified type should be compatible with reference variable should be dereferenced using the ->* dereference selector. 16
the generic type of the field symbol, and you shouldn’t perform an explicit typing for a Figure 16.3 shows the data reference variable in debug mode for better visualization. As
fully typed field symbol. Casting allows you to interpret data differently per type con- shown, when the data reference variable DREF is accessed, it holds the reference to the
version. V_MATNR data object. To access the contents of V_MATNR, we dereference the reference
In this section, we discussed the use of field symbols in dynamic programming. In the variable using the ->* selector.
next section, we’ll look at using data references to point to a data object in memory.

16.2 Data References


Similar to object references, a data reference points to a data object in memory. Data
references can be used as alternate access references to existing data objects, similar to
field symbols. However, with data references, it’s possible to define anonymous data
objects. The data reference is stored in the data reference variable defined using the
TYPE REF TO addition of the DATA statement.
Now, we’ll explain how to define and work with data references. We’ll also discuss how
to define data objects dynamically using data references and assignments between
Figure 16.3 Data Reference Variable in Debug Mode
data references.

16.2.2 Getting Data References


16.2.1 Defining Reference Variables
The GET REFERENCE OF statement is used to obtain a reference to an existing data object.
The syntax to define a data reference variable is shown in Listing 16.17. You can obtain a reference using the GET REFERENCE OF statement from an existing data

594 595
16 Dynamic Programming 16.2 Data References

object, an assigned field symbol, or a dereferenced data reference variable, as shown in To dereference the generic type, we assign it to a field symbol as shown in Listing 16.19.
Listing 16.18. If the reference variable has an empty reference, then the field symbol won’t be
assigned. You can check if the field symbol is assigned before accessing it to avoid an
DATA v_matnr type matnr VALUE '100'.
untreatable exception.
DATA dref TYPE REF TO matnr.
DATA dref1 TYPE REF TO matnr.
FIELD-SYMBOLS <fs> TYPE matnr. 16.2.3 Anonymous Data Objects
ASSIGN v_matnr TO <fs>.
*Getting reference from data object Anonymous data objects are used when the data type is unknown statically. When we
GET REFERENCE OF v_matnr into dref. define data objects using the DATA statement, all the data objects are created by the run-
*Getting reference from dereferenced reference variable time environment when the program starts. All these data objects can be accessed in
GET REFERENCE OF dref->* INTO dref1. the program statically using the name of the data object. These are called named data
*Getting reference from field symbol objects.
GET REFERENCE OF <fs> INTO dref1. Anonymous data objects are created on demand in the program as required and can be
WRITE dref->*. assigned a suitable type per requirements. You use the CREATE DATA statement to instan-
Listing 16.18 Getting Data Object References tiate an anonymous data object with the following syntax:

CREATE DATA dref TYPE|LIKE dtype.


After the data object reference is obtained, the reference variable should be derefer-
enced to access the contents of the referenced data object. For example, in Listing 16.18, The CREATE DATA statement creates an anonymous data object and assigns the reference
we’re dereferencing the reference variable using the ->* dereference selector to access of the data object to the reference variable. Anonymous data objects can’t be accessed
the contents of the referenced data object with the WRITE statement. directly by their names. The data object needs to be dereferenced to access its contents. 16
After the reference variable is dereferenced, the reference variable can be used to per- Listing 16.20 shows an example using an anonymous data object.
form any actions or use any statements that are possible with the referenced data
FIELD-SYMBOLS <fs> TYPE DATA.
object. You can dereference the data reference variable directly only if it’s fully typed. If
DATA dref TYPE REF TO DATA.
the reference variable is generically typed, then it should be assigned to a field symbol
CREATE DATA dref TYPE i.
to access the contents of the referenced data object.
ASSIGN dref->* TO <fs>.
Listing 16.19 shows an example using generic reference variables. <fs> = 5.

DATA v_matnr type matnr VALUE '100'. Listing 16.20 Anonymous Data Object
DATA dref TYPE REF TO data.
FIELD-SYMBOLS <fs> TYPE any. The data type can be specified dynamically using a field in parentheses, for example,
CREATE DATA dref TYPE (name). Here, name is a data object that contains the data type.
GET REFERENCE OF v_matnr into dref.
With the release of SAP NetWeaver 7.4, a new instantiation operation, NEW, has been
ASSIGN dref->* TO <fs>.
introduced to instantiate both data references and object references in lieu of the CRE-
* WRITE dref->*. " Results in syntax error
ATE statement. The NEW statement, as shown in Listing 16.21, takes its cue from other pro-
WRITE <fs>.
gramming languages, such as Java.
Listing 16.19 Dereferencing Generic Type
FIELD-SYMBOLS <fs> TYPE DATA.
DATA dref TYPE REF TO data.
In Listing 16.19, the DREF reference variable is declared as a generic type. The reference of
dref = NEW i( 5 ).
data object V_MATNR is obtained using the GET REFERENCE statement. However, because
ASSIGN dref->* TO <fs>.
the DREF reference variable is a generic type, we can’t access the contents of V_MATNR by
directly dereferencing the reference variable as we did in the WRITE statement in Listing Listing 16.21 Using the NEW Instantiation Operator
16.18; in fact, dereferencing a generic type results in a syntax error.

596 597
16 Dynamic Programming 16.3 Runtime Type Services

Similar to accessing reference objects, you can access the components of a data refer- CREATE DATA dref.
ence using the -> selector, for example, DREF->COMP. If no TYPE specification is provided dref1 = dref. " Upcast
with the CREATE DATA statement, the anonymous data object is created as a static type of
Listing 16.23 Upcast
the data reference variable.
Listing 16.22 shows example code to access components of the anonymous data object. If the static type of the source reference variable is more general than the static type of
the target reference variable, it leads to a downcast. The assignment can only be vali-
TYPES: BEGIN OF ty_mara,
dated at runtime because the type of the source reference variable will be known only
matnr TYPE matnr,
mtart TYPE mtart,
at runtime.
END OF ty_mara. For this assignment, the syntax checker can’t validate statically and will throw a syntax
DATA dref TYPE REF TO ty_mara. error if the = assignment operator or the MOVE statement is used for the assignment.
CREATE DATA dref.
For such assignments, we have to use the "?=" casting operator or the MOVE ?TO state-
dref->matnr = '100'.
ment. An upcast is performed if the source reference variable is of a generic type and
Listing 16.22 Accessing Components of Anonymous Data Objects the target reference variable is fully typed.
Listing 16.24 shows an example of a downcast.
You can use the IS BOUND statement to check if the data reference variable contains a
valid reference and is dereferenceable, for example, IF dref IS BOUND. TYPES: BEGIN OF ty_mara,
matnr TYPE matnr,
mtart TYPE mtart,
16.2.4 Assignment between Reference Variables END OF ty_mara.
DATA : s_mara TYPE ty_mara, 16
As with object references, you can perform assignments between data references.
When a data reference is assigned, the target reference variable will point to the same dref TYPE REF TO ty_mara, " Fully Typed
dref1 TYPE REF TO DATA. " Generic type
data object as the source reference variable.
CREATE DATA dref.
A reference variable can be assigned only to another reference variable. In other words, GET REFERENCE OF s_mara INTO dref1.
you can’t assign a reference variable to a data object or a reference object, and vice TRY,
versa. dref ?= dref1. " Down Cast
Like object references, data references also support upcasting and downcasting. When CATCH cx_sy_move_cast_error.
assigning a reference variable, if the static type of the source reference variable is simi- ENDTRY.
lar to or more special than the static type of the target reference variable, then an Listing 16.24 Downcast
upcast is performed. You can use the = assignment operator or the MOVE statement to
perform the assignment.
An upcast is performed when the target reference variable is a generic type and the 16.3 Runtime Type Services
source reference variable is fully typed, as shown in Listing 16.23.
ABAP Runtime Type Services (RTTS) is an object-oriented framework that consists of the
TYPES: BEGIN OF ty_mara, following elements:
matnr TYPE matnr,
쐍 Runtime Type Information (RTTI)
mtart TYPE mtart,
Using RTTI, you can determine the type information about data objects or instances
END OF ty_mara.
of classes at runtime during program execution.
DATA : dref TYPE REF TO ty_mara, " Fully Typed
dref1 TYPE REF TO DATA. " Generic type 쐍 Runtime Type Creation (RTTC)
RTTC allows you to define new data types during the program execution.

598 599
16 Dynamic Programming 16.3 Runtime Type Services

The RTTS framework implements a hierarchy of classes, as shown in Figure 16.4, via START-OF-SELECTION.
which you can determine the type information of data objects and define new data r_typedescr = cl_abap_typedescr=>describe_by_data( v_data ).
types at runtime. The instances of these type classes are known as type objects.
WRITE: / 'Kind:', r_typedescr->type_kind.
A type class exists for each ABAP type, such as elementary types, reference types, com-
WRITE: / 'Length:', r_typedescr->length.
plex types (structures and tables), and so on.
WRITE: / 'Decimals:', r_typedescr->decimals.

CL_ABAP_TYPEDESCR Listing 16.25 Querying Type Information

CL_ABAP_DATADESCR In Listing 16.25, we’ve defined an R_TYPEDESCR type object as an instance of type class CL_
ABAP_TYPEDESCR. The type object is instantiated when the DESCRIBE_BY_DATA static
CL_ABAP_ELEMDESCR
method of the type class is called. To this static method, we’re passing the data object
CL_ABAP_REFDESCR
for which the type information is required.
CL_ABAP_COMPLEXDESCR
After the type object is instantiated with the type information, we can access its attri-
CL_ABAP_STRUCTDESCR butes to determine the type information of the data object. The type object also con-
CL_ABAP_TABLEDESCR tains constants that can be used in an IF or CASE structure to compare the TYPE_KIND
attribute.
CL_ABAP_OBJECTDESCR

CL_ABAP_CLASSDESCR
16.3.2 Runtime Type Creation
CL_ABAP_INTFDESCR
As discussed in the previous section, type objects are created using RTTI methods of 16
Figure 16.4 Type Class Hierarchy RTTS; these type objects can be used to create new types using the RTTC methods of
RTTS. The RTTC methods allow you to create data types dynamically that can be used to
For each ABAP type, exactly one type object can exist in the program, and you can cre- define data objects dynamically.
ate new type objects for new types. The type objects contain attributes that describe the
For example, say you want to dynamically create a structure on the fly and use it in a
type. The class documentation provides information on each type class.
SELECT statement. You’ll only know the fields of the structure at runtime. In such a situ-
In the following subsections, we’ll discuss RTTI and RTTC in detail. ation, you use the RTTC methods to define a data type and use it to create the data object
dynamically. The GET factory method of the CL_ABAP_STRUCTDESCR, CL_ABAP_TABLEDESCR,
and CL_ABAP_REFDESCR classes allows you to create a type object.
16.3.1 Runtime Type Information
The required information to create the type object is passed to the factory method of
Often, you’ll need to determine the type information of an object dynamically. For
these classes. For example, the component details are passed to the factory method of
example, before using a generically typed parameter of a procedure or a generically
the CL_ABAP_STRUCTDESCR class to create the type object for structure. Similarly, the
typed anonymous data object in an arithmetic operation, you may want to check its
structure type object is passed to the factory method of the CL_ABAP_TABLEDESCR class to
type, length, and number of decimal places. In such cases, you can use type objects to
create the table type object. Listing 16.26 shows how the RTTC methods can be used to
identify the type information of a data object.
dynamically define data types and create data objects using these types.
Type objects are created using the methods of the type class. The attributes of the type
In Listing 16.26, we’ve defined two selection screen fields to take the table name and the
object contain the type information. Listing 16.25 shows example code to identify the
WHERE clause as input. The program logic is built to display data from any table given as
type information.
the input.
REPORT ZDEMO_EXAMPLES.
To achieve this, in the GET_TABLE subroutine, we’re dynamically identifying the type
TYPES: ty_type TYPE p DECIMALS 2.
information of the given structure to get its components. We’re building an internal
DATA: v_data TYPE ty_type,
table on the fly using these components and writing a dynamic SELECT statement to get
r_typedescr TYPE REF TO cl_abap_typedescr.

600 601
16 Dynamic Programming 16.3 Runtime Type Services

the data from the requested table. Finally, we’re displaying the output using ALV in the INTO CORRESPONDING FIELDS OF TABLE <table> WHERE (p_where).
DISPLAY_TABLE subroutine. CATCH cx_sy_sql_error.
ENDTRY.
PARAMETERS: p_table TYPE string,
ENDFORM.
p_where TYPE string.
*&------------------------------------------------------------*
*& Form DISPLAY_TABLE
DATA: r_typedescr TYPE REF TO cl_abap_typedescr,
*&------------------------------------------------------------*
r_structdescr TYPE REF TO cl_abap_structdescr,
* text
r_tabledescr TYPE REF TO cl_abap_tabledescr,
*-------------------------------------------------------------*
r_table TYPE REF TO data,
FORM display_table .
components TYPE cl_abap_structdescr=>component_table,
TRY.
component LIKE LINE OF components,
CALL METHOD cl_salv_table=>factory
ro_alv TYPE REF TO cl_salv_table.
IMPORTING
r_salv_table = ro_alv
FIELD-SYMBOLS : <table> TYPE ANY TABLE.
CHANGING
START-OF-SELECTION.
t_table = <table>.
PERFORM get_table.
CATCH cx_salv_msg.
PERFORM display_table.
ENDTRY.
*&------------------------------------------------------------*
ro_alv->display( ).
*& Form GET_TABLE
ENDFORM.
*&------------------------------------------------------------*
* text Listing 16.26 Dynamic Type Creation 16
*-------------------------------------------------------------*
FORM get_table . In the GET_TABLE subroutine of Listing 16.26, we’re first creating the R_TYPEDESCR type
r_typedescr = cl_abap_typedescr=>describe_by_name( p_table ). object based on the table name entered on the selection screen. We’re downcasting the
TRY. R_TYPEDESCR type object to R_STRUCTDESCR. The R_STRUCTDESCR type object is an instance
r_structdescr ?= r_typedescr. of the CL_ABAP_STRUCTDESCR class that contains the RTTC methods to create new type
CATCH cx_sy_move_cast_error. objects.
ENDTRY.
We’re calling the GET_COMPONENTS method to get the components of the structure. Using
components = r_structdescr->get_components( ).
this information, we call the GET factory method of the CL_ABAP_STRUCTDESCR class to cre-
TRY.
ate the structure type object. We pass this structure type object to the GET factory
r_structdescr = cl_abap_structdescr=>get( components ).
r_tabledescr = cl_abap_tabledescr=>get( r_structdescr ). method of the CL_ABAP_TABLEDESCR class to create the table type object.
CATCH cx_sy_struct_creation. After we have the table type object, we use the TYPE HANDLE addition with the CREATE
CATCH cx_sy_table_creation . statement to instantiate the data reference with the type object. This will create the R_
ENDTRY. TABLE data reference, the type definition of which is defined in the R_TABLEDESCR type
TRY. object.
CREATE DATA r_table TYPE HANDLE r_tabledescr.
Although the TYPE or LIKE addition allows you to specify a data type or data object,
ASSIGN r_table->* TO <table>.
respectively, the TYPE HANDLE addition with the CREATE DATA statement allows you to
CATCH cx_sy_create_data_error.
ENDTRY. specify a type object.
TRY. After the internal table is defined dynamically, we use it in the SELECT statement to
SELECT * query the given database table and subsequently display the output. As you can see,
FROM (p_table) we’re handling the errors at each step; error handling is vital to dynamic programming.

602 603
16 Dynamic Programming 16.4 Dynamic Token Specification

If the user completes the fields as shown in Figure 16.5, the code in Listing 16.26 will gen- Some of the statements in which operands can be specified dynamically include the
erate the output shown in Figure 16.6. We can enhance the code further to select only following:
specific fields of the table and create the structure with only specific fields. 쐍 SUBMIT (dobj)
With this statement, you supply the program name dynamically. The following code
example shows using the dynamic token with a SUBMIT statement:

DATA lv_progname TYPE progname.


SELECT SINGLE progname FROM zprogdir INTO lv_progname WHERE ...
Figure 16.5 Selection Screen for Data Browser SUBMIT (lv_progname).

쐍 WRITE (dobj) TO..


With this statement, you can pass formatting options dynamically. For example, in
the following code, we’re passing the formatting of the SY-DATUM system date field to
the DATE character field.
After the WRITE statement is executed, the contents of the DATE field will have the for-
matting of the SY-DATUM field:

DATA format_date TYPE c LENGTH 8 VALUE 'SY-DATUM'.


DATA date TYPE c LENGTH 10.
date = sy-datum.
WRITE (format_date) TO date.
16
쐍 CALL FUNCTION
The CALL FUNCTION statement only supports dynamic calls. We can either pass the
Figure 16.6 Data Browser Output
data object or use a literal for the function module name.
For example:
In this section, we looked at both RTTI and RTTC. In the next section, we’ll look at using
dynamic tokens. DATA form_name TYPE C LENGTH 30 VALUE 'ZDEMO_FM'.
CALL FUNCTION (form_name)
EXPORTING
16.4 Dynamic Token Specification .....
IMPORTING
With many ABAP statements, you can specify individual operands as tokens dynami- .....
cally by using a data object enclosed within parentheses. The content of the data object
쐍 CALL TRANSACTION
will then be used as the operand of the statement. For example, in PERFORM (dobj), dobj
Similar to CALL FUNCTION, the CALL TRANSACTION statement also supports only dynamic
(a token) usually is a character-type elementary data object.
calls. The name of the transaction should be supplied dynamically using a data
The statement will be evaluated at runtime, and if there’s a syntax error, it will result in object or statically using a literal.
a runtime error. For this reason, catching exceptions is very important while using For example:
dynamic tokens in a statement.
DATA tcode TYPE C LENGTH 30 VALUE 'MM03'.
The dynamic assignment of operands can cause security risks, especially if the oper-
CALL TRANSACTION (tcode).
ands are supplied externally. For this reason, the CL_ABAP_DYN_PRG class should be used
to check the operand thoroughly before using it in the statement. The class documen- 쐍 ASSIGN (dobj)
tation for CL_ABAP_DYN_PRG provides more information about different scenarios in This dynamically assigns the field to a field symbol.
which the methods of the class can be used. For example:

604 605
16 Dynamic Programming 16.5 Dynamic Procedure Calls

DATA field TYPE C LENGTH 30 VALUE 'V_MATNR'. In the preceding statement, we’re passing the parameters to the method dynamically
FIELD-SYMBOLS <fs> TYPE ANY. using the PARAMETER-TABLE addition. Here, an internal table of type ABAP_PARMBIND_TAB is
ASSIGN (field) TO <fs>. expected. The line type of ABAP_PARMBIND_TAB consists of three fields: NAME, KIND, and
쐍 READ, MODIFY, DELETE, SORT VALUE. The NAME field should contain the formal parameter name.
You can specify internal table fields dynamically with these statements. The KIND field should be filled with the parameter type (whether exporting, importing,
For example: returning, etc., from a caller’s point of view). The VALUE field should contain the refer-
ence of the actual parameter.
DATA field TYPE C LENGTH 30 VALUE 'MATNR'
SORT itab BY (field). We can use the constants of the cl_abap_objectdescr class to fill the KIND field. As with
PARAMETER-TABLE, nonclass-based exceptions can be handled using the EXCEPTION-TABLE
쐍 CLASSES
addition.
You can access class attributes dynamically. For an instance attribute, you can spec-
ify the attribute name dynamically, as follows: As with methods, the parameters for a function module can also be supplied dynami-
cally using PARAMETER-TABLE. The only difference is that PARAMETER-TABLE when used for
ASSIGN oref->(attribute_name) TO <fs> the function module is of type ABAP_FUNC_PARMBIND_TAB.
For a static attribute, you can even specify the class name dynamically, as follows: Listing 16.27 shows example code using a parameter table to pass parameters dynami-
ASSIGN (class_name)=>(attribute_name) TO <fs> cally.

Apart from operands, the WHERE clause for an Open SQL statement can also be con- DATA: fm_name TYPE STRING,
structed dynamically, as shown in Listing 16.26. With the WHERE clause, the complete filename TYPE STRING,
filetype TYPE C LENGTH 80,
statement can be constructed dynamically without any restrictions. The dynamic
text_tab LIKE STANDARD TABLE OF LINE, 16
WHERE clause is supported for internal tables as well.
fleng TYPE I,
In this section, we looked at dynamic tokens. In the next section, we’ll look at calling ptab TYPE abap_func_parmbind_tab,
procedures dynamically. ptab_line LIKE LINE OF ptab,
etab TYPE abap_func_excpbind_tab,
etab_line LIKE LINE OF etab.
16.5 Dynamic Procedure Calls
fm_name = 'GUI_DOWNLOAD'.
Procedures can be called dynamically using dynamic tokens. For example, if you can filename = 'C:\text.txt'.
determine the subroutine that needs to be called only at runtime, then you can pass filetype = 'ASC'.
the subroutine name using a dynamic token. When calling an external subroutine, the
program name can also be passed dynamically as follows: ptab_line-NAME = 'FILENAME'.
ptab_line-KIND = abap_func_exporting.
PERFORM (l_name) IN PROGRAM (l_program) IF FOUND.
GET REFERENCE OF filename INTO ptab_line-VALUE.
When calling a subroutine dynamically, the system will generate a runtime error if the INSERT ptab_line INTO TABLE ptab.
specified subroutine or program isn’t found. To avoid the runtime error, you should
ptab_line-NAME = 'FILETYPE'.
use the IF FOUND addition.
ptab_line-KIND = abap_func_exporting.
Methods can also be called dynamically by passing the class name and the method GET REFERENCE OF filetype INTO ptab_line-VALUE.
name with a dynamic token. In fact, the parameters of the method can also be supplied INSERT ptab_line INTO TABLE ptab.
dynamically using the PARAMETER-TABLE addition as follows:
ptab_line-NAME = 'DATA_TAB'.
CALL METHOD class_name=>method_name PARAMETER-TABLE para.
ptab_line-KIND = abap_func_tables.
GET REFERENCE OF text_tab INTO ptab_line-VALUE.

606 607
16 Dynamic Programming 16.6 Dynamic Program Generation

INSERT ptab_line INTO TABLE ptab. 쐍 Transient program


A transient program exists temporarily in the internal session memory and can be
ptab_line-NAME = 'FILELENGTH'. accessed only from the current internal session. The GENERATE SUBROUTINE POOL itab
ptab_line-KIND = abap_func_importing. NAME prog statement is used to generate a temporary subroutine pool program. Inter-
GET REFERENCE OF fleng INTO ptab_line-VALUE. nal table itab should be a character type that contains the source code of the pro-
INSERT ptab_line INTO TABLE ptab. gram. The prog variable contains the name of the generated program by which the
program can be accessed.
...
The generated subroutine pool program can contain local classes or subroutines,
etab_line-NAME = 'OTHERS'.
which can be accessed from outside of the program. If the source code of the pro-
etab_line-VALUE = 10. gram contains any syntax errors, the program isn’t generated.
INSERT etab_line INTO TABLE etab. Listing 16.28 shows sample code to generate a temporary subroutine pool program.
In this example, we’re appending internal table IT_SOURCE with the source code of
CALL FUNCTION fm_name the subroutine pool program and generating the program using the GENERATE SUB-
PARAMETER-TABLE ROUTINE POOL statement.
ptab
DATA: it_source TYPE TABLE OF string,
EXCEPTION-TABLE
program TYPE string ,
etab.
mesg TYPE string.
Listing 16.27 Parameter Table
APPEND 'PROGRAM.' TO it_source.
In Listing 16.27, we defined parameter table PTAB as type ABAP_FUNC_PARMBIND_TAB. We’re APPEND 'FORM subr.' TO it_source. 16
filing the parameter of function module GUI_DOWNLOAD dynamically in internal table APPEND 'WRITE / ''This is dynamic subroutine''.' TO it_source.
PTAB. APPEND 'ENDFORM.' TO it_source.

The function module is called dynamically, and the parameter table is passed using the
GENERATE SUBROUTINE POOL it_source NAME program MESSAGE mesg.
PARAMETER-TABLE addition. We’re also passing exceptions table ETAB, which is defined as
IF sy-subrc = 0.
type ABAP_FUNC_EXCPBIND_TAB.
PERFORM subr IN PROGRAM (PROGRAM).
This section looked at the process of calling procedures dynamically. In the next sec- ENDIF.
tion, we look at a more advanced feature of ABAP: dynamic program generation.
Listing 16.28 Dynamic Subroutine Pool

쐍 Persistent program
16.6 Dynamic Program Generation Persistent programs exist permanently in the repository and can be accessed just
like other programs that are created manually. The INSERT REPORT prog FROM itab
In addition to all the dynamic programming concepts discussed in this chapter, which
statement generates a persistent program. Here, internal table itab contains the
can be used within an ABAP program, we can also generate ABAP programs dynami-
source code of the program, and the prog variable contains the program name.
cally. Generating a program dynamically should be used as a last resort if other
You should be careful when using this statement because if a program with the same
dynamic programming techniques don’t satisfy your requirements.
name already exists, it will be overwritten without any warning. To ensure you don’t
Dynamic program generation is for expert programmers and should be used with cau- overwrite existing programs, we recommend checking database table TRDIR to see if
tion; it can cause serious problems if you don’t know what you’re doing. The downsides a program with the same name already exists.
of programs generated dynamically are that they can’t be tested like regular programs
Listing 16.29 shows example code to generate a program dynamically. In this exam-
and can involve serious security risks.
ple, we’re filling internal table IT_SOURCE with the source code line by line and then
Two types of programs can be generated dynamically: using the INSERT REPORT keyword to generate the program.

608 609
16 Dynamic Programming

REPORT ZDYN_PROG.
Contents
DATA: it_source TYPE TABLE OF rssource-line.

APPEND 'REPORT ZDYN_EXAMPLE.' TO it_source. Acknowledgments ................................................................................................................................ 21


Preface ....................................................................................................................................................... 23
APPEND 'WRITE / ''This program is generated dynamically''.'
TO it_source.

1 Introduction to ERP and SAP 27


INSERT REPORT 'ZDYN_EXAMPLE' FROM it_source.

Listing 16.29 Dynamic Program Generation 1.1 Historical Overview .............................................................................................................. 27

When generating programs dynamically, it’s a good idea to create a program statically 1.2 Understanding an ERP System ........................................................................................ 30
and use that program as a template to generate new programs. You can use the READ 1.2.1 What Is ERP? ............................................................................................................. 30
REPORT INTO itab statement to read the source code of an existing program, which can 1.2.2 ERP versus Non-ERP Systems .............................................................................. 30
then be used as a template to generate a new program. 1.2.3 Advantages of an ERP System ............................................................................ 32
1.3 Introduction to SAP .............................................................................................................. 33
1.3.1 Modules in SAP ........................................................................................................ 33
16.7 Summary 1.3.2 Types of Users .......................................................................................................... 34
1.3.3 Role of an ABAP Consultant ................................................................................ 35
In this chapter, we explored the various concepts that can be used to make ABAP pro-
1.3.4 Changing and Adapting the Data Structure ................................................. 36
grams dynamic. Dynamic programming may seem intimidating, especially for a begin-
ner, but it opens up many possibilities, such as developing applications that can handle 1.4 ABAP Overview ....................................................................................................................... 38
dynamic requirements and work across multiple business functions. 1.4.1 Types of Applications ............................................................................................ 39
1.4.2 RICEF Overview ........................................................................................................ 39
This chapter looked at how field symbols and data references can be used to dynami-
cally point to existing memory of data objects, and you saw how anonymous data 1.5 System Requirements .......................................................................................................... 42
objects can be created using data references. 1.6 Summary ................................................................................................................................... 43
We also discussed the RTTS framework and how it helps to find the type information of
program data objects dynamically and to create new data types in the program during
runtime. We concluded the chapter with a discussion of calling procedures dynami- 2 Architecture of an SAP System 45
cally and how to generate programs dynamically. We hope this knowledge will help
you approach program development from a different perspective.
2.1 Introduction to the Three-Tier Architecture .............................................................. 45
In the next chapter, we’ll discuss the process of debugging, which plays an important
2.2 SAP Implementation Overview ....................................................................................... 47
role in identifying problems within a program, especially if dynamic elements are
2.2.1 SAP GUI: Presentation Layer ............................................................................... 47
involved.
2.2.2 Application Servers and Message Servers: Application Layer ................. 49
2.2.3 Database Server/Relational Database Management System:
Database Layer ........................................................................................................ 55
2.2.4 SAP HANA Introduction ........................................................................................ 57
2.3 Data Structures ....................................................................................................................... 60
2.3.1 Client Overview ....................................................................................................... 61
2.3.2 Client-Specific Data and Cross-Client Data ................................................... 61

610 7
Contents Contents

2.3.3 Repository ................................................................................................................. 64 4.4.1 Data Types ................................................................................................................ 104


2.3.4 Packages .................................................................................................................... 64 4.4.2 Data Elements ......................................................................................................... 117
2.3.5 Transport Organizer .............................................................................................. 65 4.4.3 Domains .................................................................................................................... 120
2.4 Summary ................................................................................................................................... 70 4.4.4 Data Objects ............................................................................................................. 123
4.5 ABAP Statements ................................................................................................................... 126

4.6 Creating Your First ABAP Program ................................................................................. 128


3 Introduction to the ABAP Environment 71 4.7 Summary ................................................................................................................................... 133

3.1 SAP Environment ................................................................................................................... 71


3.1.1 ABAP Programming Environment .................................................................... 72
5 Structures and Internal Tables 135
3.1.2 Logging On to the SAP Environment ................................................................ 72
3.1.3 Elements of the SAP Screen ................................................................................ 73
5.1 Defining Structures ............................................................................................................... 136
3.1.4 Transaction Codes .................................................................................................. 75
5.1.1 When to Define Structures ................................................................................. 138
3.1.5 Opening and Navigating with Transactions ................................................. 76
5.1.2 Local Structures ....................................................................................................... 138
3.2 ABAP Workbench Overview ............................................................................................. 80
5.1.3 Global Structures .................................................................................................... 141
3.2.1 ABAP Editor ............................................................................................................... 80 5.1.4 Working with Structures ...................................................................................... 144
3.2.2 Function Builder ...................................................................................................... 82 5.1.5 Use Cases .................................................................................................................. 145
3.2.3 Class Builder ............................................................................................................. 83
5.2 Internal Tables ........................................................................................................................ 146
3.2.4 Screen Painter .......................................................................................................... 83
5.2.1 Defining Internal Tables ....................................................................................... 146
3.2.5 Menu Painter ........................................................................................................... 85
5.2.2 Types of Internal Tables ....................................................................................... 149
3.2.6 ABAP Data Dictionary ............................................................................................ 86
5.2.3 Table Keys ................................................................................................................. 152
3.2.7 Object Navigator .................................................................................................... 88
5.2.4 Working with Internal Tables ............................................................................. 156
3.3 Eclipse IDE Overview ............................................................................................................ 89
5.2.5 Control Break Statements ................................................................................... 162
3.4 SAP Business Technology Platform, ABAP Environment ..................................... 94 5.3 Introduction to Open SQL Statements ......................................................................... 167
3.5 Summary ................................................................................................................................... 95 5.3.1 Database Overview ................................................................................................ 168
5.3.2 Selecting Data from Database Tables ............................................................. 176
5.3.3 Selecting Data from Multiple Tables ............................................................... 178

4 ABAP Programming Concepts 97 5.4 Processing Data from Databases via Internal Tables and Structures ............ 181

5.5 Introduction to the Debugger .......................................................................................... 183


4.1 General Program Structure ............................................................................................... 98
5.6 Practice ....................................................................................................................................... 186
4.1.1 Global Declarations ............................................................................................... 98
4.1.2 Procedural Area ....................................................................................................... 99
5.7 Summary ................................................................................................................................... 186

4.2 ABAP Syntax ............................................................................................................................ 99


4.2.1 Basic Syntax Rules .................................................................................................. 100
4.2.2 Chained Statements .............................................................................................. 101 6 User Interaction 187
4.2.3 Comment Lines ....................................................................................................... 102
4.3 ABAP Keywords ...................................................................................................................... 102
6.1 Selection Screen Overview ................................................................................................ 187
6.1.1 PARAMETERS ............................................................................................................ 189
4.4 Introduction to the TYPE Concept .................................................................................. 103
6.1.2 SELECT-OPTIONS ..................................................................................................... 195

8 9
Contents Contents

6.1.3 SELECTION-SCREEN ................................................................................................ 202 8 Object-Oriented ABAP 267


6.1.4 Selection Texts ........................................................................................................ 203
6.2 Messages ................................................................................................................................... 204 8.1 Procedural Programming versus Object-Oriented Programming ................... 267
6.2.1 Types of Messages ................................................................................................. 205
8.2 Principles of Object-Oriented Programming ............................................................. 271
6.2.2 Messages Using Text Symbols ........................................................................... 206
8.2.1 Attributes .................................................................................................................. 273
6.2.3 Messages Using Message Classes .................................................................... 207
8.2.2 Static and Instance Components ...................................................................... 274
6.2.4 Dynamic Messages ................................................................................................ 209
8.2.3 Methods .................................................................................................................... 274
6.2.5 Translation ................................................................................................................ 210
8.2.4 Objects ....................................................................................................................... 277
6.3 Summary ................................................................................................................................... 211 8.2.5 Constructor ............................................................................................................... 278
8.3 Encapsulation .......................................................................................................................... 279
8.3.1 Component Visibility ............................................................................................. 280
7 Modularization Techniques 213 8.3.2 Friends ........................................................................................................................ 282
8.3.3 Implementation Hiding ........................................................................................ 283
7.1 Modularization Overview .................................................................................................. 213 8.4 Inheritance ............................................................................................................................... 286
7.2 Program Structure ................................................................................................................. 217 8.4.1 Defining Inheritance ............................................................................................. 287
7.2.1 Processing Blocks .................................................................................................... 217 8.4.2 Abstract Classes and Methods ........................................................................... 290
7.2.2 Event Blocks .............................................................................................................. 229 8.4.3 Final Classes and Methods .................................................................................. 293
7.2.3 Dialog Modules ....................................................................................................... 230 8.4.4 Composition ............................................................................................................. 294
7.2.4 Procedures ................................................................................................................ 231 8.4.5 Refactoring Assistant ............................................................................................ 295

7.3 Events .......................................................................................................................................... 231 8.5 Polymorphism ......................................................................................................................... 296


7.3.1 Program Constructor Events .............................................................................. 231 8.5.1 Static and Dynamic Types ................................................................................... 296
7.3.2 Reporting Events ..................................................................................................... 232 8.5.2 Casting ....................................................................................................................... 298
7.3.3 Selection Screen Events ........................................................................................ 238 8.5.3 Dynamic Binding with the Call Method ......................................................... 302
7.3.4 List Events ................................................................................................................. 238 8.5.4 Interfaces .................................................................................................................. 304
7.3.5 Screen Events ........................................................................................................... 239 8.5.5 Events ......................................................................................................................... 311

7.4 Procedures ................................................................................................................................ 240 8.6 Working with the Extensible Markup Language .................................................... 313
7.4.1 Subroutines .............................................................................................................. 242 8.6.1 XML Overview .......................................................................................................... 314
7.4.2 Function Modules ................................................................................................... 250 8.6.2 XML Processing Concepts .................................................................................... 315
7.4.3 Methods .................................................................................................................... 258 8.7 Summary ................................................................................................................................... 317
7.5 Inline Declarations ................................................................................................................ 264
7.5.1 Assigning Values to Data Objects ..................................................................... 264
7.5.2 Using Inline Declarations with Table Work Areas ....................................... 265 9 Exception Handling 319
7.5.3 Avoiding Helper Variables ................................................................................... 265
7.5.4 Declaring Actual Parameters .............................................................................. 265
9.1 Exceptions Overview ........................................................................................................... 319
7.6 Summary ................................................................................................................................... 266
9.2 Procedural Exception Handling ....................................................................................... 320
9.2.1 Maintaining Exceptions Using Function Modules ...................................... 320
9.2.2 Maintaining Exceptions Using Methods ........................................................ 322
9.2.3 Maintaining Exceptions for Local Classes ...................................................... 323
9.3 Class-Based Exception Handling .................................................................................... 324

10 11
Contents Contents

9.3.1 Raising Exceptions ................................................................................................. 325 11 Persistent Data 405


9.3.2 Catchable and Noncatchable Exceptions ....................................................... 326
9.3.3 Defining Exception Classes Globally ................................................................ 330
11.1 Working with Data in Databases ................................................................................... 406
9.3.4 Defining Exception Classes Locally ................................................................... 333
11.1.1 Open SQL ................................................................................................................... 407
9.4 Messages in Exception Classes ........................................................................................ 333 11.1.2 Logical Unit of Work .............................................................................................. 417
9.4.1 Using the Online Text Repository ..................................................................... 334
11.2 ABAP Object Services ........................................................................................................... 423
9.4.2 Using Messages from a Message Class .......................................................... 337
11.2.1 Persistence Service Overview ............................................................................. 423
9.4.3 Using the MESSAGE Addition to Raise an Exception .................................. 339
11.2.2 Building Persistent Classes ................................................................................. 424
9.5 Summary ................................................................................................................................... 339 11.2.3 Working with Persistent Objects ...................................................................... 427
11.3 File Interfaces .......................................................................................................................... 428
11.3.1 Working with Files in the Application Server ................................................ 428
10 ABAP Data Dictionary 341 11.3.2 Working with Files in the Presentation Layer ............................................... 431
11.4 Data Clusters ........................................................................................................................... 432
10.1 Database Tables ..................................................................................................................... 342 11.4.1 Exporting Data Clusters to Databases ............................................................ 434
10.1.1 Creating a Database Table .................................................................................. 344 11.4.2 Importing Data Clusters ....................................................................................... 434
10.1.2 Indexes ....................................................................................................................... 353
11.5 Security Concepts .................................................................................................................. 434
10.1.3 Table Maintenance Generator ........................................................................... 357
10.1.4 Foreign Keys ............................................................................................................. 361 11.6 Summary ................................................................................................................................... 436
10.1.5 Include Structure .................................................................................................... 364
10.1.6 Append Structure ................................................................................................... 366
10.2 Views ........................................................................................................................................... 367 12 Dialog Programming 439
10.2.1 Database Views ....................................................................................................... 368
10.2.2 Projection Views ..................................................................................................... 370 12.1 Screen Events ........................................................................................................................... 440
10.2.3 Maintenance Views ............................................................................................... 372
12.2 Screen Elements and Flow Logic ..................................................................................... 443
10.2.4 Help Views ................................................................................................................ 374
12.2.1 Components of a Dialog Program .................................................................... 444
10.2.5 ABAP Core Data Services Views ......................................................................... 374
12.2.2 Screens ....................................................................................................................... 448
10.3 Data Types ................................................................................................................................ 378 12.2.3 Screen Elements ...................................................................................................... 452
10.3.1 Data Elements ......................................................................................................... 378
12.3 Basic Screen Elements ......................................................................................................... 455
10.3.2 Structures .................................................................................................................. 382
12.3.1 Text Fields ................................................................................................................. 456
10.3.3 Table Types ............................................................................................................... 384
12.3.2 Checkboxes and Radio Buttons ......................................................................... 457
10.4 Type Groups ............................................................................................................................. 388 12.3.3 Push Buttons ............................................................................................................ 459
10.5 Domains ..................................................................................................................................... 389 12.4 Input/Output Fields ............................................................................................................. 460
10.6 Search Helps ............................................................................................................................. 392 12.5 List Box ....................................................................................................................................... 461
10.6.1 Elementary Search Helps ..................................................................................... 393
12.6 Table Controls ......................................................................................................................... 462
10.6.2 Collective Search Helps ........................................................................................ 396
12.6.1 Create a Table Control without a Wizard ....................................................... 463
10.6.3 Assigning a Search Help ....................................................................................... 399
12.6.2 Create a Table Control with a Wizard ............................................................. 467
10.6.4 Search Help Exits .................................................................................................... 400
12.7 Tabstrip Controls ................................................................................................................... 468
10.7 Lock Objects ............................................................................................................................. 400
12.8 Subscreens ................................................................................................................................ 470
10.8 Summary ................................................................................................................................... 404

12 13
Contents Contents

12.9 Working with Screens ......................................................................................................... 471 13.5 Basic Lists and Detail Lists ................................................................................................. 507
12.9.1 Screen Flow Logic ................................................................................................... 472 13.6 Classical Reports .................................................................................................................... 511
12.9.2 GUI Status ................................................................................................................. 474
13.7 Interactive Reports ............................................................................................................... 511
12.9.3 GUI Title ..................................................................................................................... 476
13.7.1 HIDE ............................................................................................................................ 511
12.9.4 Modifying Screen Fields Dynamically .............................................................. 476
13.7.2 READ LINE .................................................................................................................. 515
12.9.5 Field Help and Input Help .................................................................................... 478
13.7.3 GET CURSOR ............................................................................................................. 515
12.9.6 Screen Sequence ..................................................................................................... 479
13.7.4 DESCRIBE LIST .......................................................................................................... 516
12.9.7 Assigning Transaction Codes ............................................................................. 480
12.10 Control Framework ............................................................................................................... 483 13.8 Practice ....................................................................................................................................... 516

12.10.1 Using Container Controls .................................................................................... 483 13.9 Summary ................................................................................................................................... 517
12.10.2 Implementing Custom Controls ........................................................................ 484
12.11 Practice ....................................................................................................................................... 486
12.11.1 Application Flow ..................................................................................................... 487 14 Selection Screens 519
12.11.2 Delete Functionality .............................................................................................. 488
12.11.3 Validations and Autofills ..................................................................................... 488 14.1 Defining Selection Screens ................................................................................................ 520
12.12 Summary ................................................................................................................................... 489 14.2 Selection Screen Events ...................................................................................................... 521

14.3 Input Validations ................................................................................................................... 523

14.4 Selection Screen Variants .................................................................................................. 525


13 List Screens 491
14.4.1 Creating a Variant .................................................................................................. 526
14.4.2 Variant Attributes .................................................................................................. 529
13.1 Program Types ........................................................................................................................ 491 14.4.3 Table Variables from Table TVARVC ................................................................ 530
13.1.1 Executable Programs ............................................................................................ 492 14.4.4 Dynamic Date Calculation ................................................................................... 532
13.1.2 Module Pool Programs ......................................................................................... 493 14.4.5 Dynamic Time Calculation .................................................................................. 533
13.1.3 Function Groups ..................................................................................................... 494 14.4.6 User-Specific Variables ......................................................................................... 534
13.1.4 Class Pools ................................................................................................................. 494
14.5 Executing Programs in the Background ...................................................................... 534
13.1.5 Interface Pools ......................................................................................................... 494
13.1.6 Subroutine Pools ..................................................................................................... 495 14.6 Displaying and Hiding Screen Elements Dynamically ........................................... 536
13.1.7 Type Pools ................................................................................................................. 495 14.7 Calling Programs via Selection Screens ....................................................................... 538
13.1.8 Include Programs .................................................................................................... 495
14.8 Summary ................................................................................................................................... 538
13.2 Program Execution ................................................................................................................ 495
13.2.1 Executable Program Flow .................................................................................... 496
13.2.2 Module Pool Program Flow ................................................................................. 497
13.2.3 Calling Programs Internally ................................................................................ 497 15 SAP List Viewer Reports 541

13.3 Memory Organization ......................................................................................................... 498


15.1 Standard ALV Reports Using the Reuse Library ....................................................... 542
13.4 List Events ................................................................................................................................. 502 15.1.1 List and Grid Display: Simple Reports .............................................................. 543
13.4.1 TOP-OF-PAGE ........................................................................................................... 502 15.1.2 Block Display ............................................................................................................ 551
13.4.2 END-OF-PAGE .......................................................................................................... 504 15.1.3 Hierarchical Sequential Display ......................................................................... 555
13.4.3 AT LINE-SELECTION ................................................................................................ 505
15.2 Interactive Reports ............................................................................................................... 559
13.4.4 AT USER-COMMAND ............................................................................................. 506
15.2.1 Loading a Custom GUI Status ............................................................................ 560

14 15
Contents Contents

15.2.2 Reacting to User Actions ...................................................................................... 564 17.1.2 Field View .................................................................................................................. 616
15.2.3 Printing TOP-OF-PAGE .......................................................................................... 565 17.1.3 Table View ................................................................................................................ 616
15.3 ALV Reports Using the Control Framework ............................................................... 566 17.1.4 Breakpoints View .................................................................................................... 617
17.1.5 Watchpoints View .................................................................................................. 617
15.4 ALV Object Model .................................................................................................................. 568
17.1.6 Calls View .................................................................................................................. 618
15.4.1 Table Display ............................................................................................................ 569 17.1.7 Overview View ......................................................................................................... 619
15.4.2 Hierarchical Display ............................................................................................... 570 17.1.8 Settings View ........................................................................................................... 619
15.4.3 Tree Object Model .................................................................................................. 574 17.1.9 Additional Features ............................................................................................... 620
15.5 SAP List Viewer with Integrated Data Access ........................................................... 576 17.2 New Debugger ........................................................................................................................ 623
15.6 Summary ................................................................................................................................... 578 17.2.1 User Interface and Tools ...................................................................................... 623
17.2.2 Layout and Sessions .............................................................................................. 625
17.3 ABAP Managed Database Procedures Debugger .................................................... 627
16 Dynamic Programming 579 17.4 Using the Debugger to Troubleshoot ........................................................................... 627

17.5 Using the Debugger as a Learning Tool ....................................................................... 629


16.1 Field Symbols ........................................................................................................................... 580
17.6 Summary ................................................................................................................................... 630
16.1.1 Using Field Symbols to Make Programs Dynamic ....................................... 582
16.1.2 Defining Field Symbols ......................................................................................... 588
16.1.3 Assigning a Data Object ....................................................................................... 589
16.1.4 Checking If a Field Symbol Is Assigned ............................................................ 592 18 Forms 631
16.1.5 Unassigning a Field Symbol ................................................................................ 593
16.1.6 Casting ....................................................................................................................... 593 18.1 SAP Scripts ................................................................................................................................ 633
16.2 Data References ..................................................................................................................... 594 18.1.1 Overview and Layout ............................................................................................. 633
16.2.1 Defining Reference Variables ............................................................................. 594 18.1.2 Creating the Form Layout .................................................................................... 636
16.2.2 Getting Data References ...................................................................................... 595 18.1.3 Maintaining Window Details ............................................................................. 642
16.2.3 Anonymous Data Objects .................................................................................... 597 18.1.4 Processing Forms with Function Modules ..................................................... 647
16.2.4 Assignment between Reference Variables .................................................... 598 18.2 Smart Forms ............................................................................................................................. 654
16.3 Runtime Type Services ........................................................................................................ 599 18.2.1 Overview and Layout ............................................................................................. 654
16.3.1 Runtime Type Information .................................................................................. 600 18.2.2 Maintaining the Global Settings ....................................................................... 657
16.3.2 Runtime Type Creation ......................................................................................... 601 18.2.3 Maintaining Elements .......................................................................................... 659
18.2.4 Driver Program ........................................................................................................ 674
16.4 Dynamic Token Specification ........................................................................................... 604
18.3 SAP Interactive Forms by Adobe ..................................................................................... 677
16.5 Dynamic Procedure Calls .................................................................................................... 606
18.3.1 Form Interface ......................................................................................................... 678
16.6 Dynamic Program Generation ......................................................................................... 608
18.3.2 Form Context and Layout .................................................................................... 684
16.7 Summary ................................................................................................................................... 610 18.3.3 Driver Program ........................................................................................................ 695
18.3.4 Downloading the Form as a PDF ....................................................................... 696
18.4 Summary ................................................................................................................................... 697
17 Debugging 611

17.1 Classic Debugger .................................................................................................................... 612


17.1.1 Activating and Using the Classic Debugger .................................................. 612

16 17
Contents Contents

19 Interfaces 699 20 Modifications and Enhancements 801

19.1 Batch Data Communication ............................................................................................. 700 20.1 Customization Overview ................................................................................................... 801
19.1.1 Direct Input ............................................................................................................... 701 20.2 Modification Overview ....................................................................................................... 803
19.1.2 Batch Input ............................................................................................................... 703
20.3 Using the Modification Assistant ................................................................................... 803
19.2 Business Application Programming Interfaces ........................................................ 713
20.3.1 Modifications to Programs .................................................................................. 804
19.2.1 Business Object Types and Business Components ..................................... 713 20.3.2 Modifications to the Class Builder .................................................................... 805
19.2.2 BAPI Development via BAPI Explorer ............................................................... 714 20.3.3 Modifications to the Screen Painter ................................................................ 807
19.2.3 Standardized Business Application Programming Interfaces ................. 717 20.3.4 Modifications to the Menu Painter .................................................................. 808
19.2.4 Standardized Parameters .................................................................................... 718 20.3.5 Modifications to the ABAP Data Dictionary .................................................. 808
19.2.5 Implementing Business Application Programming Interfaces ............... 719 20.3.6 Modifications to Function Modules ................................................................. 808
19.3 EDI/ALE/IDocs ......................................................................................................................... 727 20.3.7 Resetting to Original ............................................................................................. 809
19.3.1 Electronic Data Interchange ............................................................................... 727 20.4 Using the Modification Browser ..................................................................................... 810
19.3.2 Application Link Enabling .................................................................................... 732
20.5 Enhancements Overview ................................................................................................... 811
19.3.3 Intermediate Documents .................................................................................... 734
19.3.4 System Configurations ......................................................................................... 744 20.6 User Exits ................................................................................................................................... 812
19.3.5 Inbound/Outbound Programs ........................................................................... 751 20.7 Customer Exits ........................................................................................................................ 813
19.4 Legacy System Migration Workbench ......................................................................... 754 20.7.1 Create a Customer Exit ......................................................................................... 816
19.4.1 Getting Started ....................................................................................................... 755 20.7.2 Function Module Exits .......................................................................................... 818
19.4.2 Migration Process Steps ....................................................................................... 756 20.7.3 Screen Exits .............................................................................................................. 818
20.7.4 Menu Exits ................................................................................................................ 820
19.5 Web Services ............................................................................................................................ 765
19.5.1 Creating a Web Service ......................................................................................... 767 20.8 Business Add-Ins .................................................................................................................... 822
19.5.2 Consuming Web Services .................................................................................... 771 20.8.1 Overview .................................................................................................................... 822
20.8.2 Defining a BAdI ........................................................................................................ 823
19.6 OData Services ........................................................................................................................ 777
20.8.3 Implementing a Business Add-In ...................................................................... 830
19.6.1 Data Model Definition .......................................................................................... 779
20.8.4 Implementing a Fallback Class .......................................................................... 832
19.6.2 Service Maintenance ............................................................................................. 782
20.8.5 Calling a Business Add-In ..................................................................................... 833
19.6.3 Service Implementation ....................................................................................... 784
20.9 Enhancement Points ............................................................................................................ 834
19.7 Extensible Stylesheet Language Transformations ................................................. 788
20.9.1 Explicit Enhancements ......................................................................................... 834
19.7.1 Serialization .............................................................................................................. 789
20.9.2 Implicit Enhancements ......................................................................................... 837
19.7.2 Deserialization ........................................................................................................ 789
20.10 Business Transaction Events ............................................................................................. 840
19.8 XML and JSON Data Representation ............................................................................. 790
20.10.1 Implementing a Business Transaction Event ................................................ 841
19.9 WebSockets (ABAP Channels and Messages) ........................................................... 792 20.10.2 Testing a Custom Function Module ................................................................. 844
19.9.1 Creating an ABAP Messaging Channel ............................................................ 793
20.11 Summary ................................................................................................................................... 845
19.9.2 Creating a Producer Program ............................................................................. 795
19.9.3 Creating a Consumer Program .......................................................................... 796
19.10 Summary ................................................................................................................................... 799

18 19
Contents

21 Test and Analysis Tools 847

21.1 Overview of Tools .................................................................................................................. 847

21.2 ABAP Unit .................................................................................................................................. 849


21.2.1 Eliminating Dependencies .................................................................................. 850
21.2.2 Implementing Mock Objects .............................................................................. 852
21.2.3 Writing and Implementing Unit Tests ............................................................ 853
21.3 Code Inspector ........................................................................................................................ 860

21.4 Selectivity Analysis ............................................................................................................... 862

21.5 Process Analysis ..................................................................................................................... 864

21.6 Memory Inspector ................................................................................................................. 866


21.6.1 Creating Memory Snapshots .............................................................................. 867
21.6.2 Comparing Memory Snapshots ......................................................................... 868
21.7 Table Call Statistics ............................................................................................................... 869

21.8 Performance Trace ................................................................................................................ 871


21.8.1 SQL Trace ................................................................................................................... 874
21.8.2 Remote Function Call Trace ................................................................................ 876
21.8.3 Enqueue Trace ......................................................................................................... 877
21.8.4 Buffer Trace .............................................................................................................. 878
21.9 ABAP Trace/Runtime Analysis ......................................................................................... 879
21.9.1 Running ABAP Trace .............................................................................................. 879
21.9.2 Analyzing the Results ............................................................................................ 881
21.10 Single-Transaction Analysis .............................................................................................. 883

21.11 Dump Analysis ........................................................................................................................ 886


21.12 Summary ................................................................................................................................... 887

The Author ............................................................................................................................................... 889

Index .......................................................................................................................................................... 891

20
Index

$TMP .......................................................................... 131 ABAP Data Dictionary (Cont.)


object ....................................................................... 87
A screen ............................................................ 86, 341
search help ......................................................... 392
ABAP ............................................................................. 38 selection text ..................................................... 204
addition ............................................................... 100 smart forms ....................................................... 658
conversion .............................................................. 40 table control ...................................................... 464
environment ......................................................... 71 type group .......................................................... 388
extension ................................................................ 41 type pools ........................................................... 495
forms ........................................................................ 42 view ....................................................................... 367
interfaces ................................................................ 40 ABAP Debugger ..................................................... 611
reports ..................................................................... 39 learning tool ...................................................... 629
RICEF ........................................................................ 39 ABAP Developer View ......................................... 886
statement .................................................. 100, 126 ABAP Development Tools (ADT) ...... 71, 90, 374
System requirements ......................................... 42 ABAP Dispatcher ............................................... 50, 51
abap_false ................................................................ 285 ABAP Editor .................. 71, 80, 129, 158, 493, 775
ABAP CDS view ............................................ 342, 368 back-end editor ................................................... 81
access .................................................................... 377 creating variant ............................................... 526
create .................................................................... 374 front-end editor (new) ...................................... 80
data definition .................................................. 375 front-end editor (old) ........................................ 80
define .................................................................... 374 modify programs ............................................. 805
replacement objects ........................................ 377 program attributes ......................................... 128
template ............................................................... 376 settings ................................................................... 81
ABAP CDS views .................................................... 374 your first program .......................................... 128
ABAP channel ......................................................... 794 ABAP in Eclipse
consumer program .......................................... 796 ABAP CDS views ............................................... 374
producer program ........................................... 795 ABAP keyword documentation ...................... 103
ABAP channels ....................................................... 793 ABAP Managed Database Procedures
ABAP consultant ...................................................... 35 (AMDP) ........................................................ 612, 627
ABAP Data Dictionary ............................ 71, 78, 86, ABAP messaging channel ................................. 793
341, 404, 460 create .................................................................... 793
ABAP CDS views ................................................ 368 ABAP Object ............................................................ 215
BAPI ....................................................................... 720 ABAP Objects .............................. 216, 230, 242, 840
create data element ........................................ 117 ABAP Objects Control Framework ................ 483
create domain ................................................... 121 ABAP Object Services ................................. 423, 436
database table ................................................... 342 ABAP processor ..................................................... 441
data type ............................................................. 378 ABAP program ................................................ 97, 444
DDL ........................................................................ 406 declaration ......................................................... 217
domain ................................................................. 389 global declarations area .................................. 98
elementary search help ................................. 393 procedural area ............................................ 98, 99
global table type ............................................... 249 statement ............................................................ 223
GTT ......................................................................... 346 structure ....................................................... 98, 217
I_STRUCTURE_NAME ..................................... 545 ABAP programming environment .................. 72
interface ............................................................... 679 ABAP push channel .................................... 793, 872
lock object ........................................................... 400 ABAP runtime environment
modification ...................................................... 808 event block ......................................................... 226
Modification Browser ..................................... 811 processing block ............................................... 219
nongeneric data type ..................................... 191 processing blocks ............................................. 214

891
Index Index

ABAP runtime environment (Cont.) ALE ............................................................................... 732 Appending type ..................................................... 429 BAdI (Cont.)
selection screen ................................................. 519 inbound process ................................................ 734 Append structure ........................................ 143, 366 filter values ........................................................ 827
ABAP statement layer ....................................................................... 732 add ......................................................................... 366 IF_FILTER_CHECK_AND_F4 interface ..... 828
attributes ............................................................. 129 outbound process ............................................. 732 Application flow .................................................... 487 implementation ............................................... 830
call .......................................................................... 127 RFC destination ................................................. 745 Application layer ....................... 45, 46, 49, 70, 217 implementation part ..................................... 822
control .................................................................. 127 system configuration ...................................... 744 Application Link Enabling (ALE) ..................... 727 BAdI Builder ............................................................ 824
declarative .......................................................... 127 tRFC ........................................................................ 746 Application server ......................................... 49, 405 BAPI ......................................................... 231, 713, 714
modularization ................................................. 127 Alias ............................................................................ 310 components ........................................................... 50 address parameters ........................................ 718
Open SQL ............................................................. 127 Alternative node .................................................... 691 file ........................................................................... 428 BAPI Explorer .................................................... 714
operational ......................................................... 127 ALV .............................................................................. 865 Application toolbar .............................................. 444 business component ....................................... 714
processing blocks ............................................. 215 block display ....................................................... 551 Architecture ............................................................... 45 business object type ............................... 714, 722
ABAP System Central Services (ASCS) ............. 50 CL_GUI_ALV_GRID .......................................... 541 Arithmetic operations ........................................ 416 change parameters ......................................... 718
ABAP Trace ........................................... 849, 876, 879 component .......................................................... 542 Array fetch ............................................................... 177 class method ...................................................... 716
analysis ................................................................ 885 Control Framework .......................................... 566 ASSIGNING addition ............................................ 592 conventions ....................................................... 720
analyze results .................................................. 881 display ................................................................... 585 Assignment operator .......................................... 100 development phases ....................................... 715
call .......................................................................... 885 dynamic subroutine ........................................ 560 asXML ........................................................................ 792 documentation ................................................. 726
results screen ..................................................... 881 grid display ......................................................... 546 Asynchronous data update ............................... 707 extension parameters .................................... 718
run .......................................................................... 879 hierarchical sequential display ................... 555 AT LINE-SELECTION ............................................. 229 implementation ............................................... 719
ABAP Unit ...................................................... 848–850 layout .................................................................... 551 AT LINE-SELECTION event ................................. 505 instance method .............................................. 716
code example ..................................................... 859 library .................................................................... 541 AT SELECTION-SCREEN ....................................... 521 releasing .............................................................. 727
eliminate dependencies ................................. 850 list and grid display ......................................... 543 ON BLOCK ........................................................... 522 return parameters ........................................... 718
fixture ................................................................... 853 object model ....................................................... 541 ON END OF \\u003csel\\\> .......................... 522 standardized parameter ............................... 718
implement mock object ................................. 852 parameter ............................................................ 544 ON EXIT-COMMAND ...................................... 523 test run parameters ........................................ 718
predefined method .......................................... 854 report ..................................................................... 541 ON HELP-REQUEST FOR \\ tool ........................................................................ 719
SETUP .................................................................... 854 reuse library ........................................................ 542 u003cfield\\\> .............................................. 523 use case ................................................................ 713
TEARDOWN ........................................................ 854 simple report ...................................................... 543 ON RADIO BUTTON GROUP ........................ 522 BAPI Explorer ......................................................... 714
unit test ................................................................ 853 standard reports ............................................... 542 ON \\u003cfield\\\> ....................................... 522 tabs ........................................................................ 714
ABAP Workbench ............... 42, 70, 71, 77, 80, 250 with integrated data access ......................... 576 OUTPUT ............................................................... 521 Basic list ........................................ 491, 510, 514, 517
ABAP Data Dictionary ................................... 341 ALV grid control ................................. 483, 566, 567 AT SELECTION-SCREEN block ........................... 225 Basis .............................................................................. 70
Class Builder .......................................................... 83 ALV object model .............................. 231, 568, 582 Attributes ................................................................. 271 BASIS Developer View ........................................ 887
Function Builder .................................................. 82 class ........................................................................ 568 AT USER-COMMAND event .............................. 506 Batch Data Communication (BDC) ....... 699, 700
Menu Painter ........................................................ 85 default status ..................................................... 574 Authorization group ........................................... 358 batch input ......................................................... 703
object ..................................................................... 131 hierarchical display ............................... 570, 572 Authorization object ................................. 435, 436 direct input ......................................................... 701
Object Navigator ................................................. 88 set GUI status ..................................................... 570 Automatic type conversion .............................. 112 Batch input .................................................... 700, 703
Screen Painter ............................................. 83, 439 table display ....................................................... 569 Automation Controller ...................................... 483 BDCDATA ............................................................ 704
ABSTRACT ................................................................ 291 tree display .......................................................... 575 Average ..................................................................... 410 CALL TRANSACTION ....................................... 707
Abstract class .......................................................... 290 tree object model .............................................. 574 AVG ............................................................................. 410 create a material ............................................. 703
Access control ........................................................ 407 AMDP Debugger ................................ 611, 612, 627 create program ................................................. 704
ActiveX ...................................................................... 545 breakpoint ........................................................... 627 B create program with Transaction
Actual parameter .................................................. 242 capabilities .......................................................... 627 Recorder ......................................................... 708
Addition .......................................................... 100, 103 prerequisites ....................................................... 627 Background mode ................................................ 707 SESSION ............................................................... 707
Address American Standard Code for Information Background processing ...................................... 519 update mode ..................................................... 708
element ................................................................ 662 Interchange (ASCII) .......................................... 107 executing programs ........................................ 534 BDCDATA structure ............................................. 706
node ....................................................................... 688 Analysis ..................................................................... 847 BAdI .................................................................. 811, 822 Billing document report .................................... 512
Add\\u003csubobject\\\>() .............................. 717 Anomaly ................................................................... 172 call .......................................................................... 833 Binary search ......................................................... 154
Adobe Document Server (ADS) ....................... 677 Anonymous data object ..................................... 597 create .................................................................... 825 Block .......................................................................... 522
Adobe LiveCycle Designer ................................. 677 access component ............................................ 598 create definition ............................................... 824 Block display .......................................................... 542
Layout tab ........................................................... 691 Any field .................................................................... 152 create interface ................................................. 829 example ............................................................... 554
Advance Business Application Any table ................................................................... 152 define .................................................................... 823 function module .............................................. 551
Programming (ABAP) ........................................ 39 API ..................................................................... 283, 699 definition part ................................................... 822 Boxed
Agent class ..................................................... 424, 427 APPEND ..................................................................... 156 enhancement spot ........................................... 824 structure .............................................................. 383
Aggregation function .......................................... 410 APPENDING TABLE ............................................... 412 fallback class ...................................................... 832 Boxed data type ........................................... 382, 383

892 893
Index Index

Box screen element ............................................. 454 Center of Excellence (CoE) ................................... 35 Classic Debugger (Cont.) Control Framework (Cont.)
Breakpoint ..................................................... 183, 613 CHAIN ........................................................................ 473 shortcut ................................................................ 623 server and client side ...................................... 483
AMDP Debugger ............................................... 627 Chained statement ............................................... 101 table view ............................................................ 616 Controlling (CO) ....................................................... 33
in a call ................................................................. 621 Change( ) ................................................................... 717 view ........................................................................ 615 Control record ....................................................... 730
setup ............................................................ 613, 628 CHANGING .......................................... 245, 247, 254 watchpoints view ............................................. 617 Control statement ................................................ 127
view ........................................................................ 617 output parameters ........................................... 246 Classic view ............................................................. 368 Conversion
BTE .............................................................................. 811 Character Class pool ................................................................. 494 routine ........................................................ 121, 122
event ...................................................................... 842 data type .............................................................. 107 Client ..................................................................... 60, 61 rule ................................................................ 110, 112
implement ........................................................... 841 field ......................................................................... 107 data .......................................................................... 61 Conversion exit ..................................................... 390
interface ............................................................... 840 Character literal ..................................................... 124 specific data .......................................................... 61 function module .............................................. 390
test custom function module ...................... 844 CHECK .............................................................. 221, 222 Client proxy ............................................................ 771 Conversion logic ................................................... 701
Buffer ............................................................................ 57 statement ............................................................. 220 CLOSE_FORM ......................................................... 647 Conversion program .............................................. 40
Buffering ........................................................ 352, 869 check_count ............................................................ 285 CLOSE DATASET .................................................... 430 Conversion routine ............................................. 390
permissions ........................................................ 352 check_status ............................................................ 285 CLUSTD ..................................................................... 434 Core data services (CDS) .................................... 175
Buffer trace .................................................... 871, 878 Checkbox ........................................................ 454, 457 CLUSTR ...................................................................... 434 Count ......................................................................... 411
Bundling technique ............................................. 419 Check table ..................................................... 361–363 CMOD enhancement ........................................... 813 CREATE OBJECT statement ............................... 258
Business Add-In (BAdI) .......................................... 37 cl_notification_api ............................................... 284 Code Inspector ............................................. 848, 860 Cross-client ................................................................ 61
Business Address Services (BAS) ..................... 662 Class .................................................................. 258, 271 results ................................................................... 860 data .......................................................................... 61
Business Application Programming abstract ................................................................ 290 use case ................................................................ 860 CRUD ......................................................................... 784
Interface ............................................................... 699 final ........................................................................ 293 Code pushdown ........................................... 175, 368 Currency field ........................................................ 349
Business component ........................................... 714 friend ..................................................................... 282 COLLECT ................................................................... 158 Custom code
Business Object Repository (BOR) global ..................................................................... 293 Collective search help ...................... 393, 396, 397 execute ................................................................. 359
BAPI ....................................................................... 720 pool ........................................................................ 259 create .................................................................... 397 Custom container ............................. 455, 483, 484
Business object type ............................................ 714 properties ............................................................. 259 Collision check ....................................................... 402 Custom control
BOR ........................................................................ 722 Class-based exception ......................................... 324 Command node ..................................................... 669 create .................................................................... 484
Class Builder ............................................ 71, 83, 258, Comment ................................................................. 102 Custom development ......................................... 802
C 292, 293, 295, 309, 829 COMMIT WORK ........................................... 418, 726 Customer development ................................. 36, 38
class pool ............................................................. 494 Comparison operators ........................................ 412 Customer enhancement ............................... 36, 37
Calendar control .................................................... 483 components ........................................................ 806 Complex data type ............................................... 114 Customer exit ..................................... 811, 813, 816
CALL FUNCTION .......................................... 215, 605 exception class .................................................. 331 Component ............................................................. 135 create .................................................................... 816
statement ............................................................ 256 interface pools ................................................... 494 Component type ................................................... 142 function module .............................................. 813
Calling program ..................................................... 544 Methods tab ........................................................ 259 Composer ................................................................. 633 function module exit ...................................... 818
CALL METHOD statement ....................... 215, 262 modification ....................................................... 805 Composition ........................................................... 294 menu exit ............................................................ 820
CALL SCREEN .......................................................... 446 persistent class .................................................. 424 relationship ........................................................ 294 screen exit ........................................................... 818
CALL SCREEN statement .................................... 480 test class ............................................................... 853 Constant ................................................................... 126 type ........................................................................ 814
Call sequence .......................................................... 500 visibility ................................................................ 260 Constant window .................................................. 636 Customization ................................................... 36, 38
Call stack ................................................................... 618 Classical list .............................................................. 491 Constructor ................................................... 278, 335 Customizing and development client
Call statement ........................................................ 127 Classical report ....................................................... 511 instance ................................................................ 278 (CUST) ...................................................................... 63
CALL SUBSCREEN .................................................. 470 Classic BAdIs ............................................................ 822 static ...................................................................... 279 Customizing Include (CI) ................................... 143
CALL TRANSACTION ............... 232, 605, 707, 711 Classic Debugger ....................... 183, 611, 612, 614 Consumer program ............................................. 798 CX_DYNAMIC_CHECK .............................. 328, 329
Cancel( ) .................................................................... 717 activate ................................................................. 612 Container control ................................................. 483 CX_NO_CHECK ..................................................... 329
Candidate key ......................................................... 169 additional features .......................................... 620 Context menu ........................................................ 451 CX_ROOT ................................................................. 328
Cardinality ............................................................... 364 breakpoint ................................................. 614, 617 Control break statement .......................... 162, 163 CX_STATIC_CHECK ............................................. 329
CASE statement ........................................... 416, 823 calls view .............................................................. 618 rules ....................................................................... 166 CX_SY_ ...................................................................... 327
Casting ............................................................. 593, 594 execute code ....................................................... 615 Control break statements
implicit or explicit ............................................ 594 field view .............................................................. 616 AT END OF ........................................................... 162 D
narrowing cast .................................................. 299 jumping to statements ................................... 620 AT FIRST ............................................................... 162
widening cast ........................................... 299, 301 object view .......................................................... 620 AT LAST ................................................................ 162 DATA ......................................................................... 125
CATCH ....................................................................... 325 overview view ..................................................... 619 AT NEW comp .................................................... 162 DATA(..) ..................................................................... 264
statement ............................................................ 328 program status .................................................. 622 Control Framework ................. 440, 483, 542, 546 Database
Catchable exception ............................................ 326 settings ................................................................. 613 ALV ......................................................................... 566 relationship ........................................................ 171
CDS view ......................................................... 410, 777 settings view ....................................................... 619 grid display ......................................................... 545 Database access statement ............................... 127

894 895
Index Index

Database interface ................................................ 441 Data inconsistency ............................................... 112 Default key .............................................................. 152 Dynamic enhancement point ......................... 835
Database kernel ..................................................... 354 Data Manipulation Language (DML) .... 86, 168, Delegation of tasks ............................................... 270 Dynamic message ................................................ 209
Database layer ..................................... 45, 47, 55, 70 407 DELETE ...................................................................... 168 Dynamic procedure call .................................... 606
Database lock .......................................................... 419 Data model definition ......................................... 778 Delete( ) ..................................................................... 717 Dynamic program ................................................ 187
Database LUW ..................................... 345, 417, 436 Data modeling ........................................................ 258 Delete anomaly ..................................................... 172 Dynamic program generation ........................ 608
database lock ..................................................... 419 Data node ................................................................. 690 DELETE DATASET .................................................. 430 persistent program ......................................... 609
dialog step .......................................................... 418 Data object ....................................................... 98, 123 Delivery classes ...................................................... 346 transient program ........................................... 609
Databases anonymous ......................................................... 597 Dependency ............................................................ 851 Dynamic programming .................. 152, 579, 580
fetching data ...................................................... 408 constant ............................................................... 126 DEQUEUE ................................................................. 400 Dynamic RFC destination ................................. 746
persistent data .................................................. 406 DATA ...................................................................... 125 DESCRIBE LIST statement .................................. 516 Dynamic subroutine pool ................................. 609
Database structure ............................................... 168 declaration .......................................................... 106 Desktop ..................................................................... 623 Dynamic text ......................................................... 664
Database table ........................... 138, 176, 342, 405 field symbol ......................................................... 589 Destination .............................................................. 422 Dynamic time ........................................................ 533
append structure .............................................. 366 inline declaration ............................................. 125 Detail list ............................................... 491, 507, 514 calculation ......................................................... 533
components ........................................................ 344 literal ..................................................................... 124 Dialog box container ........................................... 483 selection .............................................................. 533
create .................................................................... 344 named ................................................................... 597 Dialog module ........ 215, 217, 226, 230, 441, 444 Dynamic token ................................... 580, 604, 606
Currency/Quantity Fields tab ..................... 349 PARAMETERS ..................................................... 125 selection screen ................................................. 238 Dynamic token specification .......................... 604
enhancement category .................................. 350 predefined type .................................................. 113 Dialog programming Dynamic type ........................................................ 298
fields tab .............................................................. 348 reference ............................................................... 596 component ......................................................... 444 Dynpro ................................................... 187, 447, 448
hint ......................................................................... 354 text symbol ......................................................... 126 practice application ........................................ 486
include structure .................................... 364, 365 user-defined type .............................................. 114 Dialog step ..................................................... 217, 418 E
index ...................................................................... 353 variable ................................................................. 125 database LUW ................................................... 418
persistent data .................................................. 405 Data record .............................................................. 730 Dialog transaction ................................................ 443 Eclipse ................................................................... 71, 89
SELECT...ENDSELECT ....................................... 177 Data reference ........................................................ 594 Diamond problem ................................................ 305 installation ............................................................ 90
technical setting ............................................... 344 debug mode ........................................................ 595 Direct input ................................................... 700, 701 installation wizard ............................................. 90
unique and nonunique indexes .................. 356 dereference .......................................................... 596 manage ................................................................ 702 Project Explorer ................................................... 93
Database tables get ........................................................................... 595 program ............................................................... 702 Eclipse IDE ............................................................... 374
Display/Maintenance tab ............................. 346 initial ..................................................................... 595 Dispatch control .................................................... 733 EDI .............................................................................. 727
SELECT SINGLE .................................................. 176 variable ................................................................. 594 Distributed environment .................................. 732 benefits ................................................................ 728
Database view ........................................................ 368 Data references ...................................................... 580 Distribution model .............................................. 732 inbound process ............................................... 731
create .................................................................... 368 Data security ........................................................... 435 Docking container ................................................ 484 outbound and inbound processing .......... 730
Data browser ........................................................... 346 Data structure ........................................................... 60 Domain .................................................... 88, 170, 389 process ................................................................. 728
Data class .................................................................. 351 Data transfer ........................................................... 700 attach to data element .................................. 122 system configuration ..................................... 744
Data cluster ................................................... 405, 432 frequency ............................................................. 700 bottom-up approach ...................................... 121 using IDocs ......................................................... 729
administration section .................................. 432 Data type ..................... 88, 104, 107, 117, 348, 378 create .................................................................... 121 Element .................................................................... 648
data section ........................................................ 432 data element ...................................................... 378 format ................................................................... 389 address ................................................................. 662
export .................................................................... 434 data format ......................................................... 114 output length ..................................................... 122 call ......................................................................... 648
exporting to databases .................................. 434 documentation .................................................. 379 relationship with data elements and graphics ............................................................... 661
import ................................................................... 434 further characteristics .................................... 380 fields ................................................................. 120 maintain ............................................................. 659
media .................................................................... 432 output length ..................................................... 116 top-down approach ........................................ 121 program line ...................................................... 668
persistent data .................................................. 405 structure ............................................................... 382 Domains ................................................................... 120 table ...................................................................... 666
Data Control Language (DCL) ........................... 407 tab ................................................................. 118, 378 Downcasting ................................................. 598, 599 text ........................................................................ 664
Data definition ....................................................... 341 table type ............................................................. 384 Drilldown report ......................................... 491, 507 Elementary data type ............. 104, 191, 378, 382
Data Definition Language (DDL) .... 87, 168, 406 value list ............................................................... 119 Dropdown list box ................................................ 454 Elementary search help ..................................... 393
Data element ............................. 117, 118, 348, 378 Debugging ................................... 136, 183, 611, 628 Dual-stack system ................................................... 50 create .................................................................... 393
activate ................................................................ 119 breakpoint ........................................................... 183 Dump analysis ............................................. 849, 886 options ................................................................. 395
change .................................................................. 118 Classic Debugger ............................................... 183 views ...................................................................... 886 Element bar ............................................................ 456
domain ................................................................. 120 exit .......................................................................... 185 Dynamic binding Element list ............................................................. 451
global user-defined elementary type ....... 117 New Debugger ................................................... 183 CALL method ...................................................... 302 Element palette ..................................................... 456
modify .................................................................. 808 troubleshooting ................................................ 627 Dynamic date ......................................................... 532 Encapsulation ..................................... 267, 270, 279
relationship with domains and fields ...... 120 Debug session ......................................................... 627 calculation .......................................................... 532 END-OF-PAGE ........................................................ 516
search help .......................................................... 399 Declarative statement ......................................... 127 selection ............................................................... 533 END-OF-PAGE event ............................................ 504
Data format ............................................................. 114 Deep structure ........................................................ 137 Dynamic element ................................................. 209 END-OF-SELECTION .................................... 236, 237

896 897
Index Index

End user ....................................................................... 34 Exception handling .................................... 250, 319 Field symbol (Cont.) Form (Cont.)
Enhancement ............................... 36, 801, 811, 845 local class ............................................................. 323 generic type ........................................................ 589 text node ............................................................. 690
assignment ......................................................... 816 using methods ................................................... 322 making programs dynamic ......................... 582 windows .............................................................. 660
hook ....................................................................... 812 Exceptions modifying an internal table record .......... 581 Formal parameter ....................................... 242, 246
Enhancement category ...................................... 350 overview ............................................................... 319 static assignment ............................................. 590 typed and untyped .......................................... 243
Enhancement Framework ....................... 822, 834 EXCEPTIONS statement ...................................... 323 structure component ...................................... 589 Form Builder .......................................................... 656
Enhancement package ........................................... 29 Exclude structure field .................................................... 591 draft page ........................................................... 656
ENHANCEMENT-POINT ...................................... 835 ranges .................................................................... 200 unassign .............................................................. 593 form style ............................................................ 670
Enhancement point ............................................. 834 single values ....................................................... 200 File interface ........................................................... 428 SAP Interactive Forms by Adobe ...... 678, 684
explicit .................................................................. 835 Executable program ................ 129, 187, 232, 492 Filtering logic .......................................................... 285 smart forms ....................................................... 655
Enhancement spot ............................................... 824 background processing .................................. 534 FINAL ......................................................................... 293 text module ........................................................ 664
create .................................................................... 824 flow ......................................................................... 496 Financial Accounting (FI) ...................................... 33 Form Painter ................................................. 635, 636
Enjoy transactions ................................................... 76 Exit message ............................................................ 205 First normal form (1NF) ..................................... 173 create window .................................................. 639
ENQUEUE ................................................................. 400 EXIT statement ....................................................... 220 Fixed point arithmetic ........................................ 130 graphical ............................................................. 638
Enqueue server ................................................. 50, 53 Explicit enhancement ......................................... 834 Fixture ....................................................................... 853 page layout ........................................................ 638
Enqueue trace ...................................... 849, 871, 877 Explicit enhancement point ............................. 835 Flat structure .......................................................... 137 paragraph and character formatting ..... 640
Enterprise resource planning ............................. 27 Extended Binary Coded Decimal Interchange Flow logic ....................................................... 444, 466 SAP scripts .......................................................... 633
ERP system ................................................................. 30 Code (EBCDI) ....................................................... 108 tab .......................................................................... 451 Forms ........................................................................... 42
advantages ............................................................ 32 Extends ...................................................................... 351 Foreground mode ................................................. 707 FORM statement ................................................... 243
departments .......................................................... 30 Extensible Stylesheet Language (XSL) .......... 788 Foreground on error mode ............................... 707 FOR TESTING .......................................................... 853
layout ....................................................................... 32 Extensible Stylesheet Language Foreign key .............. 169, 170, 178, 344, 361, 406 Free key .................................................................... 159
vs. non-ERP systems ........................................... 30 Transformations (XSLT) ................................. 788 create relationship ........................................... 362 FROM clause ........................................................... 411
Error message ......................................................... 205 Extension .................................................................... 41 field types ............................................................ 363 Functional consultant ........................................... 34
Event ................................................................ 231, 359 External breakpoint ............................................. 613 relationship ........................................................ 361 Function Builder ............................. 71, 80, 82, 129,
event handler ..................................................... 311 External data ............................................................. 97 table ....................................................................... 361 215, 250, 494, 543, 842
instance event ................................................... 311 External developer ............................................... 699 Form ................................................................. 631, 636 Attributes tab .................................................... 253
list event .............................................................. 238 External program .................................................. 280 address ................................................................. 662 BAPI .............................................................. 719, 722
program constructor ...................................... 231 address node ...................................................... 688 Changing tab ..................................................... 254
reporting event ................................................. 232 F alternative node ............................................... 691 create web service ........................................... 767
screen event ........................................................ 239 attributes ............................................................. 657 Exceptions tab .................................................. 255
selection screen ................................................. 238 Fallback class ................................................. 826, 832 command ............................................................ 669 Export tab ........................................................... 254
sender ................................................................... 311 implement ........................................................... 832 create .................................................................... 684 function module ........................... 250, 251, 722
static event ......................................................... 311 FIELD ........................................................................... 472 data node ............................................................ 690 Import tab .......................................................... 254
Event block ........................ 214, 217, 225, 226, 229 Field driver program .................................................. 674 Source Code tab ................................................ 256
Event controlling .................................................. 270 relationship with domains and data element ................................................................ 648 Tables tab ........................................................... 255
Events ........................................................................ 311 elements .......................................................... 120 global definition ............................................... 659 update function module ............................... 420
sequence .............................................................. 496 Field attributes ....................................................... 399 graphic node ...................................................... 686 Function group ......................... 187, 250, 494, 521
Exception Field catalog ................................................... 542, 547 graphics ............................................................... 661 create .................................................................... 251
ASSIGN ................................................................. 326 component .......................................................... 547 interface ............................................................... 658 Function module ............ 215, 226, 242, 250, 499
catching ..................................................... 321, 326 usage ..................................................................... 549 invoice .................................................................. 631 calling ................................................................... 256
local class ............................................................ 323 Field conversion .......................................... 733, 734 loop .............................................................. 669, 689 CLOSE_FORM .................................................... 648
maintain .............................................................. 321 Field exit ................................................................... 815 maintain elements .......................................... 659 CONVERSION_EXIT_MATN1_OUTPUT ... 669
managing via function modules ............... 320 Field help ........................................................ 478, 479 print ....................................................................... 648 create ........................................................... 251, 252
MESSAGE addition ........................................... 339 Field label ........................................................ 120, 381 program line ...................................................... 668 enhance interface ............................................ 837
passing messages ............................................. 335 Field symbol .................................................. 580, 587 SAP scripts ................................................. 633, 651 F4IF_SHLP_EXIT_EXAMPLE ........................ 400
raise .......................................... 321, 322, 325, 332 assign data object ............................................ 589 single-record node ........................................... 691 FP_JOB_CLOSE .................................................. 696
Exception class ...................................................... 330 assign internal table record ......................... 592 structure node ................................................... 689 function group .................................................. 250
define globally ................................................... 330 assignment check ............................................. 592 style ....................................................................... 670 modify .................................................................. 808
define locally ...................................................... 333 define ..................................................................... 588 table ....................................................................... 666 normal ................................................................. 254
function module ............................................... 332 dynamic field assignment ............................. 590 tab positions ...................................................... 650 OPEN_FORM ...................................................... 648
message ............................................................... 333 field position ....................................................... 591 template ............................................................... 663 Pattern button .................................................. 256
filter functionality ............................................ 588 text ......................................................................... 664 remote-enabled ................................................ 254

898 899
Index Index

Function module (Cont.) Help documentation ........................................... 120 Include text ............................................................. 664 Internal table (Cont.)
REUSE_ALV_HIERSEQ_LIST_DISPLAY ..... 559 Help view ........................................................ 368, 374 Index ................................................................ 344, 355 modifying records ........................................... 161
test in BTE ............................................................ 844 Hexadecimal data type ....................................... 107 unique and nonunique .................................. 356 processing data ................................................ 181
update module .................................................. 254 Hide area ................................................................... 511 Index access ............................................................ 148 reading data ...................................................... 159
Function module exit ............................... 815, 818 HIDE statement ...................................................... 511 Index table ............................................................... 152 small ..................................................................... 155
Function modules Hierarchical display ............................................. 543 INDX structure ....................................................... 433 sorted table ........................................................ 150
REUSE_ALV_FIELDCATALOG_MERGE ..... 550 Hierarchical sequential display ....................... 555 Information message .......................................... 205 usage .................................................................... 156
Function pool ......................................................... 215 field catalog ........................................................ 555 Inheritance ................................. 267, 270, 286, 833 work area ............................................................ 147
Hierarchical sequential list relationship ........................................................ 287 Internet Communication Framework
G example ................................................................ 558 Inheritance relationship .................................... 295 (ICF) ....................................................................... 766
Hierarchical sequential report ......................... 559 Inheritance tree ..................................................... 293 Internet Communication Manager
Garbage collector .................................................. 298 Hierarchical structure ......................................... 860 INITIALIZATION ..................................................... 497 (ICM) ....................................................... 48, 50, 766
Gateway ............................................................... 50, 53 High-priority update ............................................ 420 INITIALIZATION block ......................................... 225 Internet Communication Manager (ICM) ..... 50
General dynpro ............................................ 187, 188 Hint ............................................................................. 354 INITIALIZATION event ........................................ 234 Internet Demonstration and Evaluation
General screen ............................................. 239, 440 Hold data .................................................................. 450 INITIALIZATION reporting event ................... 232 System (IDES) ....................................................... 42
Generic type ............................................................ 243 Hook ........................................................................... 812 Injection ................................................................... 853 Internet Transaction Server (ITS) ...................... 48
GET Host variable ........................................................... 416 Inline declaration .............................. 125, 264, 415 INTO clause .................................................... 412, 416
BADI ....................................................................... 833 HTTP trace ................................................................ 872 assign value to data object .......................... 264 Invoice ...................................................................... 631
CURSOR ...................................................... 505, 515 avoid helper variables .................................... 265 iXML .......................................................................... 313
DATASET .............................................................. 430 I declare actual parameters ........................... 265 iXML library ................................................... 315, 317
SBOOK .................................................................. 236 table work area ................................................. 265
table ....................................................................... 234 I/O field ........................................................... 454, 460 Inner join ........................................................ 178, 179 J
\\u003ctable\\\> LATE .................................. 235 create/add ........................................................... 460 Input field ................................................................ 524
GET_SOURCE_position ...................................... 329 I/O fields ................................................................... 448 Input help ...................................................... 478, 479 JavaBeans ................................................................. 545
GetDetail( ) ............................................................... 717 IDoc Insertion anomaly ................................................ 172 JavaScript Object Notation (JSON) ................. 790
GetList( ) .................................................................... 717 assign basic types ............................................. 743 INSERT statement .............................. 156, 157, 168 Join .......................................................... 178, 367, 369
Getter method ....................................................... 282 attributes ............................................................. 750 inserting a single row ..................................... 413 conditions ........................................................... 369
Global class .............................................................. 258 create basic type ............................................... 740 inserting multiple rows .................................. 413 JSON
Global declaration ......................................... 98, 218 create logical type ............................................ 743 SY-DBCNT ............................................................ 412 transformation ................................................. 792
Global table type ................................................... 248 create segment .................................................. 738 SY-SUBRC ............................................................. 412
Graphic development and tools .................................. 738 Instance component ........................................... 274 K
element ................................................................ 661 EDI .......................................................................... 729 Instantiation operation ...................................... 597
node ....................................................................... 686 inbound program ................................... 751, 752 int8 ................................................................... 104, 105 Key access ................................................................ 148
Graphical layout editor ............................ 452, 467 master IDoc ......................................................... 733 Integrated development environment Keyword .......................................................... 101, 102
Grid display ............................................................. 542 outbound program ................................ 753, 754 (IDE) .......................................................................... 71 access .................................................................... 103
GROUP BY clause .................................................. 409 record .................................................................... 730 Interactive report ........................................ 511, 559 TYPES .................................................................... 139
GTT .............................................................................. 353 status code .......................................................... 752 custom GUI status ........................................... 560
GUI_DOWNLOAD ................................................. 431 structure ............................................................... 736 TOP-OF-PAGE ..................................................... 565 L
GUI_UPLOAD ......................................................... 431 system configuration ...................................... 744 user action .......................................................... 564
GUI status .......................... 443, 444, 474, 506, 561 IDocs ........................................................................... 734 Interface .................................................................... 699 Languages ................................................................... 55
activate and load ............................................. 475 IF_MESSAGE ............................................................ 327 INTERFACE .......................................................... 305 Lazy update ............................................................. 155
create .................................................................... 474 GET_LONGTEXT ................................................ 327 PUBLIC SECTION ............................................... 306 LEAVE SCREEN statement ................................. 480
maintain .............................................................. 474 GET_TEXT ............................................................ 327 Interface pool ......................................................... 494 LEAVE TO LIST-PROCESSING statement ..... 510
GUI title ..................................................................... 476 Implementation ...................................................... 47 Interface program .................................................... 40 LEAVE TO SCREEN statement .......................... 480
Implementation hiding ...................................... 283 Interface work area .............................................. 234 Legacy System Migration Workbench
H Implicit enhancement ........................................ 837 Intermediate Document (IDoc) ....................... 727 (LSMW) .......................................................... 41, 700
IMPORT/EXPORT statement ............................. 500 Internal table ............................. 135, 146, 149, 248 LFGRPF01 ................................................................. 252
Hash algorithm ...................................................... 151 Inbound interface ......................................... 40, 429 APPEND ................................................................ 156 LIKE
Hashed table ........................................................... 151 Inbound process code ......................................... 749 COLLECT statement ......................................... 158 vs. TYPE ................................................................ 192
secondary key .................................................... 154 Inbound program .................................................. 751 define .................................................................... 146 LIKE addition .......................................................... 248
Hash key ......................................................... 153, 155 Include program ....................... 129, 215, 216, 495 hashed table ....................................................... 151 Line type .................................................................. 146
HAVING clause ...................................................... 409 Include structure ................................................... 364 INSERT .................................................................. 156 List display .............................................................. 542

900 901
Index Index

List dynpro .............................................................. 188 Memory ........................................................... 498, 500 Methods .......................................................... 226, 271 New Debugger (Cont.)
List event ............................................... 238, 239, 502 allocation ............................................................. 383 maintain code ................................................... 262 tools ...................................................................... 623
type ........................................................................ 502 analysis ....................................................... 866, 867 MIN ............................................................................. 411 UI ............................................................................ 623
List screen ................................... 132, 238, 440, 491 storage .................................................................. 501 Minimum ................................................................. 411 New project ................................................................ 36
list event .............................................................. 502 unit ......................................................................... 123 Mock object ................................................... 852, 853 NODE keyword ...................................................... 235
practice ................................................................. 516 Memory Inspector ...................................... 848, 866 Modification ................................... 36, 37, 801, 803 Noncatchable exception ................................... 326
program type ..................................................... 491 compare memory snapshots ....................... 868 program ............................................................... 804 Nonnumeric data types ..................................... 109
List system ............................................................... 509 memory snapshot ............................................ 867 registration ......................................................... 804 Nontransportable package .................................. 65
Literals ....................................................................... 124 Memory snapshot Modification Assistant ....................................... 803 Nonunique index ................................................. 356
Local declaration ............................................ 98, 218 compare ............................................................... 868 ABAP Data Dictionary ................................... 808 Normal function module .................................. 254
Local exception class ........................................... 333 steps ....................................................................... 867 Class Builder ....................................................... 805 Normalization ....................................................... 172
Local object ................................................................. 65 Memory snapshots ............................................... 867 function module ............................................... 808 Numeric data type ...................................... 107, 109
Local structure ....................................................... 136 Menu bar .................................................................. 444 insert ..................................................................... 805 Numeric literal ...................................................... 124
Lock object .............................................. 88, 400, 434 Menu exit ....................................................... 815, 820 modification ...................................................... 808
code example ..................................................... 403 Menu Painter ............................. 71, 74, 85, 86, 439 program ............................................................... 804 O
create .................................................................... 400 custom GUI status ............................................ 561 replace .................................................................. 805
function module ............................................... 402 GUI status ............................................................ 444 reset original ...................................................... 809 Object ........................................................................ 277
maintain .............................................................. 400 load custom GUI status ................................. 561 Screen Painter .................................................... 807 Object Navigator .... 65, 71, 80, 88, 443, 775, 824
Logical database .................................................... 234 modification ....................................................... 808 Modification Browser ............................... 803, 810 ABAP messaging channel ............................. 794
Logical expression ................................................ 412 screen elements ................................................. 443 reset to original ................................................. 809 create screen ...................................................... 448
Logical message type ................................. 738, 743 Message ........................................................... 204, 285 MODIFY ..................................................................... 161 create transaction ........................................... 480
Logical unit of work (LUW) ............. 250, 406, 419 assigning attributes ........................................ 338 Modularization ...................................................... 213 form interface ................................................... 678
LOOP ....................................................... 147, 159, 473 dynamic ................................................................ 209 benefits ................................................................. 214 module pool ....................................................... 493
LOOP AT SCREEN .................................................. 537 maintenance ...................................................... 207 include programs and macros .................... 215 navigation and tool areas .............................. 88
Loop node ................................................................ 669 message class ..................................................... 207 local declaration ................................................. 98 web service consumer .................................... 771
LOOP statement .................................................... 161 placeholder ......................................................... 210 processing block ............................................... 213 Object-oriented programming .............. 215, 267
Low-priority update ............................................. 420 statement ............................................................. 204 Modularization statement ................................ 127 basics .................................................................... 267
LSMW ......................................................................... 754 tab ........................................................................... 207 MODULE ................................................................... 472 Object palette ......................................................... 692
field mapping .................................................... 761 text symbol ......................................................... 206 statement ............................................................ 451 Objects ...................................................................... 271
getting started ................................................... 755 translation .......................................................... 210 Module pool ............ 129, 187, 215, 239, 493, 521 Object view ............................................................. 620
object attribute ................................................. 756 type ......................................................................... 205 flow ........................................................................ 497 OData ............................................................... 700, 777
process steps ...................................................... 756 Message class .......................................................... 207 Modules ....................................................................... 33 data model definition .................................... 779
recording ............................................................. 757 IF_T100_DYN_MSG ......................................... 339 Multiline comment .............................................. 102 READ ..................................................................... 786
reusable rules ..................................................... 761 IF_T100_MESSAGE ........................................... 337 Multiple selection window ............................... 197 service creation ................................................ 778
source structure ................................................ 759 maintaining messages ................................... 208 tabs ........................................................................ 200 service implementation ................................ 784
LZCB_FGTOP ........................................................... 252 MSGTY ................................................................... 339 service maintenance ...................................... 782
LZCB_FGUXX .......................................................... 252 TYPE addition ..................................................... 339 N ON COMMIT ........................................................... 422
using messages .................................................. 337 One-to-many relationship ................................ 171
M WITH addition ................................................... 339 Named data object ............................................... 597 One-to-one relationship .................................... 171
Message server ........................................... 49, 50, 53 Narrow cast Online Text Repository (OTR) ......................... 334
Macro ......................................................................... 216 Metadata ................................................................... 341 child->meth3 ...................................................... 299 OPEN_FORM .......................................................... 647
Main program group ........................................... 498 Method ......................................... 215, 242, 258, 274 parent->meth1 ................................................... 299 Open Data Protocol (OData) ............................ 777
Maintenance view ................... 357, 359, 368, 372 abstract ................................................................ 291 parent->meth2 .................................................. 299 OPEN DATASET ..................................................... 429
create .................................................................... 372 calling .................................................................... 262 parent->meth3 .................................................. 299 Open Specification Promise (OSP) ................ 777
maintenance status ........................................ 373 cl_notification_api .......................................... 284 Native SQL ..................................... 87, 167, 406, 875 Open SQL .............................. 86, 136, 167, 436, 874
options ................................................................. 373 class ........................................................................ 258 GTT ......................................................................... 346 database .............................................................. 168
view key ............................................................... 372 create ..................................................................... 258 Nested structure .................................................... 137 database relationship .................................... 171
Main window ................................................ 636, 656 create global classes ........................................ 258 type ........................................................................ 141 data in a database .......................................... 407
Many-to-many relationship ............................. 172 functional method ........................................... 276 New Debugger ........................... 183, 611, 623, 866 DDL ........................................................................ 168
MAX ............................................................................ 411 me ........................................................................... 276 layout .................................................................... 625 DELETE statement ........................................... 414
Maximum ................................................................ 411 set_message ....................................................... 284 Memory Inspector ........................................... 867 DML .............................................................. 168, 407
static ...................................................................... 262 session .................................................................. 625 GTT ........................................................................ 346

902 903
Index Index

Open SQL (Cont.) Persistent attribute .............................................. 423 Processing block (Cont.) Range field ............................................................... 197
INSERT statement ............................................ 412 Persistent class ....................................................... 423 ending ................................................................... 220 Range table .............................................................. 195
logical database ............................................... 234 Class Builder ....................................................... 426 EXIT ........................................................................ 220 HIGH ..................................................................... 196
MODIFY statement ................................ 414, 421 create ..................................................................... 424 procedure ............................................................ 214 LOW ....................................................................... 196
persistent data ........................................ 405, 407 mapping tool ...................................................... 426 RETURN ................................................................ 222 OPTION ................................................................ 196
selecting data from database tables ........ 176 Persistent data ................................................ 97, 405 sequence .................................................... 219, 228 SIGN ...................................................................... 196
selecting data from multiple tables .......... 178 security ................................................................. 434 type ........................................................................ 226 values ................................................................... 199
SELECT statement ............................................ 408 storage .................................................................. 405 types ...................................................................... 214 READ ....................................................... 147, 154, 159
statements .......................................................... 408 Persistent object .......................................... 423, 427 usage ..................................................................... 223 DATASET ............................................................. 430
UPDATE statement .......................................... 413 working with ...................................................... 427 virtual (global data declaration) ............... 223 statement ............................................................ 160
Operand .................................................................... 100 Persistent program ............................................... 609 Process interfaces ................................................. 840 READ CURRENT LINE statement .................... 515
Operational statement ....................................... 127 Picture control .............................................. 483, 484 Process on help request (POH) ..... 240, 442, 478 READ LINE statement ......................................... 515
Optimistic lock ....................................................... 402 Placeholder .............................................................. 210 Process on value request (POV) ........... 240, 442, Receiver .................................................................... 732
Oracle ......................................................................... 355 Polymorphism ................................... 267, 270, 296 478, 497 Receiver determination ..................................... 732
ORDER BY clause ................................................... 409 casting ................................................................... 298 Production client (PROD) ..................................... 63 Recording routine ................................................ 358
Outbound interface ...................................... 40, 429 dynamic type ...................................................... 296 Production support ................................................ 36 Reference data type .......................... 114, 378, 385
Outbound process code ..................................... 748 static type ............................................................ 296 Program Referenced data type .......................................... 382
Outbound program ............................................. 753 Pooled table ............................................................. 345 RMVKON00 ........................................................ 527 Reference variable ....................................... 277, 594
Outer join ................................................................. 179 Port definition ........................................................ 746 zdemo_prg .......................................................... 538 upcast and downcast ..................................... 598
Output length ......................................................... 116 Predefined elementary ABAP type ................. 108 Program attributes ..................................... 128, 491 Reference variables
Output table ............................................................ 542 Predefined elementary data type ................... 104 maintain .............................................................. 130 assignment ......................................................... 598
use case ................................................................. 109 Program constructor ........................................... 231 Relational database ............................................. 406
P Predefined nonnumeric elementary Program execution .............................................. 495 Relational database management system
data type .............................................................. 105 Program group ....................................................... 498 (RDBMS) ....................................... 47, 55, 167, 168
Package ........................................................................ 64 Predefined nonnumeric elementary data type Program line element ............................... 668, 669 example .................................................................. 55
assign .................................................................... 131 category ............................................................... 107 Programming concepts ......................................... 97 foreign key ................................................... 47, 170
create ....................................................................... 68 Predefined numeric elementary data Program type .......................................................... 491 primary key ........................................................ 169
naming conventions .......................................... 66 type ........................................................................ 105 Projection view ............................................ 368, 370 relational database design .......................... 169
nontransportable ................................................ 65 Predefined type ...................................................... 385 create .................................................................... 370 table ...................................................................... 169
transportable ........................................................ 64 Presentation layer .................. 45, 46, 70, 217, 447 Promote optimistic lock .................................... 402 Remote-enabled function module ................ 254
Package Builder ........................................................ 68 file ........................................................................... 431 Pseudocomment ................................................... 862 Remove\\u003csubobject\\\>() ..................... 717
Packages GUI_DOWNLOAD ............................................. 431 Publish and subscribe interfaces .................... 840 Replacement object ............................................. 377
encapsulation ....................................................... 69 GUI_UPLOAD ..................................................... 431 Pure Java system ...................................................... 49 Report ....................................................................... 496
Parallelism ............................................................... 175 SAP GUI ................................................................... 47 Push button .................................................. 454, 459 background execution .................................. 535
PARAMETERS ............................. 125, 132, 189, 211 Presentation server .............................................. 405 form ...................................................................... 631
SCREEN_OPTIONS ............................................ 192 Primary index ......................................................... 353 Q program ................................................................. 39
VALUE_OPTIONS ............................................. 195 Primary key ......................................... 170, 385, 406 run in background .......................................... 534
PARAMETERS keyword ....................................... 189 Procedural area ........................................................ 99 Quality assurance ................................................. 847 scheduling .......................................................... 535
TYPE_OPTIONS ................................................. 190 Procedural exception .......................................... 320 Quality assurance client (QTST) ......................... 63 Reporting event .................................................... 232
PARAMETERS statement Procedural programming .................................... 97 Quantity field ......................................................... 349 END-OF-SELECTION ........................................ 236
effect ...................................................................... 190 Procedure .......................... 214, 217, 226, 231, 240 GET table ............................................................. 234
Parameter table ........................................... 607, 608 Process after input (PAI) .......................... 240, 442, R GET \\u003ctable\\\> LATE ........................ 235
Partner profile ........................................................ 747 445, 459, 466, 472 INITIALIZATION ............................................... 232
PC editor ................................................................... 664 Process analysis ........................................... 848, 864 R_ER ........................................................................... 328 START-OF-SELECTION .................................... 233
PDF .............................................................................. 563 Process before output (PBO) .................. 240, 442, Radio button ........................................ 194, 454, 457 Reporting transaction ........................................ 481
PERFORM ....................................................... 234, 812 446, 477, 485 group ..................................................................... 194 Report output
keyword ............................................................... 226 selection screen ................................................. 521 RAISE .......................................................................... 255 type ........................................................................ 542
statement .................................................. 215, 225 Processing block .................................. 99, 127, 213, EVENT ................................................................... 313 Report transaction ............................................... 493
Performance trace ...................................... 848, 871 217, 225, 492, 493 EXCEPTION ......................................................... 325 Repository .................................................................. 64
with filter ............................................................. 872 calling .................................................................... 219 statement ............................................................ 321 object ................................................................ 36, 70
Persistence mapping ........................................... 424 CHECK ................................................................... 221 Range ......................................................................... 198 package .................................................................. 64
Persistence service ............................................... 423 dynpro ................................................................... 187 operator ............................................................... 199 Repository Browser ................................................ 82

904 905
Index Index

Representational State Transfer (REST) ....... 777 SAP GUI (Cont.) SAP scripts (Cont.) Screen (Cont.)
Request ........................................................................ 65 for the Java environment ................................ 48 create form layout ........................................... 636 sequence .............................................................. 479
REQUEST_LOC ........................................................ 403 for the Windows environment ...................... 48 create standard text ....................................... 646 standard toolbar ................................................. 74
Request-response cycle ...................................... 447 set status .............................................................. 562 create window ................................................... 639 status bar ............................................................... 75
RESTful APIs ............................................................ 777 SAP HANA ..................... 47, 55, 169, 175, 368, 627 disadvantages ................................................... 654 title bar ................................................................... 74
RETCODE .................................................................. 324 ABAP CDS view .................................................. 175 driver program ............................... 635, 652, 675 transaction code ................................................. 75
RETURN ..................................................................... 222 aggregate functions ........................................ 410 element ................................................................ 648 type ........................................................................ 450
statement ............................................................ 220 code pushdown ................................................. 175 field entries ......................................................... 643 SCREEN_OPTIONS ................................................ 192
Returning parameter .......................................... 261 parallelism .......................................................... 175 formatting .......................................................... 636 AS CHECKBOX ................................................... 193
REUSE_ALV_BLOCK_LIST_APPEND .............. 552 SAP Interactive Forms by Adobe ........... 631, 677 graphics administration ............................... 642 AS LISTBOX VISIBLE LENGTH vlen ............ 194
REUSE_ALV_BLOCK_LIST_INIT ....................... 552 address node ...................................................... 688 insert graphic ..................................................... 644 RADIOBUTTON GROUP ................................. 194
REUSE_ALV* ............................................................ 542 alternative node ................................................ 691 layout .................................................................... 633 VISIBLE LENGTH vlen ..................................... 193
RFC ............................................................. 53, 231, 250 context and layout .......................................... 684 layout designer ................................................. 638 Screen element ................ 439, 443, 444, 452, 454
destination ......................................................... 745 Context tab ......................................................... 685 maintain tab positions .................................. 649 basic ...................................................................... 455
trace .................................................... 849, 871, 876 currency/quantity fields ................................ 683 maintain window details .............................. 642 Screen field ............................................................. 448
RFC/BOR interface ................................................ 780 data node ............................................................. 690 paragraph and character formatting ...... 640 modifying dynamically ................................. 476
ROLLBACK WORK ....................................... 418, 420 development ....................................................... 678 printing ................................................................ 648 Screen flow logic ... 441–443, 445, 447, 472, 807
Row type ................................................................... 149 download as PDF .............................................. 696 print logo ............................................................. 642 SCREEN-OPTIONS
Runtime Analysis ....................................... 849, 879 driver program ........................................ 695, 696 process forms with function modules ..... 647 NO-DISPLAY ....................................................... 193
Runtime analysis .................................................. 407 form interface .................................................... 678 return_code ........................................................ 652 OBLIGATORY ..................................................... 193
Runtime error ........................................................ 111 global definitions .............................................. 682 subroutine ........................................................... 635 Screen Painter ...................... 71, 83, 204, 439, 450,
Runtime Type Creation (RTTC) .............. 599, 601 graphic node ....................................................... 686 us_screen ............................................................. 652 483, 489
dynamic ............................................................... 603 import form data .............................................. 697 window ................................................................. 636 alphanumeric layout editor ........................ 452
Runtime Type Information (RTTI) ....... 599, 600 layout .................................................................... 692 SAP Software Change Registration (SSCR) ..... 803 dynpro .................................................................. 187
query ..................................................................... 601 Layout tab ........................................................... 691 SAP start service ............................................... 50, 53 graphical layout editor ................. 85, 452, 456
Runtime Type Services (RTTS) ............... 580, 599 loop ........................................................................ 689 SAP Support Portal ............................................... 803 modification ...................................................... 807
object palette ...................................................... 692 SAP system module pool ....................................................... 494
S single-record node ............................................ 691 architecture ........................................................... 45 screen elements ................................................ 443
structure node .................................................... 689 enqueue server ..................................................... 53 subscreens .......................................................... 470
Sales and Distribution (SD) ............................... 813 SAP List Viewer (ALV) ........................................... 541 environment ......................................................... 71 tab ................................................................... 84, 452
SAP SAP liveCache ............................................................ 55 gateway .................................................................. 53 Screen structure .................................................... 476
data structure ....................................................... 36 SAP LUW ................................................ 417, 419, 436 instance ................................................................... 50 components .............................................. 477, 536
functional module .............................................. 33 bundle with function modules .................... 420 layers ........................................................................ 56 Search help ........................................... 120, 380, 392
introduction .......................................................... 33 bundle with RFC ................................................ 422 logon ........................................................................ 72 assign ................................................................... 399
module .................................................................... 33 bundle with subroutines ................................ 422 message server ..................................................... 53 change .................................................................. 397
systems .................................................................... 36 bundling technique .......................................... 419 SAP Web Dispatcher ........................................... 53 exit ......................................................................... 400
technical module ................................................. 34 dialog step ........................................................... 419 session ..................................................................... 76 parameters ......................................................... 396
users ......................................................................... 34 SAP NetWeaver ............................................... 49, 276 user context ........................................................... 54 Secondary index .......................................... 354, 357
SAP Business Technology Platform ................. 94 SAP NetWeaver 7.5 ........................................ 33, 746 SAPUI5 ....................................................................... 872 create .................................................................... 355
SAP Easy Access ........................................................ 76 debugging ............................................................ 611 SAP Web Dispatcher ....................................... 50, 53 Secondary key .................. 153, 169, 385, 387, 406
Favorites ................................................................. 73 global temporary table .................................. 345 Schema ...................................................................... 168 Secondary list ......................................................... 509
SAP Menu ............................................................... 73 new SQL ................................................................ 415 Screen .............................................................. 444, 448 Secondary window .............................................. 656
screen ....................................................................... 73 SAP Notes ................................................................. 802 application toolbar ............................................ 75 Second normal form (2NF) ............................... 173
User Menu .............................................................. 73 SAP S/4HANA Cloud .............................................. 94 attributes ................................................... 449, 450 Security .................................................................... 434
SAP ERP .............................................................. 27, 822 SAP S/4HANA Cloud, ABAP Environment .... 94 command field ..................................................... 75 Segment ................................................................... 736
SAP Gateway ........................................................... 777 SAP script editor ................................ 642, 645, 664 create .................................................................... 448 add ......................................................................... 741
activate/register an OData service ........... 782 printing ................................................................. 645 event ................................................... 239, 440, 441 create .................................................................... 738
READ ..................................................................... 786 SAP scripts ...................................................... 631, 633 exit ............................................................... 815, 818 definition ............................................................ 739
Service Builder ................................................... 778 align and print ................................................... 649 group ..................................................................... 451 Segment Editor ............................................. 738, 740
SAP GUI ................................................ 46, 47, 71, 217 billing document ............................................... 633 menu bar ................................................................ 74 Segment filtering ................................................. 734
architecture ........................................................... 49 change header ................................................... 637 number ................................................................. 448 SELECT .............................................................. 157, 168
for HTML (Web GUI) ........................................... 48 composer ............................................................. 633 processor ............................................................. 441

906 907
Index Index

Select Setter method ......................................................... 282 SQL trace ...................................... 407, 848, 871, 874 Subscreen ....................................................... 470, 521
range ..................................................................... 198 set_message ....................................................... 284 display .................................................................. 875 Subscreen area ....................................................... 455
single values ....................................................... 198 Shared lock (read lock) ........................................ 401 use case ................................................................ 875 SUM ............................................................................ 411
SELECT clause ......................................................... 409 Simple Object Access Protocol (SOAP) .......... 766 views ...................................................................... 876 Superclass ....................................................... 286, 331
SELECTION-SCREEN ................................... 188, 202 Simple report .......................................................... 543 Standardized BAPI ...................................... 716, 717 Switch Framework ............................... 29, 813, 835
BEGIN OF BLOCK .............................................. 203 field catalog ........................................................ 548 Standard report ..................................................... 542 SY-DBCNT ................................................................ 412
SKIP ........................................................................ 202 Single inheritance ................................................. 304 Standard selection screen ................................. 188 Synchronous data update ................................. 707
ULINE .................................................................... 203 Single-record node ............................................... 691 Standard table .............................................. 149, 151 Syntax .......................................................................... 99
Selection screen ........................ 132, 187, 440, 519 Singleton design pattern .................................... 427 secondary key .................................................... 153 chained statement .......................................... 101
calling programs .............................................. 538 Single-transaction analysis ..................... 849, 883 Standard toolbar ................................................... 444 comment line .................................................... 102
create variant .................................................... 526 Size category ........................................................... 351 START-OF-SELECTION ......................................... 223 rules ....................................................................... 100
define .......................................................... 519, 520 SKIP ............................................................................. 239 START-OF-SELECTION block ............................. 225 System field ............................................................ 157
dynamically display/hide screen Smart form ........................................... 631, 679, 686 START-OF-SELECTION reporting event ........ 233 SY-SUBRC ........................................................ 324, 412
element ............................................................ 536 address .................................................................. 662 Statement
dynamic date ..................................................... 532 advantages over SAP scripts ........................ 654 UNION .................................................................. 176 T
dynamic time ..................................................... 533 character formatting ...................................... 673 Static boxes ............................................................. 383
event ............................................................ 519, 521 command ............................................................ 669 Static component ................................................. 274 Table ............................................................................. 87
field ........................................................................ 188 create template ................................................. 663 Static enhancement point ................................. 835 cells ........................................................................ 667
PARAMETERS ..................................................... 189 create text element .......................................... 665 Status message ...................................................... 205 EDID4 .................................................................... 736
radio button ....................................................... 524 draft page ............................................................ 656 Status record ........................................................... 730 EDIDC ................................................................... 736
standard .............................................................. 520 driver program ........................................ 674, 676 Status type ............................................................... 474 EDIDS .................................................................... 737
task ........................................................................ 188 form attributes ........................................ 656, 657 Strict mode .............................................................. 416 field ........................................................................ 371
user-defined ........................................................ 520 form interface .......................................... 656, 658 STRING ............................................................ 108, 110 ICON ......................................................................... 75
user-specific variable ...................................... 534 Form Painter ....................................................... 656 String literal ............................................................ 125 INDX ..................................................................... 433
variant .................................................................. 525 global definition ..................................... 656, 659 Structure ......................................................... 135, 382 IT_SFLIGHT ........................................................ 162
variant attributes ............................................. 529 graphics ................................................................ 661 create global structure ................................... 142 IT_VBRP ............................................................... 165
Selection screen event ........................................ 238 interface ............................................................... 680 define .................................................................... 138 line ......................................................................... 667
Selection screens layout .................................................................... 654 global .................................................................... 137 MAKT ............................................................. 56, 343
standard .............................................................. 520 line type ................................................................ 666 global structure ................................................ 141 MARA ............................................. 56, 62, 362, 397
Selection text .......................................................... 203 loop ........................................................................ 669 local structure ................................................... 138 MARC ............................................................. 56, 182
Selectivity analysis ..................................... 848, 862 maintain elements ........................................... 659 processing data ................................................. 181 NAST ..................................................................... 653
SELECT-OPTIONS ...................... 165, 195, 201, 211 maintain global settings ............................... 657 type ........................................................................ 137 PTAB ...................................................................... 608
multiple selection window ........................... 197 maintenance area ............................................ 655 usage ..................................................................... 144 SAPLANE ............................................................. 361
SELECT statement ................................................. 408 navigation area ................................................. 655 use case ................................................................ 145 SBOOK .................................................................. 236
FROM clause ...................................................... 411 paragraph formatting .................................... 671 Structured Query Language (SQL) .................. 167 SFLIGHT ......................... 138, 140, 361, 507, 577
INTO clause ........................................................ 412 program line ....................................................... 668 Structure node ....................................................... 689 SPFLI ................................................... 354, 409, 507
SELECT clause .................................................... 409 row type ................................................................ 666 Structures ................................................................. 136 T001W .................................................................. 183
WHERE clause .................................................... 412 style .................................................... 670, 671, 674 Structure type .............................................. 135, 140 T100 ...................................................................... 207
Semantic attribute ..................................... 378, 381 table ....................................................................... 666 Subclass .......................................................... 280, 286 TVARVC ............................................................... 530
Separation of concerns ....................................... 852 text ......................................................................... 664 SUBMIT (dobj) ........................................................ 605 VBLOG .................................................................. 422
Sequential data ...................................................... 138 windows ..................................................... 656, 660 Subproject ................................................................ 755 VBRK ......................................... 165, 376, 514, 633
Serialization ............................................................ 734 Smart forms ................................................... 654, 678 Subroutine ......................... 215, 226, 241, 242, 359 VBRP .................................................. 144, 165, 633
Service implementation .......................... 778, 784 SOAP ................................................................. 766, 771 error handling ................................................... 324 table_line ................................................................. 154
Service maintenance ................................. 778, 782 Sorted key ................................................................. 153 input parameters that pass values ........... 246 Table buffer trace ................................................. 849
SESSION .......................................................... 707, 711 Sorted table .................................................... 150, 151 local declaration .............................................. 137 Table call statistics ...................................... 848, 869
create manually ................................................ 712 secondary key .................................................... 154 output parameters that pass values ........ 247 screen ................................................................... 870
Session ............................................................... 76, 625 Special dynpro ........................................................ 187 parameters passed by reference ................ 245 Table category ........................................................ 149
component ......................................................... 626 Special screen .......................................................... 239 passing internal tables ................................... 247 Table control ................................................. 454, 462
Session breakpoint ............................................... 613 Splitter containers ................................................ 484 passing parameters ......................................... 244 attributes ............................................................ 464
SET DATASET .......................................................... 430 SQL .............................................................................. 167 SAP LUW .............................................................. 422 create .................................................................... 463
SET HANDLER ......................................................... 311 SQL optimizer ......................................................... 354 USING and CHANGING .................................. 242 create without wizard ................................... 463
SET SCREEN statement ....................................... 479 SQLScript .................................................................. 627 Subroutine pool .......................................... 495, 498 create with wizard ........................................... 467

908 909
Index Index

Table display ........................................................... 569 TOP-OF-PAGE list event ...................................... 502 Transaction (Cont.) Transaction (Cont.)
Table element ......................................................... 666 Total ............................................................................ 411 SE03 .......................................................................... 66 WE41 ...................................................................... 748
areas ...................................................................... 666 Transaction ................................................................ 75 SE09 .......................................................................... 66 WE42 ............................................................ 749, 751
table line .............................................................. 667 /*xxxx ...................................................................... 78 SE10 ........................................................................... 66 WE81 ............................................................. 738, 743
Table field ................................................................. 344 /h ............................................................................... 79 SE11 .................. 78, 117, 138, 142, 249, 341, 495 WE82 ............................................................ 738, 743
Table key ......................................................... 152, 159 /i ................................................................................ 78 SE13 ........................................................................ 351 Transactional RFC (tRFC) ................................... 746
default key .......................................................... 152 /IWFND/GW_CLIENT ............................ 784, 787 SE18 .............................................................. 823, 824 Transaction Recorder ......................................... 708
hash key ............................................................... 153 /IWFND/MAINT_SERVICE ............................. 782 SE19 .............................................................. 823, 830 create program from recording ................. 710
secondary key .......................................... 153, 155 /N .............................................................................. 78 SE21 ........................................................................... 68 update mode ..................................................... 708
sorted key ............................................................ 153 /n ............................................................................... 78 SE24 .................................... 83, 258, 309, 331, 853 TRANSFER ................................................................ 429
Table keyword ........................................................ 235 /nend ....................................................................... 78 SE37 .................................... 82, 215, 250, 494, 543 Transient data ........................................................... 97
Table maintenance generator ............... 357, 358 /nex .......................................................................... 79 SE38 .............................................. 80, 128, 493, 612 Transient program ............................................... 609
Table Painter ........................................................... 655 /ns000 .................................................................... 78 SE41 ....................................................... 74, 443, 561 Translation .............................................................. 210
Table type ................................................................. 384 /nxxxx ..................................................................... 78 SE51 ........................................................................ 443 Transportable package .......................................... 64
global .................................................................... 248 /O .............................................................................. 78 SE71 ..................................................... 633, 635, 636 TRANSPORTING addition ................................. 161
line type ............................................................... 384 /o ............................................................................... 78 SE78 ........................................................................ 642 Transport Organizer ........................................ 65, 66
Table types /oxxxx ..................................................................... 78 SE80 ................................. 65, 80, 82, 83, 443, 824 trigger_event ......................................................... 313
primary key ........................................................ 386 ABAPDOCU ......................................................... 330 SE91 ........................................................................ 207 Troubleshooting .......................................... 627, 628
Table view maintenance .................................... 346 assign .................................................................... 480 SE93 ................................................ 65, 75, 443, 447 TRUNCATE DATASET .......................................... 430
Tabstrip control ........................................... 454, 468 BAPI ........................................................................ 714 SE95 .............................................................. 809, 810 TRY block ................................................................. 325
create .................................................................... 469 BD51 ........................................................................ 750 SEGW ........................................................... 778, 779 Two-dimensional array ...................................... 146
wizard ................................................................... 469 BMV0 ..................................................................... 702 SHDB ..................................................................... 708 TYPE .................................................................. 103, 191
Tag ............................................................................... 313 CMOD .......................................................... 816, 818 SICF ........................................................................ 767 c .............................................................................. 112
Task ................................................................................ 65 code ........................................................................ 446 SLDB ...................................................................... 130 concept ......................................................... 97, 103
Technical consultant .............................................. 34 create ..................................................................... 480 SM35 ...................................................................... 712 d .............................................................................. 113
Template .................................................................. 663 custom namespace .......................................... 482 SM37 ...................................................................... 863 f ............................................................................... 109
create .................................................................... 663 DB05 ............................................................ 848, 862 SM50 ........................................... 52, 848, 864, 866 i ............................................................................... 109
Termination message ......................................... 205 FIBF ......................................................................... 841 SM59 ...................................................................... 745 n .............................................................................. 110
Test class ................................................................... 853 FILE ......................................................................... 430 SM66 .................................................. 848, 864, 866 p .............................................................................. 109
define .......................................................... 853, 855 FK02 ....................................................................... 844 SMARTFORMS ................................ 654, 657, 670 vs. LIKE ................................................................. 192
fixture ................................................................... 853 LSMW ..................................................................... 755 SMOD .......................................................... 815, 819 TYPE_OPTIONS ...................................................... 190
implementation ................................................ 857 ME21N ............................................................ 76, 819 SNOTE ................................................................... 802 LIKE (name) ........................................................ 192
properties ............................................................ 853 ME21n .................................................................... 497 SO10 ....................................................................... 646 LIKE dobj ............................................................. 191
Testing ....................................................................... 847 ME22N ..................................................................... 76 SOAMANAGER ........................................ 769, 773 TYPE data_type [DECIMALS dec] .............. 191
results ................................................................... 859 ME23N ..................................................................... 76 SPACKAGE .............................................................. 68 Type class ................................................................. 600
Text MM01 ......................................... 76, 701, 703, 758 SPAU ...................................................................... 803 Type conversion .......................................... 110, 112
element ................................................................ 664 MM02 ...................................................................... 76 SPDD ...................................................................... 803 with invalid content ....................................... 111
module ................................................................. 664 MM03 ...................................................................... 76 ST05 .......................................... 407, 848, 872, 883 with valid content ........................................... 111
node ....................................................................... 690 MRKO ................................................ 496, 527, 528 ST10 .............................................................. 848, 869 Typed formal parameter ................................... 243
Text field .................................................................. 454 NACE ............................................................ 652, 696 ST12 .............................................................. 883, 885 Type group .............................................................. 388
create .................................................................... 456 navigating and opening .................................. 76 ST22 ........................................................................ 886 data type ............................................................. 388
Text field literal ..................................................... 125 opening ................................................................... 78 STMS ......................................................................... 66 Type object .............................................................. 600
Text literal ................................................................ 206 RZ10 .......................................................................... 53 STVARV ...................................................... 530, 532 Type pool ................................................................. 495
Text symbol .................................................. 126, 206 S_MEMORY_INSPECT ..................................... 866 SU3 ......................................................................... 534 TYPE-POOLS ............................................................ 389
change .................................................................. 206 S_MEMORY_INSPECTOR ..................... 848, 868 SWO1 ............................................................ 719, 726 TYPE RANGE OF ..................................................... 196
Third normal form (3NF) ................................... 174 SA38 .............................................................. 496, 534 VA01 ...................................................................... 497
Three-tier architecture .................................. 27, 45 SAMC ..................................................................... 794 VF01 ................................................................ 76, 446 U
application layer ................................................. 46 SAP Easy Access screen ..................................... 78 VF02 ......................................................................... 76
buffer ........................................................................ 57 SAT ...................................................... 407, 849, 879 VF03 ................................................................ 76, 440 ULINE ................................................................ 239, 502
database layer ...................................................... 47 SAUNIT_CLIENT_SETUP ................................ 853 WE20 ..................................................................... 747 UNASSIGN ............................................................... 593
presentation layer .............................................. 46 SCC4 ......................................................................... 64 WE21 ...................................................................... 746 Uncomment ........................................................... 102
TOP-OF-PAGE ......................................................... 565 SCII .......................................................................... 860 WE30 ..................................................................... 740 Undelete( ) ............................................................... 717
TOP-OF-PAGE event ............................................. 503 SE01 .......................................................................... 66 WE31 ...................................................................... 738 Unique index ......................................................... 356

910 911
Index

Unit test .................................................................... 850 View (Cont.)


write and implement ...................................... 853 type ......................................................................... 368
Universal Description, Discovery, and Virtual processing block ..................................... 223
Integration (UDDI) .......................................... 766 Visibility .................................................................... 136
Unnamed data object .......................................... 124 Visibility section .................................................... 280
Upcasting ....................................................... 598, 599 PRIVATE ................................................................ 280
UPDATE ..................................................................... 168 PROTECTED ......................................................... 280
Update anomaly .................................................... 172 PUBLIC .................................................................. 280
Update function module ................................... 420
attributes ............................................................. 420 W
Update module ............................................ 250, 254
Update work process ........................................... 421 Warning message .................................................. 205
User action .............................................................. 564 Watchpoint .................................................... 615, 628
User context .............................................................. 54 create ..................................................................... 617
User-defined elementary data type .... 104, 113 Watchpoints
User-defined selection screen ............... 188, 520 view ........................................................................ 618
define .................................................................... 520 Web Dynpro ABAP ........................................ 71, 680
User exit ......................................................... 811, 812 Web Dynpro for ABAP ........................................... 51
SD ........................................................................... 813 Web service
User interaction .................................................... 187 consume ..................................................... 771, 776
User interface ............................................................ 45 create ..................................................................... 767
User-specific value ............................................... 534 create ABAP program to consume ............ 775
USING ........................................................................ 245 maintain port information .......................... 773
input parameters ............................................. 246 Web services .................................................. 700, 765
Web Services Description Language
V (WSDL) ................................................................... 765
WebSockets .............................................................. 792
VALUE ........................................................................ 246 WHERE clause ............................................... 408, 412
VALUE_OPTIONS .................................................. 195 Windows ................................................................... 660
Value range ................................................... 389, 391 WITH ........................................................................... 538
Value table ............................................................... 362 Work area ........................................................ 146, 456
Variable ..................................................................... 125 Work process ................................... 49, 51, 441, 447
Variable window ................................................... 636 WRITE ............................................................... 112, 239
Variant ....................................................................... 525 WRITE_FORM .......................................................... 647
attributes ............................................................. 529 Write lock) ................................................................ 401
create .................................................................... 526 WRITE statement ................................................... 517
dynamic date ..................................................... 532
dynamic time ..................................................... 533 X
for selection screen field ................................ 531
system variant .................................................. 527 XI Message interface ............................................ 766
user-specific variable ...................................... 534 XML ............................................................................. 790
Variants array ...................................................................... 791
attributes ............................................................. 527 if_ixml_element ................................................ 315
View ........................................................... 88, 342, 367 XML Path Language (XPath) .............................. 788
ABAP CDS views ................................................ 374 XML schema-based interface ........................... 680
database .............................................................. 368 XSLT ............................................................................ 700
help ........................................................................ 374 XSL transformation
maintenance view ........................................... 372 deserialization ................................................... 789
projection ............................................................ 370 serialization ........................................................ 789
replacement object .......................................... 378 XSTRING .......................................................... 108, 110

912
First-hand knowledge.

Kiran Bandari is a solution architect and has been working


with ABAP for more than 12 years. He has worked as a lead
ABAP consultant on multiple SAP implementations, roll outs,
and upgrade projects with a specific focus on custom de-
velopment using ABAP Objects, Web Dynpro for ABAP, SAP
HANA, SAP Fiori, and SAPUI5. He is also an industry trainer
and has conducted ABAP training workshops for major
clients, including IBM, Accenture, Capgemini, Cognizant,
Deloitte, and more. Currently, he offers consulting and training services through
his firm Ivyprotech Consulting.

Kiran Bandari
Complete ABAP
912 pages, 2022, $89.95 We hope you have enjoyed this reading sample. You may recommend or pass it
ISBN 978-1-4932-2305-3 on to others, but only in its entirety, including all pages. This reading sample and
all its parts are protected by copyright law. All usage and exploitation rights are
www.sap-press.com/5567 reserved by the author and the publisher.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy