Start of Content Area

Function documentation Accessing Multiline Container Elements  Locate the document in its SAP Library structure

Use

In the binding editor, you can use expressions to access multiline container elements (internal tables). You have the following options:

 

Element in Internal Table

Access Using

Syntax

Line

Index expression (line projection)

&tab[idx_exp ]&

Column

Column projection

&tab.col_name&

Field

Combination of index expression and column projection

&tab[idx_exp].col_name&

Field that is itself an internal table (multi-dimensional array)

 

Iterative Index Expression

&tab[idx_exp].col_name[idx_exp]&

 

Index Expression and Column Projection

The index expression idx_exp specifies the required line. The index expression can be an arbitrary expression that gets a positive value of type INTEGER, for example a counter variable.

If the expression gets a value smaller than 1, or references a line that does not exist in the internal table, the expression cannot be evaluated. An error such as this during the evaluation is written to the Workflow log.

In the column projection, col_name specifies the required column. Since you cannot specify the column dynamically, any incorrect entries are discovered by the syntax check.

Example

Accessing a Line

A container element with the name Names is defined as an internal table of type SY-UNAME. The following table show the different ways the lines of the internal table can be accessed:

 

Index Access

Description

&Names[1]&

Gets the first line of the table

&Names[&Counter&]&

Gets the line of the table, which is determined by the counter variable &Counter&.

&Names[&my_obj.get_current_idx()&]&

Gets the line of the table, which is determined by the functional method get_current_idx of the object my_obj

 

Accessing a Line, Column, or Field

The internal table users is defined as follows:

 

ID

ID

Street

Thomas

4711

Main street

Eva

0815

Station street

Paul

4712

High street

 

Line

&users[2]& gets the second line of the table users:

Eva

0815

Station street

Column

&users.id& gets the content of the column ID in the table users:

4711

0815

4712

Field

&users[2].id& gets the field ID of the second line of the table users:

0815

Iterative Index Expression

You have defined an internal table users. The phone_numbers column can contain multiple telephone numbers for each person:

 

name

phone_numbers

street

Thomas

4711

4712

4713

Main street

Eva

0815

0816

Station street

 

&users[2].phone_numbers[1]& gets the first entry in the phone_numbers field in the second line of the users table:

0815

 

Table from Tables

You have defined an internal table phone_numbers. The table comprises one field in each line. This field is itself a table.

phone_numbers

4711

4712

4713

0815

0816

 

&phone_numbers[1][3]& gets the third entry from the first line:

4713

 

 

 

 

 

 

End of Content Area