ABAP Frequently asked questions on Tables and Internal Tables

How do you read selected lines of database table into an internal table in packages of predefined size.

SELECT * FROM SPFLI INTO TABLE ITAB PACKAGE SIZE N. where 'n' is variable.
Name the WILDCARD characters which are used for comparisions with character strings & numeric strings.
• '%' and '_'.

How to specify a client for database table processing.
TABLES SPFLI.
SELECT * FROM SPFLI CLIENT SPECIFIED
WHERE MANDT BETWEEN '001' AND '003'.
...
ENDSELECT.

Activation

During activation, the run time object of aggregate object or tables is created. The run time object is buffered so that the application program can access it quickly. Run time object has information about the following objects of table domain - data elements - field definition - table definition

Lock Mechanism

prevents a new database operation being started an existing one has been correctly completed. When conversion is done, lock is created automatically and released only when conversion is successful.

Clearing of locks

restart adjustment - attempt is made to continue conversion at the point of termination
Cancel adjustment - lock entry is simply deleted from table
Version Management functions -

Canceling changes - reset revised version to active version

Storing changes - active version will be temporarily stored in version
Switching changes - switch between active and revised versions

Version catalog - list of all existing versions of an object

Revised version - produced when we edit an existing object
Active version - produced when we activate an object
Temporary version - produced when we copy the active version temporarily to the database with store version functions

Historical versions - created when 1. Correction is created 2 correction is
released

Table Buffering : Possible buffering types

full buffering - either, whole table or none of the table is located in the buffer (Tables up to 30 kb done in client dependent fully buffered tables)
Generic buffering - generic areas of the table are fully buffered.

Generic key - left justified section of primary key of a table.

generic area - all records for which fields of generic key correspond
Single record buffering - records actually being accessed are loaded to buffers, large records where few records are accessed.

Internal Tables ? Types ?

STANDARD table

Key access to a standard table uses a linear search. This means that the time required for a search is in linear relation to the number of table entries.
You should use index operations to access standard tables.

SORTED table

Defines the table as one that is always saved correctly sorted.
Key access to a sorted table uses a binary key. If the key is not unique, the system takes the entry with the lowest index. The runtime required for key access is logarithmically related to the number of table entries.

HASHED table

Defines the table as one that is managed with an internal hash procedure
You can only access a hashed table using the generic key operations or other generic operations ( SORT, LOOP, and so on). Explicit or implicit index operations (such as LOOP ... FROM oe INSERT itab within a LOOP) are not allowed.

INDEX table

A table that can be accessed using an index.
Index table is only used to specify the type of generic parameters in a FORM or FUNCTION. That means that you can't create a table of type INDEX.
Standard tables and sorted tables are index tables.

Syntax :

DATA itab TYPE table type of line type [WITH UNIQUE/NON-UNIQUE KEY ] [Iinitial size n] [WITH HEADER LINE]

What are DATA CLUSTERS ?

You can group any complex internal data objects of an ABAP/4 program together in data clusters and store them temporarily in ABAP/4 memory or for longer periods in databases. You can store data clusters in special databases of the ABAP/4 Dictionary. These databases are known as ABAP/4 cluster databases and have a predefined structure.Storing a data cluster is specific to ABAP/4. Although you can also access cluster databases using SQL statements, only ABAP/4 statements are able to decode the structure of the stored data cluster.


Describe the functions of the debugger screen.

Single step(F5) - Use this option to step through the program statement by statement. This allows you to branch into subroutines and function modules, and to execute these routines step by step as well. Once a subroutine or function module has been processed, control returns to the statement following the CALL FUNCTION or PERFORM statement.

Execute(F6)- Use this option to process a program line by line. All of the statements on the current line are processed in a single step. If you are positioned on a line that calls a subroutine and you choose Execute, the Debugger processes the whole subroutine and then moves on to the line following the subroutine call. This allows you to jump through the statements within the subroutine.


Return(F7) - The Debugger returns from a routine to the point at which control returns to the main program. Use this option to return from a subroutine, function module, or called program to the calling program.


Continue(F8)- Use this option to process the program up to the next dynamic or static breakpoint or up to the cursor position. If there are no more breakpoints in the program and no cursor has been set, the system exits debugging mode and executes the rest of the program normally.

Tables - Display the contents of internal tables.
Problem:How to run a program in background?
Solution

In the selection screen :After filling the screen fields press F9.A screen appears requesting U to print the Background Parameters

Enter the output device(Eg HPLJ /SAP2 etc)
In the spool options Uncheck Print immedietly,Uncheck delete after output,and new
spool request.
Press enter.
Another screen appears with heading start time .U can press start immly ,then save
Now the Background job is scheduled for the given program .
To View the status of background Job,The transaction code is SM37.
Execute from the resulting screen .Job overview -->From the Job list select U’r program and select Spool from the application toolbarOutput Controller :List of Spool RequestsSelect U’r Spool request and click Display icon from the overview screen .

U will be displayed with the List.

Caution :See to that the list with does not exceed 255 columns ,If it exceeds the extra columns will be truncated in Background

What are presentation and application servers in SAP?

A presentation server is actually a program named Sapgui.exe. It is usually installed on a user’s workstation.Application server is a set of executable that collectively interpret the ABAP/4 programs and manage the input & output for them.

In an ABAP/4 program how do you access data that exists on a presentation server v/s on an application server?

For presentation server use UPLOAD or WS_UPLOAD function modules.For application server use OPEN DATASET, READ DATASET and CLOSE DATASET commands.

Describe the syntax and function of the AUTHORITY CHECK command?

Ans :- AUTHORITY - CHECK OBJECT

IF SY-SUBRC NE 0.
The AUTHORITY-CHECK checks whether a user has the appropriate authorization to execute a particular activity.

Explain the EXPORT and IMPORT commands? How can you pass more than one group of data by using IMPORT commands?

EXPORT :-
To read data objects from an ABAP program into ABAP memory, use the following statement:
Syntax
EXPORT ... TO MEMORY ID .

This statement stores the data objects specified in the list as a cluster in memory. If you do not use the option FROM , the data object is saved under its own name. If you use the FROM option, the data object is saved under the name . The name identifies the cluster in memory. It may be up to 32 characters long.The EXPORT statement always completely overwrites the contents of any existing data cluster with the same name .

IMPORT :-
To read data objects from ABAP memory into an ABAP program, use the following statement:
Syntax
IMPORT ... FROM MEMORY ID .

This statement reads the data objects specified in the list from a cluster in memory. If you do not use the TO option, the data object in memory is assigned to the data object in the program with the same name. If you do use the option, the data object is read from memory into the field . The name identifies the cluster in memory. It may be up to 32 characters long.

You do not have to read all of the objects stored under a particular name . You can restrict the number of objects by specifying their names. If the memory does not contain any objects under the name , SY-SUBRC is set to 4. If, on the other hand, there is a data cluster in memory with the name , SY-SUBRC is always 0, regardless of whether it contained the data object .If the cluster does not contain the data object , the target field remains unchanged.

Explain the READ LINE and MODIFY LINE commands.

READ LINE :- Use the statements READ LINE and READ CURRENT LINE to read data from the lines of existing list levels. These statements are closely connected to the HIDE technique.

MODIFY LINE :- To modify the lines of a completed list from within the program, use the MODIFY LINE statement. 

What are the differences between calling a program, transaction ‘with return’ and ‘without return’ and how can each be accomplished?

Program
SUBMIT.

If you use AND RETURN, the system stores the data of the calling executable program and returns to the calling after processing the called program. The system resumes executing the calling program at the statement following the call.If you omit the AND RETURN addition, all data and list levels of the calling program (the entire internal session) are deleted. After the called executable program has finished, control returns to the level from which you started the calling program.

Transaction

CALL TRANSACTION [AND SKIP FIRST SCREEN] [USING ].
This statement saves the data of the calling program, and starts transaction . At the end of the transaction, the system returns to the statement following the call in the calling report.

LEAVE TO TRANSACTION [AND SKIP FIRST SCREEN].
This statement ends the calling program and starts transaction . This deletes the call stack (internal sessions) of all previous programs. At the end of the transaction, the system returns to the area menu from which the original program in the call stack was started.

What are the differences between the parameter SET and GET?

SET PARAMETER ID FIELD .

This statement saves the contents of field under the ID in the SAP memory. The code can be up to 20 characters long. If there was already a value stored under , this statement overwrites it. If the ID does not exist, double-click in the ABAP Editor to create a new parameter object.
GET PARAMETER ID FIELD .

This statement fills the value stored under the ID into the variable . If the system does not find a value for in the SAP memory, it sets SY-SUBRC to 4, otherwise to 0.

WHAT are the commands that allow you to process sequential file? And what is their syntax?

READ DATASET (reading) and TRANSFER (writing)
OPEN DTASET for mode at POSITION MESSAGE

READ DATASET INTO
CLOSE DATASET

DELETE DATASET
TRANSFER

What is the difference between opening a dataset for input, output, appending?

FOR OUTPUT: Opens the file for writing if exists it is overwritten if not then it is created.

FOR INPUT: Opens an existing file for reading.

FOR APPENDING: Opens the file for writing at the end of the file .If it does not exist, it is
created, if opened, you return to the end.
When an internal table is created, the settings criteria for the value of occurs?
The objective of setting the value of an occurs for an internal table is a question of optimization.

The following facts should be taken into account when making such decision.

1) The complete data area of a program is 64000 bytes.
2) The initial size declared is kept in roll area (quicker access to program)
3) Data entered that exceeds the initial size stores in the roll file (Slower access to program)

You should also analyze the expected volume and access rates before making the decision.

Define "Check " statements, how it works?

To terminate a single loop pass conditionally, use the CHECK statement in the statement block of the loop.If the condition is not true, any remaining statements in the current statement block after the CHECK statement are ignored, and the next loop pass starts. can be any logical expression.

Explain Field Group(extract dataset)?

An extract dataset consists of a sequence of records. These records may have different structures. All records with the same structure form a record type. You must define each record type of an extract dataset as a field group, using the FIELD-GROUPS statement.

FIELD-GROUPS .

This statement defines a field group . A field group combines several fields under one name. For clarity, you should declare your field groups at the end of the declaration part of your program.A field group does not reserve storage space for the fields, but contains pointers to existing fields. When filling the extract dataset with records, these pointers determine the contents of the stored records.

What is the difference between Move & assign statement?

Move :- To assign the value of a data object to a variable , use the following statement:
MOVE . or the equivalent statement does not have to be a variable - it can also be a literal, a text symbol, or a constant. You must always specify decimal points with a period (.), regardless of the user’s personal settings.
Multiple value assignments in the form
Assign :- ASSIGN TO .
When you assign the data object, the system checks whether the technical attributes of the data object correspond to any type specifications for the field symbol . The field symbol adopts any generic attributes of that are not contained in its own type specification. Following the assignment, it points to in memory.

How do you run a report for a row in table?

Using Graphics Multiplexer. There is an option some thing similar to screen capture which captures data only. Using that data you can draw graphs (3D and 2D). This option is available all the time from Menu! -> Generate Graphics which captures the data then you need to drag and select the data you want to draw a graph on. Once you select you can click on Graphics, which launches graphics multiplexer.

RELATED POSTS

FAQ'S ON SAP BASIS LAYER
FAQ'S ON RFC

My SAP Project safety and security

No comments :

Post a Comment