Monday, July 23, 2007

RUNTIME:FAQ`S

What does A BAP stand for?

ABAP currently stands for Advanced Business Application Programming; however the original meaning was Allgemeiner Berichtsaufbereitungsprozessor, which is German for "generic report preparation processor"
A different explanation is Anfänger Basteln An Programmen, which is german for "beginners tinker with programs"

back to top

What are the different types of internal tables?

There are three types of internal tables in ABAP, standard table,
sorted table, and hashed table.

back to top

What is the difference between SAP memory and ABAP memory?

SAP Memory is a global memory area which all sessions within a
SAPgui have access to. This allows for passing data between
sessions. The SET PARAMETER ID and GET PARAMETER ID statements are
used to manipulate the SAP Memory.

SET PARAMETER ID 'MAT' field p_matnr.
GET PARAMETER ID 'MAT' field p_matnr.

ABAP Memory is a memory area which all programs in the call stack
within the same internal session can access. The EXPORT and IMPORT
statements are used here.

export p_matnr = p_matnr to memory id 'ZTESTMAT'.
import p_matnr = p_matnr from memory id 'ZTESTMAT'.

back to top

What are the events used in report programs?

Load-of-Program
Initialization
At Selection-Screen
At Selection-Screen on
At Selection-Screen on block
At Selection-Screen output
At Line-Selection
At User-Command
Start-of-Selection
End-of-Selection
Top-of-Page
End-of-Page
Top-of-Page during line-selection

back to top

How are RANGES different from SELECT-OPTIONS?

They are the same, except SELECT-OPTIONS will provide an interface
on the selection screen for the user to input data.

back to top

Are header lines and the OCCURS extension obselete?

In regard to internal tables, header lines and the OCCURS extension are obselete. These are actually not allowed in the OO context. The correct way to define internal tables and work areas is to use a TYPE statement to define the structure and the table type and then to use a DATA statement to define the internal table and work area.

types:
begin of ty_Item,
fld1 type c length 10,
fld2 type c length 10,
end of ty_Item,
ty_Items type standard table of ty_Item with default key.
data: itab type ty_Items.
data: wa like line of itab.

back to top

What is the difference between OCCURS n and INITIAL SIZE n?

OCCURS n is obsolete in OO Context and it is advisable to use INITIAL SIZE instead. The difference between the two is that OCCURS n allocates memory to store specified number of rows in the internal table and also creates a header line, whereas INITIAL SIZE allocates memory for the specified number of rows without creating the header line.

back to top

How do I define a deep structure in modern ABAP?

TYPES:
BEGIN OF ty_Message,
count TYPE sy-tabix,
bdc_Messages TYPE STANDARD TABLE OF bdcmsgcoll WITH DEFAULT KEY,
END OF ty_Message,
ty_Messages TYPE STANDARD TABLE OF ty_Message WITH DEFAULT KEY.
DATA: all_Messages TYPE ty_Messages.

One thing need to be clarified is there are 3 terms are often mixed up, 1. Nested Structure, 2. Deep Structure, 3. Flat Structure. According to official training material BC402, they are explained like following:1. Nested Structure: Structure contains other structure as component.2. Deep Structure: Structure contains variable length components (string / xstring), or even an internal table.3. Flat Structure: Structure only contains fixed-length components. back to top

What is the difference between "'" and "`" in a character literal?

A character sequence within single quote characters (') is a char literal, while within (`) is a string literal. That get´s especially important for trailing spaces. A string literal presveres the trailing space while a char literal ignores them.

Eg.:

DATA v_char TYPE c LENGTH 32.
v_char = 'This is a'.
CONCATENATE v_char 'text ' INTO v_char SEPARATED BY space.
*" v_char would be "This is a text"
CONCATENATE v_char `text ` INTO v_char SEPARATED BY space.
*" v_char would be "This is a text "

back to top

How can I access parameters to MACROS?

The parameters in MACROS can be accessed by &1, &2 ...

DATA sum TYPE i.

"Macro definition
DEFINE add_macro.
sum = *&1 + &2*.
END-OF-DEFINITION.

START-OF-SELECTION.
add_macro 10 20.
WRITE sum.

back to top