You are on page 1of 9

Introduction to ABAP Programming

Study Questions and Answers

1. Distinguish between different ABAP program terms. Program: A series of ABAP statements. Report: An ABAP program whose output is a list. List: The output generated by an ABAP report program. Module Pool: A dialog program (online program) which is a collection of screens. 2. Know the ABAP editor functions, commands, and modes. ABAP Editor modes: PC Mode with line numbering (preferred) [new to 3.0] PC Mode without line numbering [new to 3.0] Command mode [same as vers 2.2] (allows the use of line commands) 3. What within the ABAP editor allows you to cut and paste program code for use within/outside of R3? How many of these exist? The clipboards allow you to mark a block of lines by using the Select command (Block/Clipboard -> Copy + Insert -> Select), copy the block to a clipboard, and insert it again wherever you want. There are four clipboards: x, y, z, and a general clipboard. All four of these clipboards allow you to cut/copy and paste between programs. The general clipboard can be used to cut/copy and paste into Windows applications. Also available for moving lines within a program: COPY TO BUFFER and INSERT FROM BUFFER. 4. Distinguish between Conventional versus Interactive Reporting. Conventional Reporting - The only user intervention occurs before any processing begins (i.e., the selection screen). The report program is initiated and produces a report without prompting the user for additional input. It is characterized by: extensive lists, frequent hardcopy printouts, and detailed information combined with compressed data. Interactive Reporting - The user controls the output of the report by interacting with the program as input is needed. Processing can be determined by events triggered by the users actions (dialog driven). It is characterized by: screen-oriented, short basic lists, compressed data in the basic list, detailed information in secondary lists or windows, and function key driven. 5. Explain the concept of chaining statements. Successive statements starting in the same way can be joined together. Enter the command followed by a colon (:), then separate each chain statement component by a comma (,) (e.g., WRITE: xyz, NAME1, COUNTER.). 6. Indicate various ways to indicate a comment line within an ABAP program. An * in column 1 makes the entire line a comment A anywhere on the line makes the remainder of the line a comment You can also comment and uncomment selected lines of code using the Block\clipboard menu option Insert Comment * and Delete Comment *. 7. What attributes can be specified when creating a new ABAP program? Which are
Page 1 March, 2001 Version 2.0

Introduction to ABAP Programming

Study Questions and Answers

required? The required attributes are the title, type, and application. Others that can be specified are the class, status, etc. (see create program screen). 8. How many methods are there for activating numbered texts? Describe them. The numbered texts are available only for that program. The first method (TEXT-XXX) is just saved under GOTO -> TEXT ELEMENTS > TEXT SYMBOLS and is active within the program. The second method (string(xxx) ) you use the subfunction COMPARE TEXT SYMBOLS (on the text elements screen) to ensure that the text in the program is identical to the text in the text pool, and that the strings from the program text are transferred to the text pool. Text elements are accessed either by GOTO -> TEXT ELEMENTS > TEXT SYMBOLS or by double clicking on the TEXT-XXX syntax in the code. 9. Where do you maintain column headings with ABAP? How many lines of column headings can be maintained? GOTO-->TEXT ELEMENTS-->TITLES and HEADERS. Up to four lines of column headings are possible. 10. Know the valid ABAP data types and their attributes. Valid ABAP data types: Type Meaning initial value default length C text Blank 1 N numeric text 00..0' 1 D date(yyyy/mm/dd) 00000000' 8 T time(hhmmss) 000000' 6 I integer 0 11 P packed number 0 16 F floating point no. 0.000..... 24 X hexadecimal X00' 2

allowed length 1-max. 1-max. 8 6 1-16 1-max.

11. If you want to define a value with decimal places for a field of type P, how must it be defined? If you want to assign a value with decimal places to a field of type P (or F), you must define it as a text literal (e.g., DATA: variable_name TYPE P DECIMALS 2 value 10.12) because the decimal point would be considered the statement-ending period if it is not within single quotes.

Page 2

March, 2001 Version 2.0

Introduction to ABAP Programming

Study Questions and Answers

12. What ABAP statements allow you to define data? DATA PARAMETERS CONSTANTS Note: With the TYPES statement, you can declare a program-specific data type. This data type can then be used to define data in the program. 13. What does the LIKE parameter do? Used to define fields with the same format (i.e., data type and length) as a field which has already been defined. Optimizes system use. As long as a table or structure work area has been defined with the TABLES statement, you can use LIKE with any of the fields in the table/structure. The exception is with system fields, which do not need the SYST table declared in order to be used. 14. What does the VALUE parameter do? It allows you to specify a default value for a field. With the keyword VALUE, only a number or a literal (no variables) may be assigned to a field. The VALUE parameter is required for a CONSTANT definition (4-5). 15. What is a field symbol? What can it refer to? A field symbol is a place holder for a field. A field symbol does not physically reserve space for the field, but points to the field. It is a means for accessing fields and contents dynamically. The FIELD-SYMBOLS statement is used to declare a field symbol which can be replaced at runtime by a certain field. All operations involving the field symbol are then carried out using the field assigned to them. Field symbols can refer to fields and field strings. They can also refer to structures which have been defined with the TABLES statement. 16. What ABAP statement points a field to a field symbol? What is the syntax of this statement? When is this statement processed? ASSIGN is the statement that points a field to a field symbol. See the following example: FIELD-SYMBOLS ASSIGN COUNTER TO <F>. This is processed at runtime.

Page 3

March, 2001 Version 2.0

Introduction to ABAP Programming

Study Questions and Answers

17. How do you debug an ABAP program within R3? There are multiple ways to activate debugging--name them. Use the Online Debugging Tool to debug a program. Specific variables can be monitored using the debugger as well as internal tables and fields of transparent tables. The code can be navigated through by single stepping through single lines of code, single modules of code, until a breakpoint, or until the end of a program. Activating debugging can be done in several ways: 1. Set breakpoints using the BREAKPOINT pull-down menu and choosing SET. 2. Type /h in the command field at any point during execution of a program. 3. Code in the statement BREAKPOINT or BREAK <user name>. 4. Use the Execute pushbutton on the object list and choose debugging mode in the dialog box which follows. 18. Know all functions within the ABAP debugger. Single Step: executes one line of code. Execute: executes all processing steps belonging to one line. Continue: processes until next breakpoint or until end or program. Table: displays the contents of an internal table. 19. Understand the ABAP (Open SQL) SELECT statement. What are the various forms and syntax of the SELECT statement? (See Help on SELECT) [SELECT is used to read table entries (records) from a database table. It can read into an internal table. A loop is performed between the SELECT/ENDSELECT statements.] SELECT * FROM <database_table>. SELECT * FROM <database_table> INTO <internal_table>. SELECT * INTO <table_workarea> FROM <database_table>. SELECT * FROM <database_table> APPENDING TABLE <internal_table>. SELECT SINGLE * FROM <database_table> WHERE <primary_key .... SELECT COUNT (*) FROM database_table. SELECT <col_1> <col_2> ... FROM <database_table> INTO (<var1>, <var2> ...). SELECT <col_1> <col_2> ... FROM <database_table> INTO <internal_table>. SELECT DISTINCT <column> FROM <database_table>. 20. Identify the ABAP string comparison operators and know how to use them. CO s1 contains only characters from s2 CA s1 contains at least one of the characters from s2 CS s1 contains the string s2 CP s1 contains the pattern specified in s2 (* any string, + any character, # escape symbol) CN s1 contains not only characters from s2 NA s1 contains not any characters from s2 NS s1 contains no string s2 NP s1 contains no pattern specified in s2

Page 4

March, 2001 Version 2.0

Introduction to ABAP Programming

Study Questions and Answers

21. What are the logical operators within ABAP? NOT, AND, OR. The processing order for the logical operators is NOT AND OR. 22. What is an alternative to the ABAP IF statement? CASE statement. Only one of the statement sequences shown is processed. CHECK <logical expression>. ON CHANGE OF (if different from initial value). 23. What ABAP statements facilitate a looping structure? DO... ENDDO. If you dont include n times parameter, you must include a termination condition within the loop statement. WHILE <logical expression>... ENDWHILE. SELECT... ENDSELECT LOOP AT <internal table>... ENDLOOP. 24. What ABAP statements allocate values to fields? MOVE-CORRESPONDING MOVE CLEAR (resets all specified fields to their initial value) REFRESH READ SET ***** VALUE (with a DATA statement) DEFAULT (with a PARAMETERS statement) ASSIGN SELECT (COMPUTE)

Page 5

March, 2001 Version 2.0

Introduction to ABAP Programming

Study Questions and Answers

25. Know how to create an internal table (with or without a header line) within an ABAP program. With a header line: TYPES: BEGIN OF TAB, ... END OF TAB. DATA: ITAB TYPE STANDARD TABLE OF TAB INITIAL SIZE <n> WITH HEADER LINE. Without a header line: Types: BEGIN OF TAB, ... END OF TAB. Data: ITAB TYPE STANDARD TABLE OF TAB INITIAL SIZE <n> , ITAB_WA TYPE TAB. 26. Identify the various system fields applicable to internal table processing. SY-TABIX : set to the index value of internal table line which has been placed in the header line. SY-SUBRC : set after a READ TABLE statement (for a single entry). If the read access was successful, a zero is returned. 27. Identify and distinguish between the various ABAP commands used in internal table processing. APPEND: appends a record to the end of an internal table. COLLECT: includes a record in the table as a new entry or adds it to an existing entry of the same type. SORT <> BY <>. (ASCENDING, DESCENDING). LOOP AT. ........ENDLOOP. INSERT: new line is inserted before the current line. MODIFY: current line is overwritten with the contents of the header line or work area. DELETE: current line is deleted. READ: reads a line from the table into the header line or work area. CLEAR: initializes (by type) all single fields in the header line or work area of an internal table. REFRESH: deletes all table lines but does not release table storage space. Header line or work area remains unchanged. FREE: deletes all table lines, releases table storage space. Header line or work area unchanged. Remember that some of these statements change when dealing with internal tables without header lines. 28. What is the function and syntax of the ABAP DESCRIBE statement? DESCRIBE TABLE <int. table> LINES <var1> OCCURS <var2>.
March, 2001 Version 2.0

Page 6

Introduction to ABAP Programming

Study Questions and Answers

The describe statement provides information about an internal table by using the LINES parameter which reports how many existing table entries there are, and OCCURS, which contains the value specified in the table definition. You must use at least one of the two parameters with the DESCRIBE TABLE statement. 29. What is the purpose and syntax for calling the SAP editor within an ABAP program? What values would SY-SUBRC have and under what conditions? If you wanted to manually update the values in an internal table it would be done through the SAP editor using the EDITOR-CALL FOR <int.table> statement. The internal table is displayed and can be processed using the editor utilities. The command U (update) returns the table to the report with the appropriate changes. The SY-SUBRC values are: 0: editor left with U, SAVE, or F11. 4: editor left with BACK, CANCEL, EXIT, F3, F12, F15. 30. How do you display a directory of existing function modules? Click on the light blue i (help) icon and select the Function option. You may specify the function module name or use the masking characters + or * in the entry. You can also use DEVELOPMENT > FUNCTION BUILDER (transaction SE37) menu path in the ABAP Workbench to display/change/create function modules. 31. What do you define within a function module to raise error conditions? How do you check for these conditions within an ABAP program? You define Exceptions. If an exceptional situation arises during processing, it can either be processed in the module itself (through an error message) or control can be returned to the calling program and the problem processed there. This second method is only possible with the EXCEPTIONS parameter listing the occurring exception. SY-SUBRC is set to the exception code when control is returned to the calling program; therefore, you check SYSUBRC after the CALL FUNCTION statement in the calling program to see if an exception occurred in the function module.

Page 7

March, 2001 Version 2.0

Introduction to ABAP Programming

Study Questions and Answers

32. What statement within an ABAP program invokes a function module? CALL FUNCTION <function_module_name > EXPORTING.....(parameters to be passed to the function module - passed by value by default) IMPORTING.....(parameters passed back from the function module - also passed by value by default) CHANGING.....(parameters that are both passed to the function module and returned from the function module - passed by value and result by default) TABLES.....(internal tables passed to the function module - passed by reference by default) EXCEPTIONS.....(return codes passed back to the calling program for error handling) 33. What are the four categories of SAP data? 1. Master data: changes relatively rarely (for example, customer or vendor master data) 2. Transaction data: kept for only a limited time in the system together with any associated index tables (for example, invoices or purchase orders) 3. Organization and customizing data: information about business configuration 4. System-specific data: texts, ABAP programs, and so on. 34. What is an ABAP event? What does it introduce within your program? Know the various ABAP event keywords covered in this course and their function. An event is a block of code introduced by an event keyword. It is terminated by either an event key word, a subroutine, or the end of the program. Various events include: START-OF-SELECTION END-OF-SELECTION TOP-OF-PAGE TOP-OF-PAGE DURING LINE-SELECTION END-OF-PAGE AT LINE-SELECTION AT PFnn AT USER-COMMAND INITIALIZATION AT SELECTION-SCREEN 35. What ABAP statements allow the user to impose limits on the database selections of the report program at execution time? PARAMETERS: <field>. <field> as CHECKBOX. <field> RADIOBUTTON GROUP <group name>. <field> MATCHCODE OBJECT <object name>. SELECT-OPTIONS <selection name> FOR <database field>. SELECTION-SCREEN FUNCTION KEY <n>. SELECTION-SCREEN PUSHBUTTON <pbname> USER-COMMAND <ucomm>. Additionally, if a logical database is defined in the program attributes, a database oriented selection screen will be automatically generated according to the tables defined in the
March, 2001 Version 2.0

Page 8

Introduction to ABAP Programming


TABLES statement.

Study Questions and Answers

36. To use the SELECT SINGLE ABAP statement, what must be known? The full primary key must be known. The full key of the table must be entered in the WHERE clause. An ENDSELECT is not needed. 37. In what table are user messages stored? Dialog messages are stored in table T100. Types of messages: A (abend); E (error); I (information); S (confirmation); W (warning). 38. How many variables can be contained in an ABAP message statement? A maximum of 4 variables may be contained in a message statement (indicated by an & when defining the actual message). 38. What is a data cluster? A grouping of data objects (fields, field strings, internal tables). They are processed with IMPORT/EXPORT; sent to memory as a group. 39. What statements process a data cluster? Do you know the syntax? The EXPORT, IMPORT, and DELETE commands process a data cluster. see Data Interfaces, Lecture 1 for more information on EXPORT/IMPORT. 40. What is accomplished with the ABAP RANGES statement? What is the structure of what is created with the RANGES statement? An internal table is defined similar to the structure of selection criterion <xx> defined using the SELECT-OPTIONS <xx> FOR <field> statement. This internal table has four fields: sign (I for inclusive, E for exclusive), option (e.g., BT for between, EQ for equal), low, and high. The internal table must be filled in the program and can be used in a WHERE clause or with a SUBMIT statement as a selection set for one selection field. RANGES is used to define an internal table used for arguments in a report. See HELP on RANGES.

Page 9

March, 2001 Version 2.0

You might also like