Thursday, February 10, 2011

SAP ABAP Scripts Question and Answers Part 4

Module Pool

Transactions:
A transaction is a program that conducts a dialog with the user. In a typical dialog, the system displays a screen on which the user can enter or request information. Based on the the user input or request, the program executes the appropriate actions like, it branches to the next screen, displays an output, or changes the database.

Explain what is a transaction in SAP terminology.
- In SAP terminology, a transaction is series of logically connected dialog steps.

Explain how SAP GUI handles output screen for the user.
- User terminal input is accepted by SAP GUI and sent to the SAP dispatcher. The dispatcher co-ordinates the information exchange between the SAP GUIs and the work processes. The dispatcher first places the processing request in request queues, which it then processes. The dispatcher dispatches the requests to the available work process. The actual processing takes place in the work process. When processing is complete, the result of a work process is returned via the dispatcher to the SAP GUI. The SAP GUI interprets the received data and generates the output screen for the user.

What is LUW or Database LUW or Database Transaction ?
- A “LUW” ( logical unit of work ) is the span of time during which any database updates must be performed . Either they are all performed ( committed ) , or they are all thrown away ( rolled back ).

LUW ( or “database LUW” or “database transaction” )
This is the set of updates terminated by a database commit. A LUW lasts, at most, from one screen change to the next ( because the SAP system triggers database commits automatically at every screen change ).

LUWs help to guarantee database integrity. When an LUW has been successfully concluded, the database is once again in a correct state. If, however, an error occurs within an LUW, all database changes made since the beginning of the LUW are canceled and the database is then in the same state as before the LUW started.

An LUW begins

- Each time you start a transaction
- When the database changes of the previous LUW have been confirmed (database commit) or
- when the database changes of the previous LUW have been cancelled (database rollback)

An LUW ends

- When the database changes have been confirmed (database commit) or
- When the database changes have been canceled (database rollback)

What is SAP LUW or Update Transaction ?
- Update transaction ( or “SAP LUW”)
This is a set of updates terminated by an ABAP/4 commit. A SAP LUW may last much longer than a database LUW, since most update processing extends over multiple transaction screens.The programmer terminates an update transaction by issuing a COMMIT WORK statement.

Does the external program run in the same SAP LUW as the caller, or in a separate one?
- Transactions run with a separate SAP LUW
- Reports run with a separate SAP LUW
- Dialog modules run in the same SAP LUW as the caller
- Function modules run in the same SAP LUW as the caller
The only exceptions to the above rules are function modules called with IN UPDATE TASK (V2 function only) or IN BACKGROUND TASK (ALE applications). These always run in their own (separate) update transactions.

What are the requirements a dialog program must fulfill ?
- A dialog program must fulfill the following requirements
. a user friendly user interface
. format and consistency checks for the data entered by the user
. easy correction of input errors
. access to data by storing it in the database.

What are the basic components of dialog program ?
- Screens (Dynpros)
Each dialog in an SAP system is controlled by dynpros. A Dynpro consists of a screen and its flow logic and controls exactly one dialog step.
- ABAP/4 module pool
Each dynpro refers to exactly one ABAP/4 dialog program. Such a dialog program is also called a module pool, since it consists of interactive modules.

What is a dynpro ? What are its components ?
- A dynpro (DYnamic PROgram) consists of a screen and its flow logic and controls exactly
one dialog step.
- The different components of the dynpro are:
Flow logic: Calls of the ABAP/4 modules for a screen
Screen layout: Positions of the texts, fields, pushbuttons, and so on for a screen
Screen attributes: Number of the screen, number of the subsequent screen, and others
Field attributes: Definition of the attributes of the individual fields on a screen

What is screen flow logic? What are the selections in it? Explain PAI and PBO?

Ans - Screen flow logic contains the procedural part of a screen. The screen flow logic is like an ABAP program in that it serves as a container for processing blocks. There are four event blocks, each of which is introduced with the screen keyword PROCESS:

PROCESS BEFORE OUTPUT.
...
PROCESS AFTER INPUT.
...
PROCESS ON HELP-REQUEST.
...
PROCESS ON VALUE-REQUEST.

Selections are performed in PAI.

PROCESS BEFORE OUTPUT (PBO) is automatically triggered after the PAI processing of the previous screen and before the current screen is displayed. You can program the PBO processing of the screen in this block. At the end of the PBO processing, the screen is displayed.

PROCESS AFTER INPUT (PAI) is triggered when the user chooses a function on the screen. You can program the PAI processing of the screen in this block. At the end of the PAI.
processing, the system either calls the next screen or carries on processing at the point from which the screen was called.

PROCESS ON HELP-REQUEST (POH) and PROCESS ON VALUE-REQUEST (POV) are triggered when the user requests field help (F1) or possible values help (F4) respectively. You can program the appropriate coding in the corresponding event blocks. At the end of processing, the system carries on processing the current screen.

Can we use WRITE statement in screen fields ? If not how is data transferred from field data to screen fields
- We cannot write field data to the screen using the WRITE statement. The system instead transfers data by comparing screen field names with ABAP/4 variable names. If both names are the same, it transfers screen field values to ABAP/4 program fields and vice-versa. This happens immediately before and immediately after displaying the screen.

How does the interaction between the Dynpro and the ABAP/4 modules takes place ?
- A transaction is a collection of screens and ABAP/4 routines, controlled and executed by a Dialog processor. The Dialog processor processes screen after screen, thereby triggering the appropriate ABAP/4 processing for each screen. For each screen, the system executes the flow logic that contains the corresponding ABAP/4 processing. The control passes from screen flow logic to ABAP/4 code and back.

How does the Dialog handle user requests ?
- When an action is performed, the system triggers the PROCESS AFTER INPUT event. The data passed includes field screen data entered by the user and a function code. A function code is a technical name that has been allocated in the Screen Painter or Menu Painter to a menu entry, a pushbutton, the ENTER key or a function key of a screen. An internal work field (ok-code) in the PAI module evaluates the function code, and the appropriate
action is taken.

How are the function codes handled in flow logic ?
- When the user selects a function in a transaction, the system copies the function code into a specially designated work field called OK_CODE. This field is global in the ABAP/4 module pool. The OK_CODE can then be evaluated in the corresponding PAI module.
The function code is always passed in exactly the same way, regardless of whether it comes from a screen's pushbutton, a menu option, function key or other GUI element.

What controls the screen flow ?
- The SET SCREEN and LEAVE SCREEN statements control screen flow.

What are “field” and “chain” statements ?
- The FIELD and CHAIN flow logic statements let you program your own field checks. FIELD and CHAIN tell the system which fields you are checking,and whether the system should perform checks in the flow logic or call an ABAP/4 module.

What is an on “*-input field” statement ?
- ON *-INPUT
The ABAP/4 module is called if the user has entered a "*" in the first character of the field, and the field has the attribute *-entry in the Screen Painter. You can use this option in exceptional cases where you want to check only fields with certain kinds of input.

What are conditional chain statements ?
- ON CHAIN-INPUT similar to ON INPUT.
The ABAP/4 module is called if any one of the fields in the chain contains a value other than its initial value (blanks or nulls).
ON CHAIN-REQUEST
This condition functions just like ON REQUEST, but the ABAP/4 module is called if any one of the fields in the chain changes value.

What is “at exit-command” ?
- The flow logic keyword AT EXIT-COMMAND is a special addition to the MODULE statement in the flow logic. AT EXIT-COMMAND lets you call a module before the system executes the automatic field checks.

Which function type has to be used for using “at exit-command” ?
- To use AT EXIT-COMMAND, we must assign a function type ‘E’ to the relevant function in the Menu Painter or Screen Painter.

What is the difference between SET SCREEN and CALL SCREEN ?
With SET SCREEN, the current screen simply specifies the next screen in the chain. control branches to this next screen as soon as the current screen has been processed. Return from next screen to current screen is not automatic. It does not interrupt processing of the current screen. If we want to branch to the next screen without finishing the current one, use LEAVE SCREEN.

With CALL SCREEN, the current (calling) chain is suspended, and a next screen (or screen chain) is called in. The called screen can then return to the suspended chain with the statement LEAVE SCREEN TO SCREEN 0. Sometimes we might want to let an user call a popup screen from the main application screen to let them enter secondary information. After they have completed their entries, the users should be able to close the popup and return directly to the place where they left off in the main screen. Here comes CALL SCREEN into picture. This statement lets us insert such a sequence into the current one.

Can we specify the next-screen number with a variable. ( Yes / No ).
Yes.

The field SY-DYNNR refers to ________________.
Number of the current screen.

What is a dialog module ?
A dialog module is a callable sequence of screens that does not belong to a particular transaction. Dialog modules have their own module pools, and can be called by any transaction.

The syntax used to call a screen as a dialog box ( popup ) is _________________.
CALL SCREEN
STARTING AT
ENDING AT .

What is a “call mode” ?
In the ABAP/4 world, each stackable sequence of screens is a "call mode". This is important because of the way you return from a given current sequence. To terminate a call mode and return to a suspended chain, set the "next screen" to 0 and leave to it:
LEAVE TO SCREEN 0 or ( SET SCREEN 0 and LEAVE SCREEN ). When you return to the suspended chain, execution resumes with the statement directly following the original CALL SCREEN statement. The original sequence of screens in a transaction is itself is a
calling mode. If you LEAVE TO SCREEN 0 in this sequence ( that is, without having stacked any additional call modes ), you return from the transaction altogether.

The maximum number of calling modes stacked at one time is ______.
Nine.

What is LUW or Database LUW or Database Transaction ?
A “LUW” ( logical unit of work ) is the span of time during which any database updates must be performed in an “all or nothing” manner. Either they are all performed ( committed ) , or they are all thrown away ( rolled back ). In the ABAP/4 world, LUWs and transactions can have several meanings:
LUW ( or “database LUW” or “database transaction” )
This is the set of updates terminated by a database commit. A LUW lasts, at most, from one screen change to the next ( because the SAP system triggers database commits automatically at every screen change ).

What is SAP LUW or Update Transaction ?
Update transaction ( or “SAP LUW”)
This is a set of updates terminated by an ABAP/4 commit. A SAP LUW may last much longer than a database LUW, since most update processing extends over multiple transaction screens.The programmer terminates an update transaction by issui

.

No comments:

Tutorials on SAP-ABAP

Adobe Interactive Forms Tutorials

Business Server Pages (BSP)

Userexits/BADIs

Web Dynpro for ABAP (Step by step procedure for web dynpro,Tutorials on Web Dynpro,)

ALV Tutorials

Blog Archive

goodsites