ABAP/4

AT Statement in a Loop of ABAP/4


Statement           Description
AT FIRST ... END AT The statement in this block will be executed
if that record is a first record of internal table.
AT LAST ... END AT The statement in this block will be executed
if that record is a last record of internal table.

AT NEW ... END AT The statement is this block will be executed
if the record contains value of the beginning group.

Select ... Into Table & Select ... Appending Table in ABAP/4

Select ... Into Table


SELECT * FROM TABLE1 INTO TABLE itab1
WHERE fld1 = ’AA’.

Select ... Appending Table


SELECT * FROM TABLE1 APPENDING TABLE itab1
WHERE fld1 = ’AA’. 

Two statements are similar if itab1 has no entry.

But if itab1 has at least one row before select clause:

  • Select ... Into Table
    The entries of internal table will be cleared before adding new records.

Options of NEW-PAGE statement in ABAP/4

Option            Description
NO-TITLE New page without title
WITH-TITLE New page with title
NO-HEADING New page without column heading
WITH-HEADING New page with column heading
LINE-COUNT Specify line count in new page
LINE-SIZE Specify line size in new page
PRINT [ON/OFF] Specify printer control

Aggregate Functions of SELECT Clause in ABAP/4

Function     Description
AVG Average value
COUNT Number of Record
MAX Maximum Value
MIN Minimum Value
SUM Summation of Field

Select ... For All Entries in ABAP/4

You can specify condition of where clause using intenal table using option "FOR ALL ENTRIES IN ". When you apply this option please make sure that the internal table has at least one row. If internal table has no entry, system will ignore this option.

Example


DATA: itab TYPE TABLE OF vbak WITH HEADER LINE,
  itab2 TYPE TABLE OF vbap WITH HEADER LINE.
SELECT * INTO TABLE itab FROM vbak
WHERE vbeln BETWEEN ’1000000000’ AND ’4999999999’.
IF NOT itab[] is

Sale and Distribution (SD) Table in SAP


Table     Description
VBAK Sale Order Header
VBAP Sale Order Line Items
LIKP Delivery Order Header
LIPS Delivery Order Line Items
VEKP Shipping Unit Header
VEPO Shipping Unit Line Items
EIKP Foreign Trade: Header
EIPO Foreign Trade: Line Items
VBRK Billing Header
VBRP Billing Line Items
VBUK Sale Document Status Header
VBUP Sale Document Status Line Items