Вы находитесь на странице: 1из 3

Data Types: - Integer(0), Floating Point(0.0),Packed(0.

000), Character(Space), Numeric (0)


,String(Space), Date(YYYYMMDD,0), Time(HHMMSS,0). Ex: - DATA: V Type I.
Operators: - String Comparison CO: - Contains only; CA: - Contains Any, CS: - Contains String,
CP: - Suits Pattern
Wildcard Characters:* Stands for no. of Chars, + denotes any Character. They usually used
along with IF Statement.
EX: IF ABAP CO AB. Condition is FALSE because there is P;
IF ABAP CA AB.
Condition is TRUE.
IF ABAP CP +B. Condition is TRUE because 2 nd character is B.
Control Statements:
IF
condition.

.
ELSE.

IF condition-1.
CASE variable.
.
WHEN value-1.
DO n TIMES.
ELSEIF condition.
Statement
2.
WHEN value-2.
_Block.
.
.
ENDDO.
ELSEIF conditionWHEN value-3.
3.
.
WHILE
.
WHEN others.
log_exp.
ELSEIF condition.
Statement
n.
ENDCASE.
_Block
.
ENDWHILE.
ELSE.
Statements which can be used optionally in loops.
1. EXIT. To come out from the loop.
2. CONTINUE. To start the next iteration from middle of the loop.
3. CHECK<CONDITION>. To start the next iteration when condition fails.
SELECTION OPTIONS and RANGES: - Both Ranges and Select-Options are used for
maintaining Ranges.
Selection Options is used for taking input from user on selection screen.
In case of Selection Options system itself creates An Internal Table.
In case of Ranges, the internal table should be defined explicitly.
The internal table contains four fields Sign, Option, Low and High.
Special operator IN is used in comparisons.
SIGN
: - The Data type of SIGN is C with length 1. Possible values are I and E.
I stand for inclusive.
E stand for exclusive.
OPTION
: - The data type of OPTION is C with length 2. OPTION contains the selection
operator.
If HIGH is empty, you can use EQ, NE, GT, LE, LT, CP, AND NP.
If HIGH is filled, you can use BT and NB (not between).
LOW : - To maintain Lower Limit of the range.
HIGH : - To maintain Higher Limit of the range.
INTERNAL TABLES : Tables are the essential Data Structures in the R/3 System. Long-Life
Data is stored in Relational Data Base Tables in Database Server.
Besides DB Tables, you can create Internal Tables which exist only during the
runtime of your program. A particular important use of Internal Tables is for sorting and

formatting data from a DB Table with in a Program. The Data Type of an Internal Table is
normally a Structure. Each Component of the Structure is a Column in the Internal Table.
The Number of Lines in the Internal Table is not fixed. Depending on requirements, the system
increases the size of the Internal Table at run time. The data is stored on a row by row basis,
where each row has the same structure.
It has two Different parts. Header Line (Optional) & Body (Compulsory). Any value that comes to
or goes from internal table, that travels through header line.
Header line is a Work Area whose data type is the row type of an internal table and whose name
is the name of the Internal Table.

TABLE

WORK AREA
You can create explicit work area also.
The statements for the access to individual rows use the header line as implicit work area if no,
explicit work area is specified.
DECLARING INTERNAL TABLES
INTERNAL TABLES WITH IMPLICIT HEADER LINE
Implicit Header Line is Header Line with the name same as that of Internal Table. It
can be created in two ways.
Using TABLE OF and WITH HEADER LINE option.
DATA: ITAB TYPE TABLE OF MARA WITH HEADER LINE.
Or
DATA: ITAB TYPE STANDARD TABLE OF MARA WITH HEADER LINE.
Using OCCURS option.
DATA: BEGIN OF ITAB OCCURES 10,
CARRID
TYPE SPFLI-CARRID,
CONNID
TYPE SPFLI-CONNID,
END OF ITAB.
INTERNAL TABLES WITH EXPLICIT HEADER LINE
Explicit Header line is Header Line with the name NOT same as that of internal
Table.
Method 1.
Data: WA Type SPFLI.
Data: ITAB Type Table of SPFLI.
Method 2.
Types: Begin of TY_FLY,
CARRID
TYPE SPFLI-CARRID,
CONNID
TYPE SPFLI-CONNID,
End of TY_FLY.
Data: WA Type TY_FLY,
Data: ITAB Type Table of TY_FLY.
In the above two methods, the structure WA can be used as Explicit Header Line for
Internal Table ITAB.
Method3.
TABLES: SPFLI.
Data: ITAB Type Table of SPFLI.

In the above method TABLES Statement creates an Implicit Header Line for Data
Base table SPFLI. But it can be used as Explicit Header Line for Internal Table ITAB.
Operations on Internal Tables
1) Processing an Internal Table:- To perform an operation on each and every record of an
internal table
LOOP AT <ITAB>
LOOP AT <ITAB> INTO <WA>
.
.
ENDLOOP.
ENDLOOP.
Each record will be transferred to Implicit
Header Line.
LOOP AT <ITAB> INTO <WA> FROM n1 TO
n2
.
ENDLOOP.

Each record will be transferred to Explicit


Header Line.
LOOP AT <ITAB> INTO <WA> WHERE
<condition>
.
ENDLOOP.

To process a range of records.

To process records based on condition.

2) Inserting Lines into Tables: - Adding records either at the end or at the specified position.
If index is not specified records will be added at the end of the table.
To add a line to an Internal Table
INSERT <Line> INTO TABLE <ITAB> INDEX n.
INTO addition is not required if inserting is done through Implicit Header Line.
To add several Lines to an Internal Table
INSERT LINES OF <ITAB1> [From <n1>] [TO <n2>] INTO TABLE <ITAB2>.
3) Appending Lines to the Table:-Adding records at end of the table.
To add a line to an internal table
APPEND <line> INTO TABLE <ITAB>.
To add several Lines to Internal Table
APPEND LINES OF <ITAB1>[FROM <N1>] [TO <N2>] TO <ITAB2>

Вам также может понравиться