Programming

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

IP Location Lookup

If you are working closely with IP address, website or any , you might want to know where each visitors come from. The question is how to locate visitors. Let me take you to the very basic detail. What do you know about visitor right now? Well, what you know by now are just IP address of each visitor and referrer URL if specified. So the problem is how to lookup the location of given IP address.

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