Вы находитесь на странице: 1из 17

Q1.There are various possibilities of creating/changing an ABAP programme. Some of these are: A.

Opening programs in the Object Navigator B. Using the ABAP Editor C. Using EEWB D. Using Forward Navigation Answer: A, B, D

To start the ABAP Editor to create or change ABAP programs, the R/3 system offers three possibilities: Opening Programs in the Object Navigator The Object Navigator of the ABAP Workbench (Transaction SE80) offers a hierarchical overview of all R/3 Repository objects, ordered by package, user name of the programmer, object types, and so on. By selecting a program, the Object Navigator supplies direct access to all components of a program, such as main program, includes, classes, or global data. By selecting a program object in the Object Navigator and calling a maintenance transaction, you directly open the appropriate tool for this object, in this case the ABAP Editor. This way is appropriate for all ABAP programs, as the Object Navigator gives you a constant overview of all components of a program. In particular, screens and user interfaces are displayed.

Using the ABAP Editor To open ABAP programs directly from the tool ABAP Editor, select the menu path Tools --> ABAP Workbench --> Overview --> Development --> ABAP Editor from the SAP menu of SAP Easy Access (or start Transaction SE38). If you want to change a program using this method, you must already know its name and environment. This procedure is only suited for maintaining or creating relatively simple or short programs, which have few or no additional components.

Using Forward Navigation In any of the tools in the ABAP Workbench, you can open a different Repository object by positioning the cursor on it and double-clicking. The system automatically opens the object using the correct tool. This also applies to editing ABAP programs. Forward navigation by double-click can be used at any point where the names of ABAP programs appear in the ABAP Workbench.

Q2. Which of the following are acceptable names of an ABAP program? A. ZQSDABAP B. YMYFIRSTABAPPROGRAM C. ZMyFirst ABAP PROGRAM D. Z==FIRSTABAPPROGRAM E. THISISMYFIRSTABAPPROGRAMME Answer: A, B, E The name of an ABAP program can be between 1 and 30 characters long. The following symbols and signs must not be used in program names: Period (.), comma (,), space ( ), parentheses (), apostrophe (), inverted commas ("), equals sign (=), asterisk (*), accented characters or German umlauts (, , , , , and so on), percentage signs (%), or underscores (_).

Q3. Data types in ABAP are not just attributes of fields, but can be defined in their own right. Where in ABAP can you define data types? A. ABAP Dictionary B. In programs C. In IMG Answer: A, B

The following graphic shows where you can define data types in ABAP:

This differentiates between Predefined ABAP types that are built into the kernel. Local data types that you can define in ABAP programs. Data types in the ABAP Dictionary that are available to all programs in the entire system. In the ABAP Dictionary, you can define types either as Dictionary objects or in type groups.

Q4. Which of the following are ways to process large volumes of data in ABAP? A. Internal Tables B. Extracts C. Database Storage Answer: A, B

There are two ways of processing large quantities of data in ABAP - either using internal tables or extract datasets. Internal tables Internal tables provide a means of taking data from a fixed structure and storing it in working memory in ABAP.

The data is stored line by line in memory, and each line has the same structure. In ABAP, internal tables fulfill the function of arrays. Since they are dynamic data objects, they save the programmer the task of dynamic memory management in his or her programs. You should use internal tables whenever you want to process a dataset with a fixed structure within a program. A particularly important use for internal tables is for storing and formatting data from a database table within a program. They are also a good way of including very complicated data structures in an ABAP program. Like all elements in the ABAP type concept, internal tables can exist both as data types and as data objects A data type is the abstract description of an internal table, either in a program or centrally in the ABAP Dictionary, that you use to create a concrete data object. The data type is also an attribute of an existing data object.

Extracts Since internal tables have fixed line structures, they are not suited to handle data sets with varying structures. Instead, you can use extract datasets for this purpose. An extract is a sequential dataset in the memory area of the program. You can only address the entries in the dataset within a special loop. The index or key access permitted with internal tables is not allowed. You may only create one extract in any ABAP program. The size of an extract dataset is, in principle, unlimited. Extracts larger than 500KB are stored in operating system files. The practical size of an extract is up to 2GB, as long as there is enough space in the filesystem. An extract dataset consists of a sequence of records of a pre-defined structure. However, the structure need not be identical for all records. In one extract dataset, you can store records of different length and structure one after the other. You need not create an individual dataset for each different structure you want to store. This fact reduces the maintenance effort considerably. In contrast to internal tables, the system partly compresses extract datasets when storing them. This reduces the storage space required. In addition, you need not specify the structure of an extract dataset at the

beginning of the program, but you can determine it dynamically during the flow of the program. You can use control level processing with extracts just as you can with internal tables. The internal administration for extract datasets is optimized so that it is quicker to use an extract for control level processing than an internal table.

Q5. SAP ERP System contains a lock mechanism, fully independent of database locks, that allows you to set a lock that spans several dialog steps. These locks are known as SAP locks. Which of the following are functionalities of SAP Locks? A. The SAP lock concept is based on lock objects B. Before you can set an SAP lock in an ABAP program, you must first create a lock object in the ABAP Dictionary. C. There are three types of locks in the system, shared, logical and exclusive D. When you create a lock object, the system automatically creates two function modules. Answer: A, B, D

The SAP lock concept is based on lock objects. Lock objects allow you to set an SAP lock for an entire application object. An application object consists of one or more entries in a database table, or entries from more than one database table that are linked using foreign key relationships. Before you can set an SAP lock in an ABAP program, you must first create a lock object in the ABAP Dictionary. A lock object definition contains the database tables and their key fields on the basis of which you want to set a lock. When you create a lock object, the system automatically generates two function modules with the names ENQUEUE_<lock object name> and DEQUEUE_<lock object name> . You can then set and release SAP locks in your ABAP program by calling these function modules in a CALL FUNCTION statement.

Lock Types There are two types of lock in the R/3 System: Shared lock Shared locks (or read locks) allow you to prevent data from being changed while you are reading it. They prevent other programs from setting an exclusive lock (write lock) to change the object. It does not, however, prevent other programs from setting further read locks. Exclusive lock Exclusive locks (or write locks) allow you to prevent data from being changed while you are changing it yourself. An exclusive lock, as its name suggests, locks an application object for exclusive use by the program that sets it. No other program can then set either a shared lock or an exclusive lock for the same application object.

Q6. When you create a function module, you can set the Process Type attribute to one of the following values: A. Update with immediate start B. Update without immediate start C. Updated with Manual start D. Update with Delayed start

Answer: A, D To be able to call a function module in an update work process, you must flag it in the Function Builder. When you create the function module, set the Process Type attribute to one of the following values: Update with immediate start Set this option for high priority ("V1") functions that run in a shared (SAP LUW). These functions can be restarted by the update task in case of errors. Update w. imm. start, no restart Set this option for high priority ("V1") functions that run in a shared (SAP LUW). These functions may not be restarted by the update task. Update with delayed start Set this option for low priority ("V2") functions that run in their own update transactions. These functions can be restarted by the update task in case of errors.

Q7. From Release 6.10, ABAP supports multi-byte coding for characters in Unicode. A. True B. False Answer: A

From Release 6.10, ABAP supports multi-byte coding for characters in Unicode. Prior to Release 6.10, ABAP used only character sets that were based on single-byte codes such as ASCII and EBCDIC or double-byte codes, such as SJIS and BIG5. This switch to Unicode affects all statements where an explicit or implicit assumption is made about the internal length of a character. If you use these statements in a program that is designed to exploit the Unicode capabilities of the runtime environment, they must be checked and changed if necessary.

Once a Unicode-enabled program has been changed accordingly, it behaves in the same way in both Unicode and non-Unicode systems. You can develop programs in a non-Unicode system (NUS) and then import them into a Unicode system (US). The following sections describe the conversions that are necessary:

Q8. Each ABAP program consists of self-contained processing blocks, which may occur in any order in the source code. Processing blocks are sections of programs, made up of structure blocks. Which of the statements about processing blocks are True? A. They can be processed sequentially or in parallel. B. They can be called from within a program, or from outside an ABAP program C. To start an ABAP program, at least one of its processing blocks must be started from outside the program itself. Answer: B, C Processing Blocks are processed sequentially. Each ABAP program consists of self-contained processing blocks, which may occur in any order in the source code. Processing blocks are sections of programs, made up of structure blocks. They are processed sequentially. A processing block can be called either from outside the ABAP program, or from a processing block within the same ABAP program (see also Structure of ABAP Programs). When a processing block is called from outside the program, it can be called either by the ABAP runtime environment or another ABAP program.

To start an ABAP program, at least one of its processing blocks must be started from outside the program itself. Each ABAP program has a program type, which determines whether and how a program can be run.

Q9. Some ABAP programs can be run by a user by entering the program name or a transaction code. These programs are of type? A. Type 1 B. Type M C. Type F D. Type K Answer: A, B The following gives an overview of the ABAP program types: Type 1 You can start a type 1 program by entering its program name. For this reason, they are also known as executable programs. When you start a type 1 program, processors are started in the runtime environment that call a series of processing blocks (event blocks) in a predefined sequence. The sequence is oriented towards reporting tasks. This is why executable programs are also known as reports. A special type of type 1 program is a logical database. You can start logical databases

together with reports. A logical database contains subroutines that are called by an invisible system program in a prescribed sequence for type 1 programs. The subroutines make certain reporting functions reusable. For further information, refer to Logical Databases. Type M Type M programs can only be started using a transaction code. A transaction code starts a screen, which consists of the screen itself and its flow logic. Screen flow logic can call special processing blocks (dialog modules) in the corresponding ABAP program. Since type M programs contain mostly dialog modules, they are known as module pools.

Programs that Cannot Be Run Directly These programs cannot be started directly by a user. Instead, they contain processing blocks or other source code that can only be used by an application program that is already running. They are described in more detail in a later section. Type F Type F programs are not executable. They serve as a container for function modules. When you call a function module from an ABAP program, the entire main program is loaded into the internal session of the current program. Since type M programs contain mainly function modules, they are known as function groups. Function modules are a type of procedure. They are described in more detail in the Procedures section. Type K Type K programs are not executable. They are container programs for global classes, and are known as class definitions. Classes belong to ABAP Objects and are described in more detail in that section. Type J Type J programs are not executable. They are container programs for global interfaces, and are known as interface definitions. Type S Type S programs are not executable. They are container programs for subroutines that should only be called

externally. When you call a subroutine from an ABAP program, the entire main program is loaded into the internal session of the current program. Since type S programs contain mainly subroutines, they are known as subroutine pools. Subroutines are a type of procedure. Type I Type I programs cannot be run directly, and contain no callable processing blocks. They are used exclusively for modularizing ABAP source code, and are included in other programs.

Q10. Class-based exceptions are handled in a control structure that has the following elements: A. Try block B. Catch block C. Delete block D. Erase block Answer: A, B Class-based exceptions are handled in the following control structure: TRY. ... " TRY block (application coding) CATCH cx_... cx_... ... ... " CATCH block (exception handler) CATCH cx_... cx_... ... ... " CATCH block (exception handler) ... CLEANUP. ... " CLEANUP block (cleanup context) ENDTRY.

TRY Block The TRY block contains the application coding whose exceptions are to be handled. This statement block is processed sequentially. It can contain further control structures and calls of procedures or other ABAP programs. If an exception occurs in the TRY block or in a procedure called up here, the system starts

by searching for a CATCH statement of the same TRY-ENDTRY structure. It then searches from the inside out for a CATCH statement in any enclosing TRY-ENDTRY structures that handle the event. The system may call this handler. If the system does not find a handler, but the TRY-ENDTRY structure is contained in a procedure, it tries to propagate the exception to the caller. Exceptions cannot be propagated in any processing blocks without a local data area (event blocks, dialog modules). A runtime error occurs immediately if the handler is missing. If no exceptions occur in the TRY block, program execution is continued directly after ENDTRY after the block has been completed.

CATCH Block A catch block contains the exception handler that is executed when a particular exception has occurred in the TRY block of the same TRY-ENDTRY structure. A TRY-ENDTRY structure can contain several exception handlers. The syntax for introducing an exception handler is: CATCH cx_... cx_... INTO ref. Any number of exception classes can be specified after CATCH. This defines an exception handler for all the specified exception classes and their subordinate classes. After an exception occurs, the system searches through the listed exception handlers in the specified order. The first exception handler whose CATCH statement contains the corresponding exception class or one of its superclasses is executed. The system then continues program execution directly after ENDTRY. No subsequent exception handlers are considered. For this reason, the order of the different exception handlers within a TRY-ENDTRY structure must be based on the inheritance hierarchy of the specified exception classes.

CLEANUP Block

If the system does not find a handler for an exception in a TRY-ENDTRY structure, it searches for a handler in the enclosing TRY-ENDTRY structures from the inside out (as mentioned above). If the system does not find a handler here, it tries to propagate the exception to a procedure caller. Precisely one CLEANUP block can be defined in each TRY-ENDTRY structure. If the system has not found a handler for an exception, but the exception is handled in an enclosing TRY-ENDTRY structure or is propagated to a caller, the block is executed before the TRY-ENDTRY structure is exited. In the CLEANUP block, cleanup work can be executed for the context of the TRY block. For example, objects often have to be brought into a consistent state or external resources, to which an external handler no longer has access, have to be released. The nesting of TRY-ENDTRY blocks and the possible propagation of exceptions may mean that several CLEANUP blocks are executed before an exception is actually handled.

Q11. In a loop, a statement block is executed several times in succession. Some of the different kinds of loops in ABAP are: A. Unconditional loops using the DO statement B. Conditional loops using the WHILE statement C. Loops through internal tables using the LOOP statement D. Unconditional loops using the WHILE statement Answer: A, B, C

The different types of loop statements are: Unconditional loops using the DO statement. Conditional loops using the WHILE statement. Loops through internal tables and extract datasets using the LOOP statement. Loops through datasets from database tables using the SELECT statement.

Unconditional Loops To process a statement block several times unconditionally, use the following control structure: DO [<n> TIMES] [VARYING <f> FROM <f1> NEXT <f 2>]. <Statement block> ENDDO. If you do not specify any additions, the statement block is repeated until it reaches a termination statement such as EXIT or STOP (see below). The system field SY-INDEX contains the number of loop passes, including the current loop pass. Use the TIMES addition to restrict the number of loop passes to <n>. <n> can be literal or a variable. If <n> is 0 or negative, the system does not process the loop. If you do not use the TIMES option, you must ensure that the loop contains at least one EXIT or STOP statement to avoid endless loops. You can assign new values to a variable <f> in each loop pass by using the VARYING option. You can use the VARYING addition more than once in a DO statement. <f 1 > and <f 2 > are the first two fields of a sequence of fields the same distance apart in memory and with the same type and length. In the first loop pass, <f> takes the value <f 1 >, in the second loop pass, <f 2 >, and so on. If you change the value of the field <f> within the DO loop, the value of the current field <f i > is also changed. You must ensure that there are not more loop passes than fields in the sequence, otherwise a runtime error occurs.

Conditional Loops To repeat a statement block for as long as a certain condition is true, use the following control structure: WHILE <condition> [VARY <f> FROM <f1> NEXT <f 2>]. <statement block> ENDWHILE. <condition> can be any logical expression. The statement block between WHILE and ENDWHILE is repeated as long as the condition is true or until a termination statement such as EXIT or STOP occurs.

The system field SY-INDEX contains the number of loop passes, including the current loop pass. The VARY option of the WHILE statement works in the same way as the VARYING option of the DO statement (see above).

Terminating Loops ABAP contains termination statements that allow you to terminate a loop prematurely. There are two categories of termination statement - those that only apply to the loop, and those that apply to the entire processing block in which the loop occurs. The STOP and REJECT statements belong to the latter group. The termination statements that apply only to the loop in which they occur are CONTINUE, CHECK, and EXIT. You can only use the CONTINUE statement in a loop. CHECK and EXIT, on the other hand, are contextsensitive. Within a loop, they only apply to the execution of the loop itself. Outside of a loop, they terminate the entire processing block in which they occur (subroutine, dialog module, event block, and so on). CONTINUE, CHECK, and EXIT can be used in all four loop types in ABAP (DO, WHILE, LOOP, and SELECT).

1. ABAP has built-in types such as C, I, N, STRING, or X. If you use these types for defining data objects, which of the following statements is true? Only one answer is correct. 1. If you want to define a two-byte integer data object, you use the following syntax: DATA xyz(2) TYPE i. FALSE 2. If you create a data object without explicitly specifying its type, it will become type C with length one. TRUE 3. If you define a data object with type D, two or four digits will be reserved for the year, depending on the user's settings. FALSE 4. A data object of type STRING has a fixed length that will automatically be set when the first value is assigned to this data object. This length cannot be adjusted thereafter. FALSE 2. Some ABAP statements require an explicit end, such as SELECT loops, FORM definitions, or IF clauses. Which of the following ABAP statements can be nested? There is more than correct answer.

1. One inner SELECT ... ENDSELECT in an outer SELECT ... END-SELECT. TRUE 2. One inner FORM ... ENDFORM in an outer FORM ... ENDFORM. FALSE 3. One inner CASE ... ENDCASE in an outer CASE ... ENDCASE. TRUE 4. One inner CLASS ... ENDCLASS in an outer CLASS ... ENDCLASS. FALSE 3. The concept of visibility of components is well-known in object-oriented languages. Which of the following statements are true with regard to ABAP objects? There is more than one correct answer. 1. A programmer can, but need not, determine the visibility of a component. The default visibility of a component is PRIVATE. FALSE 2. A PRIVATE component of a class can be accessed in all methods of that class. TRUE 3. A PROTECTED method METH that is defined in a class SUPER can be overwritten (redefined) in an inherited class SUB. TRUE 4. All components of inherited classes are PUBLIC. FALSE 4. Customer exits are among the most frequently used enhancement concepts in ABAP. Which of the following statements about customer exits is true? There is only one correct answer. 1. If a customer exit is not implemented, the program offering this customer exit will dump (terminate abnormally) at runtime. FALSE 2. Within one SAP system, a customer exit can have a maximum of one implementation. TRUE 3. Within one client of an SAP system, a customer exit can have multiple implementations. FALSE 4. Once a customer exit has been implemented in an SAP system, the implementation can be changed, but it can no longer be deactivated. FALSE 5. Internal tables are used in ABAP to store mass data. Which of the following statements about the relationship between internal tables and database tables is true? Only one answer is correct. 1. An internal table can be linked to a database table so that the content of the internal table is updated automatically as soon as the content of the database table changes. FALSE 2. A database table XYZ can be used for the definition of an internal table like this: DATA itab TYPE TABLE OF xyz. TRUE 3. A database table in the dictionary can be defined with reference to an internal table from an ABAP program. FALSE 4. If you have a huge number of rows to be dealt with in a program, it might improve the program's performance if you define a database table in the program instead of an internal table. FALSE 6. There are three types of SELECT statements: SELECT SINGLE, SELECT ... ENDSELECT, and SELECT ... INTO TABLE. The SELECT ... ENDSELECT statement is also known as the SELECT loop. Which of the following statements are true about SELECT ENDSELECT? More than one answer is correct. 1. A work area (structure) is required for the selected rows. This work area can be given explicitly (with INTO) or implicitly (if a TABLES declaration is used). TRUE 2. The database will transport individual rows to the database interface. FALSE 3. The database will transport blocks of rows to the database interface. TRUE 4. The system field sy-tabix counts the number of selected table rows. FALSE 7. In a program, you need an elementary data object for some calculations. Which of the following are possible ways to specify its type? There is more than one correct answer. 1. Refer to a domain. FALSE 2. Refer to a data element. TRUE 3. Refer to a field of a database table. TRUE 4. Refer to a field of a search help. FALSE

8. In a report, you want to define a SELECT-OPTION so_xyz. Which of the following is a way to define its type? There is only one correct answer. 1. Refer to a table type directly, using TYPE. FALSE 2. Refer to a previously defined elementary data object in the same program, using LIKE. FALSE 3. Refer to a previously defined elementary data object in the same program, using FOR. TRUE 4. Refer to a dictionary table type with columns SIGN, OPTION, LOW, and HIGH, using FOR. FALSE 9. The event concept is vital for selection-screens. Which of the following usages of events make sense for selectionscreens? There is more than one correct answer. 1. Use INITIALIZATION for setting values for SELECT-OPTIONS. TRUE 2. Use AT SELECTION-SCREEN for hiding fields on the selection-screen. FALSE 3. Use AT SELECTION-SCREEN OUTPUT for checking user entries. FALSE 4. Use AT SELECTION-SCREEN ON pa_car for checking the user entry in the PARAMETER pa_car. TRUE 10. The SAP List Viewer, commonly known as the ALV, is a powerful tool for displaying data. Among the various ALV types, the ALV Grid Control is used for displaying non-hierarchical table data. Which of the following statements about the ALV Grid Control is true? Only one answer is correct. 1. The ALV Grid Control can be integrated into a list, a selection-screen, and a classical screen (dynpro). FALSE 2. By default, a column header will be taken from the data element which is used for specifying the type of the column. TRUE 3. When a report with an ALV Grid Control is executed in background processing, the program will terminate abnormally since controls cannot be addressed in background processing. FALSE 4. The ALV display is automatically refreshed when the data in the database table are changed. FALSE

Вам также может понравиться