ABAP/4

FORMAT Options of Format Statement in ABAP/4

Option          Description
COLOR n Specific background colors
INTENSIFIED Intensified the background color
INVERSE Swap background and foreground color
HOTSPOT Effect when mouse pointer and click
INPUT Generate input field
RESET Reset formats. The format will be backed to default format.

How to Insert Page Break in ABAP/4 Report

You can apply statement "NEW-PAGE" for insert page break in your report.

Syntax


NEW-PAGE [NO-TITLE or WITH-TITLE] [NO-HEADING or WITH-HEADING].

Example


REPORT ZTEST01.
TABLES: SPFLI.
PARAMETERS: p_carrid LIKE SPFLI-CARRID.
START-OF-SELECTION.
...
...
...
END-OF-SELECTION.
...
...
NEW-PAGE.
...
...

The structure of BDCDATA in ABAP/4

BDC is a method for transfer data in SAP. Data that you want it to be operated by BCD must have structure as bellows:

BDCDATA Structure


Field Name    Type     Description
PROGRAM CHAR(40) Program Name
DYNPRO NUMC(4) Screen No.
DYNBEGIN CHAR(1) Begin a screen (If yes then equal ’X’)
FNAM CHAR(132) Field Name
FVAL CHAR(132) Field Value

How to Operate with Internal table for Single Line in ABAP/4

If you want to operate work area with internal table, you can operate follow on below statements:

  • APPEND Statement: If you want to append work area to internal table, you can apply this statement.
    Example
DATA: lw_bkpf LIKE BKPF,
it_bkpf TYPE TABLE OF BKPF WITH HEADER LINE.
...
...
APPEND lw_bkpf TO it_bkpf.
  • COLLECT Statement: If attribute of character string is not equal with same field in your work area, this statement operate look like append statement. If attribute of character string is equal with same field in your work area, this statement operate add the value of numeric (P, F, I).
    Example
DATA: lw_bkpf LIKE BKPF,
it_bkpf TYPE TABLE OF BKPF WITH HEADER LINE.
...
...
COLLECT lw_bkpf INTO it_bkpf.
  • INSERT Statement: Insert statement is look like append statement, but you can specify the index that you want to insert.
    Example
DATA: lw_bkpf LIKE BKPF,
it_bkpf TYPE TABLE OF BKPF WITH HEADER LINE.
...
...
INSERT lw_bkpf INTO it_bkpf INDEX 3.
  • MODIFY Statement: You can modify the data line of internal table by this statement.
    Example
DATA: lw_bkpf LIKE BKPF,
it_bkpf TYPE TABLE OF BKPF WITH HEADER LINE.
...
...
MODIFY it_bkpf INDEX 2 FROM lw_bkpf.
  • DELETE Statement: You can delete the data line of internal table by this statement.
    Example
DATA: lw_bkpf LIKE BKPF,
it_bkpf TYPE TABLE OF BKPF WITH HEADER LINE.
...
...
DELETE it_bkpf INDEX 2.
DELETE it_bkpf WITH KEY BELNR = ’1000000001’.
  • READ Statement: You can access to the data line of internal table by this statement.
    Example

DATA: lw_bkpf LIKE BKPF,
it_bkpf TYPE TABLE OF BKPF WITH HEADER LINE.
...
...
READ TABLE it_bkpf INDEX 2 INTO lw_bkpf.

How to Assign Dynamic Fields using Filed-Symbols in ABAP/4

You can create field name in run time and assign the created name in your field-symbols by statement "ASSIGN ... TO ...".

Example


DATA: name(20),
lv_check(1).

DATA: BEGIN OF itab OCCURS 0,
fld1(4),
fld2(4),
END OF itab.
FIELD-SYMBOLS .
...
...
LOOP AT itab.
IF lv_check = ’X’.
name = ’ITAB-FLD1’.
ELSE.
name = ’ITAB-FLD2’.
ENDIF.
ASSIGN (name) TO .

You can get run time of your program by insert ABAP statement

If you want to know how much the run time of your program by insert ABAP statement, you can insert command "GET RUN TIME" in the top and bottom of program block and minus two times.

Example


DATA: time1 TYPE I,
time2 TYPE I,
runtime TYPE I.
GET RUN TIME FIELD time1.
.....
...program statement...
.....
GET RUN TIME FIELD time2.
runtime = time2 - time1.