SAP R/3

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

How to Generate Value Request by ABAP/4

We can use function module "F4IF_INT_TABLE_VALUE_REQUEST" for generate value request by ABAP report.

Example


              

*** Screen Flow ***

PROCESS ON VALUE-REQUEST.

  FIELD scn_kokrs MODULE create_value_request.

*** ABAP Editor ***

MODULE create_value_request INPUT.

DATA: BEGIN OF itab_request OCCURS 0,

kokrs LIKE TKA01-KOKRS,

bezei LIKE TKA01-BEZEI,

END OF itab_request.


SELECT KOKRS BEZEI
       FROM TK


            

How to Read Table Dynamically in ABAP/4

About statement "READ TABLE", we can generate code for read key dynamic as below:


DATA: BEGIN OF itab OCCURS 0,
fld1(2),
fld2(2),
fld3(10),
fld4 TYPE i,
END OF itab,
wa_tab LIKE itab,
gv_key1(4) TYPE C VALUE ’FLD1’,
gv_key2(4) TYPE C VALUE ’FLD2’.
...
...
...

READ TABLE itab INTO wa_tab
WITH KEY (gv_key1) = ’AA’
(gv_key2) = ’BB’.

Operator for comparing strings in ABAP/4


Operator     Description
CO Contains Only
CN Contains Not Only
CA Contains Any
NA Contains Not Any
CS Contains String
NS Contains No String
CP Matches Pattern
NP Not Match Pattern