Vous êtes sur la page 1sur 15

Reports and Transactions:

1. What is LDB. Disadvantages of LDB and also advantages. Logical Database is special ABAP program. Its nested select statements. Advantages: If you use LDB, it retrieves data as per foreign key relations from different tables. You need not know the relations among tables. Disadvantages: Runtime will be increased if you use LDB. 2. What are the events associated with LDB and their purpose. GET and GET LAST. GET will be triggered for each record and retrieves a record. GET LAST will be triggered at end of each record. 3. In which order they will be triggered. First Get and then Get last of same table. 4. How will you change the selection screen of a LDB. Selection screen can be changed through you add selection screen option in the program, these will be automatically added to LDB selection screen for this program. 5. Where you attach the LDB to a report. One is Attributes, two at report header. 6. How many LDBs you can use in a Report. Only one. 7. Order of events triggered during execution of report program. Initialization, selection-screen, at selection-screen, start-of-selection etc 8. How to get help and/or possible values for selection screen fields Events AT SELECTION-SCREEN ON HELP REQUEST and AT SELECTION-SCREEN ON VALUE REQUEST. 9. How many secondary lists you can have in a report. 20 secondary list and 1 basic list. 10. What are events, which triggers secondary lists. At line-selection, At PFnn, At User-command. 11. What is the purpose of HIDE statement. Any other methods other than HIDE for same purpose. Hide will help in transferring data from basic list to secondary list or one list to other list. Other methods are GET CURSOR and SY-LISEL. 12. What are the different techniques for Data processing/refining in ABAP reports. 1. Internal Tables. 2. Extracts (Field Groups) 13. Can you put a SQL Join statement in ABAP? If yes, How Through alias (only in 4.0 and above versions) 14. What is the system variable, which tells about number database records handled.

SY-DBCNT 15. What are different techniques available for modularization. Internal Subroutines, External Subroutines, Macros, Function modules and Include programs. 16. What are different types of internal tables and their usage. Standard Internal Tables Standard tables have a linear index. You can access them using either the index or the key. If you use the key, the response time is in linear relationship to the number of table entries. The key of a standard table is always non-unique, and you may not include any specification for the uniqueness in the table definition. This table type is particularly appropriate if you want to address individual table entries using the index. This is the quickest way to access table entries. To fill a standard table, append lines using the (APPEND) statement. You should read, modify and delete lines by referring to the index (INDEX option with the relevant ABAP command). The response time for accessing a standard table is in linear relation to the number of table entries. If you need to use key access, standard tables are appropriate if you can fill and process the table in separate steps. For example, you can fill a standard table by appending records and then sort it. If you then use key access with the binary search option (BINARY), the response time is in logarithmic relation to the number of table entries. Sorted Internal Tables Sorted tables are always saved correctly sorted by key. They also have a linear key, and, like standard tables, you can access them using either the table index or the key. When you use the key, the response time is in logarithmic relationship to the number of table entries, since the system uses a binary search. The key of a sorted table can be either unique, or non-unique, and you must specify either UNIQUE or NON-UNIQUE in the table definition. Standard tables and sorted tables both belong to the generic group index tables. This table type is particularly suitable if you want the table to be sorted while you are still adding entries to it. You fill the table using the (INSERT) statement, according to the sort sequence defined in the table key. Table entries that do not fit are recognised before they are inserted. The response time for access using the key is in logarithmic relation to the number of table entries, since the system automatically uses a binary search. Sorted tables are appropriate for partially sequential processing in a LOOP, as long as the WHERE condition contains the beginning of the table key. Hashed Internal Tables Hashes tables have no internal linear index. You can only access hashed tables by specifying the key. The response time is constant, regardless of the number of table entries, since the search uses a hash algorithm. The key of a hashed table must be unique, and you must specify UNIQUE in the table definition. This table type is particularly suitable if you want mainly to use key access for table entries. You cannot access hashed tables using the index. When you use key access, the response time remains constant, regardless of the number of table entries. As with database tables, the key of a hashed table is always unique. Hashed tables are therefore a useful way of constructing and using internal tables that are similar to database tables. 17. One of my users has access to SE38 transaction, and so he can run the program developed by you. You have attached this report/transactional program to a particular Z* transaction. To restrict the users to Execute this program, what you do it from programming side? Check for Authorization object S_TCODE with value Z---- in initialization event. (Code: Authority-check object 'S_TCODE' id 'TCD' field 'ZBC_REQ'.)

18. We need to download an internal table to the Presentation Server (local workstation). Whenever we run the program, the same file has to be saved as a separate file in sequential order. Ex: 0001.txt, 0002.txt etc. Where can we store the last file number? SAP has a table TVARV for storing the variants. A record may be created in TVARV for all the programs that require these kind of incremental records. For Ex: the record could be 010ZBC_TEST MM sequence rec where first part consists of client code and the program being run. Client code is required because TVARV does not have a field for client code. The second part is the description indicating the purpose what the record is created. This entire string may be posted in the Name field (char - 30). The Type field (char- 1) may be populated with P or S (Parameter or Selection) Low field (char- 45) may be populated with '0001' when run first time and increment it by one in your program for downloading of the internal table. 19. When we create a customer the information is updated in structure RF02D and the Some tables like KNA1 are updated. How can we find the tables for master data transactions? Go to ABAP Workbench -> Overview -> application hierarchy - SAP -> (or SE81 transaction code) follow the customizing based tree for your application. Double click on a lowest level to get for the correct marked development class. Then, here you can find all the tables, views, logical databases etc..,

Sap BDC Interview Questions and Answers


Difference between /N and /BEND ?

/BEND terminates the batch input processing and sets the session to be failed. /N terminates the current batch input transaction. SM35 transaction . How to automate BDC ? After execution of batch input program , the session created is placed in the session queqe which can be viewed using SM35 transaction executing / Releseing the session will start the transfer of the data from the session into the database tables./ Update types in Call transaction method. What is the difference ? At present with SAP we have only modes of updation 1.Synchronus Update. 2.Asynchronous Update. There is no more Local Update. What are the table controls in BDC ? What is the difference between bdc and lsmw ? What is the difference between bdc and rfc ? BDC - Batch data communication in which there are 2 processes 1. in bound 2. outbound RFC - remote fucntion call(or) calling Data conversion experience? DATA CONVERSIONS: SAP HAS PROVIDED A TOOL NAMED LSMW WHICH CONVERTS THE LEGACY DATA INTO THE REQUIRED SAP FORMAT AND UPDATES THE DATABASE. Open datasets, Read datasets ( Reading and writing data to files)? Date Sets are nothing but files on Application Server,they can even be called as Sequential files. Open Dataset Is used to open required file on the application Server.

Read Dataset. Is used to read the contents required file on the application Server. How to do back ground processing in BDC Session method ? goto sm35 select the option background process Call transaction method, how to capture the errors ? IN CALL TRANSACTION TO CAPTURE THE ERRORS WE SHOULD PERFORM THE FOLLOWING. FIRST ME MUST DECLARE AN INTERNAL TABLE WITH THE STRUCTURE OF BDCMSGCOLL TABLE. THEN WHILE WRITING THE CALL TRANSACTION STATEMENT WE SHOULD PUT THE 'E' MODE FOR CAPTURING ALL THE ERRORS. THEN FINALLY THE CAPTURED ERRORS MUST TO SENT TO THE INTERNAL TABLE WHICH WE DECLARED IN THE BEGINNING WITH BDCMSGCOLL BY USING THE FUNCTION MODULE "FORMAT_MESSAGE" AND THUS THE ERROR MESSAGES WILL BE SENT TO THE INTERNAL TABLE WHICH WE DECLARED AT THE BEGINNING. How to load data from MS Excel sheet to SAP by using BDC method ? KCD_EXCEL_OLE_TO_INT_CONVERT even takes care of blank cells and is available in older versions of SAP * Add values to internal table SORT t_cells BY row col. LOOP AT t_cells INTO wa_cells. MOVE : wa_cells-col TO l_index. ASSIGN COMPONENT l_index OF STRUCTURE itab TO <f_value>. MOVE : wa_cells-value TO <f_value>. AT END OF row. APPEND itab CLEAR itab. ENDAT. ENDLOOP. What is the difference between call transaction and session method? Session method: The records are not added to the database until the session is processed. sy-subrc is not returned. Error logs are created for error records. Updation in database table is always Synchronous. Call Transaction method: The records are immediately added to the database table. sysubrc is returned to 0 if successful. Error logs are not created and hence the errors need to be handled explicitly. Updation in database table is either Synchronous or Asynchronous. SM35 transaction . How to automate BDC ? sm35 is used to play girls for better nightfalls. What is the difference between Upload and WS_Upload ? The diffrence between WS_Upload and Upload is when you use function Upload it prompts for a dailog box where in you need to key in the file location.Where as in case of WS_Upload you specify the file location in the function input parameters itself If I want to execute a program only in background not in foreground is there any option for this? The sm37 transaction can be used for running a program in the background. Also in the session method while processing the session you can specify the processing type as background or foreground.

What kind of BDC programs are written ?

There are five types of BDC methods available. They are 1.Batch input session 2.Call Transaction 3.Recording 4.Direct Input and 5.LSMW How to read files and process BDCs automatically? To read file from Presentation server use Upload or GUI Upload or WS upload and to read file from Application server use Opend Dataset,Read dataset and Close dataset In session method sy-subrc is not returned whereas in call transaction method sysubrc is returned . what does it mean? While to transfer the data from the through if any errors occurs until the errors are the complete the data is not transfer to the SAP system. the system compulsory shows the errors. that errors are stored into the error logs (Transaction is SM35). so the session method should not return any value. In call transaction method data is directly pass to the SAP system. So its compulsory return the value. Because of the call transaction is the function. A function should return the value mandatory. Recording Function With recording, user can avoid manual search for fields and tables required in a program including screen numbers. SHDB is the transaction code. BDC vs Direct Loads( have you used direct loads on SAP tables ) Direct loads is 5 times faster than uploading by normal BDC method. but some times while updating the database referential integrity is violated. Have you set up a back ground job ? How to create a background job without a variant ? Yes, user can create background job scheduling in two ways. 1. By calling the executable program RSBDCSUB 2. Transaction Code SM37
What is a report? Report is a program used to fetch data from the database tables and display it on the screen. It has 2 screens selection screen(optional) and list or output screen. When the TOP-OF-PAGE event does get triggered? TOP-OF-PAGE event will be triggered when the first ULINE, WRITE or SKIP statement occurs in a program. What is the difference between SKIP and RESERVE? SKIP provides empty space between lines, while RESERVE executes a page break on the current page if the number of lines between current line and the page footer is less than the number specified in RESERVE statement. What is the difference between SKIP and NEW-LINE? SKIP generates a blank line, while the NEW-LINE causes the control to move to next line. What is hotspot? Hotspot is an area on the list where the mouse pointer turns into an upright hand symbol. A single click on the hotspot does the same thing as a double-click. What does HIDE statement do? The HIDE statement hides the contents of the line along with the line numbers in a system defined HIDE area. This is used in interactive reporting. What are the events in classical reports?


20

INITIALIZATION AT SELECTION-SCREEN START-OF-SELECTION END-OF-SELECTION TOP-OF-PAGE END-OF-PAGE

How many detail lists can be created in interactive reporting?

What is the name of the system variable that holds the contents of the selected line in interactive reporting? SY-LISEL Can we set page headers to details lists? Yes. Use TOP-OF-PAGE DURING LINE-SELECTION event. What is an internal table? Internal table is a temporary table stored in the RAM of the application server. It gets created during the program execution and gets deleted once the program ends. Different types of internal table.

Standard table Sorted table Hashed table

What is the difference between COLLECT and APPEND statements? APPEND statement adds a new record to the end of the internal table. COLLECT statement adds a new record to the end of the internal table if there is no record already exists in the internal table with the same key. If a record exits in the internal table with the same key then COLLECT adds the numeric values in the work area to the existing record. How do you delete duplicate records from internal table? Use SORT and DELETE ADJACENT DUPLICATES statements to delete the duplicate records from internal table. How do you find number of records present in internal table? Use DESCRIBE TABLE statement. What is the difference between REFRESH and FREE statements? REFRESH clears the contents of the internal table but the memory remains allocated. FREE clears the contents of the internal table and releases the memory space. What are the different control break statements available inside a loop?

AT FIRST / ENDAT AT LAST / ENDAT AT NEW / ENDAT AT END OF / ENDAT SUM ON CHANGE OF / ENDON

What is the purpose of AT FIRST and AT LAST? AT FIRST is used to write headings and loop initialization process. AT LAST is used to write grand totals and loop termination processing. What is the purpose of SUM statement?

SUM statement is used to calculate the totals for the rows of a control level. Can we use ON CHANGE OF between SELECT and ENDSELECT? Yes. It can be used in any loop construct. It can be used within LOOP AT/ENDLOOP, SELECT/ENDSELECT, DO/ENDDO and WHILE/ENDWHILE.

What is Group by in Select statement?

Answer1: Group by is used to fetch a unique data from a column. Answer2: A "group by" is used to group selected rows in a table to perform arg functions on them. Rows not included in the "group by" clouse and not part of ARG functions cannot be used ...(logical grouping of data) or orerations performed (on groups of data) can be used with the "HAVING" clause to further refine the output. ex of some ARG functions : SUM() , MIN(),MAX(), AVG()
Select statement to read data into internal tables. Types of Select statements

select * from database table into (internal table name) the above statement collects data into the header area of the internal table. and select * from database table into table (internal table name) the above statement collects the data into the body area directly .
Explain Commit and Roll back

The Oracle RDBMS provides a transaction model based on a unit of work. The PL/SQL language supports most, but not all, of the database model for transactions (you cannot, for example, ROLLBACK FORCE). Transactions begin with the first change to data and end with either a COMMIT or ROLLBACK. COMMIT makes the database changes permanent and visible to other database sessions. ROLLBACK undoes the changes made in the current transaction either to the beginning of the transaction or to a savepoint. A savepoint is a named processing point in a transaction, created with the SAVEPOINT statement. Rolling back to a savepoint is a partial rollback of a transaction, wiping out all changes (and savepoints) that occurred later than the named savepoint.
What happens Update command is used without where clause ?

Answer1: It will update all the records with same name in the particular field of the table. Answer2: If we dont mention "WHERE" clause in the UPDATE statement, it will update all records satisfying the given condition (if given any ) in the table ! Answer3: Based on query condition. it will update all the fields which are mentioned in the query. ex: update employee set firstname= @firstname,lastname=@lastname where

employee_id =@employee_id. so in the above case nothing wil be happen if you used where clause or not. if you have many statements in the query you need to use the where clause.
What are logical databases?

Answer1: insert' will add a new record or a new row into the database table. 'Update' will modify a record in the DB table. 'Modify' it is a combination of both insert and update... Answer2: INSERT - Add a new record into the database table. MODIFY - If record is available it modifies otherwise it wont modify. UPDATE - If record is available its update the record otherwise it creates a new record.
Difference between Insert, Update and Modify

INSERT - Add a new record into the database table. MODIFY - If record is available it modifies otherwise it wont modify. UPDATE - If record is available its update the record otherwise it creates a new record.
Catch Command

Trying to catch any runtime errors programmatically or manually we use this statement catch.
Can you create a table with fields not referring to data elements ?

YES. eg:- ITAB LIKE SPFLI.here we are referening to a data object(SPFLI) not data element. What are the different types of data dictionary objects? tables, structures, views, domains, data elements, lock objects, Match code objects.
What should be the approach for writing a BDC program ?

STEP 1: CONVERTING THE LEGACY SYSTEM DATA TO A FLAT FILE to internal table CALLED "CONVERSION". STEP 2: TRANSFERING THE FLAT FILE INTO SAP SYSTEM CALLED "SAP DATA TRANSFER". STEP 3: DEPENDING UPON THE BDC TYPE i)call transaction(Write the program explicity) ii) create sessions (sessions are created and processed. If success data will transfer).
What are the problems in processing batch input sessions and How is batch input process different from processing online ?

PROBLEMS: i) If the user forgets to opt for keep session then the session will be automatically removed from the session queue(log remains). However if session is processed we may delete it manually. ii)if session processing fails data will not be transferred to SAP database table.
What does an extract statement do in the ABAP program ?

Once you have declared the possible record types as field groups and defined their structure, you can fill the extract dataset using the following statements: EXTRACT. When the first EXTRACT statement occurs in a program, the system creates the extract dataset and adds the first extract record to it. In each subsequent EXTRACT statement,

the new extract record is added to the dataset EXTRACT HEADER. When you extract the data, the record is filled with the current values of the corresponding fields. As soon as the system has processed the first EXTRACT statement for a field group , the structure of the corresponding extract record in the extract dataset is fixed. You can no longer insert new fields into the field groups and HEADER. If you try to modify one of the field groups afterwards and use it in another EXTRACT statement, a runtime error occurs. By processing EXTRACT statements several times using different field groups, you fill the extract dataset with records of different length and structure. Since you can modify field groups dynamically up to their first usage in an EXTRACT statement, extract datasets provide the advantage that you need not determine the structure at the beginning of the program.
Can a transparent table exist in data dictionary but not in the data base physically ?

NO. TRANSPARENT TABLE DO EXIST WITH THE SAME STRUCTURE BOTH IN THE DICTIONARY AS WELL AS IN THE DATABASE,EXACTLY WITH THE SAME DATA AND FIELDS.
What is the step by step process to create a table in data dictionary ?

step 1: creating domains(data type, field length, range). step 2: creating data elements(properties and type for a table field). step 3: creating tables(SE11).
What is the typical structure of an ABAP/4 program?

HEADER ,BODY,FOOTER.
A situation: An ABAP program creates a batch input session. We need to submit the program and the batch session in back ground. How to do it ?

go to SM36 and create background job by giving job name, job class and job steps (JOB SCHEDULING)
What are the domains and data elements ?

DOMAINS : FORMAL DEFINITION OF THE DATA TYPES.THEY SET ATTRIBUTES SUCH AS DATA TYPE,LENGTH,RANGE. DATA ELEMENT : A FIELD IN R/3 SYSTEM IS A DATA ELEMENT. What is the alternative to batch input session? Call transaction. What is a batch input session? BATCH INPUT SESSION is an intermediate step between internal table and database table. Data along with the action is stored in session ie data for screen fields, to which screen it is passed, program name behind it, and how next screen is processed. What is the advantage of structures? How do you use them in the ABAP programs? Adv:- GLOBAL EXISTANCE(these could be used by any other program without creating it again). How many types of tables exists and what are they in data dictionary? 4 types of tables i)Transparent tables - Exists with the same structure both in dictionary as well as in

database exactly with the same data and fields. Both Opensql and Nativesql can be used. ii)Pool tables & iii)Cluster tables - These are logical tables that are arranged as records of transparent tables. one cannot use native sql on these tables (only open sql).They are not managable directly using database system tools. iv)Internal tables - .?
31. The following program outputs what? report zjgtest1. write: /1 'Ready_'. PARAMETER: test. INITIALIZATION. write: /1 'Set_'. START-OF-SELECTION. write: /1 'GO!!'. ANS: Ready_ Go

Passing Data by Program Statements


To pass individual output fields or additional information from a line to the corresponding processing block during an interactive event, use these statements: HIDE The HIDE statement is one of the fundamental statements for interactive reporting. You use the HIDE technique when creating a basic list. It defines the information that can be passed to subsequent detail lists. 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 theHIDEtechnique. GET CURSOR Use the statements GET CURSOR FIELD und GET CURSOR LINE to pass the output field or output line on which the cursor was positioned during the interactive event to the ABAP program. DESCRIBE LIST The DESCRIBE LIST statement allows you to import certain list attributes, such as the number of lines or pages, into program variables. In the following sections you will find examples of the individual statements. The exact description of the respective syntax is available in the keyword documentation.

The HIDE Technique


The example below presents some of the essential features of interactive reporting. The basic list contains summarized information. With the HIDE technique, it is possible to branch to more detailed information on subsequent lists. REPORT demo_list_hide NO STANDARD PAGE HEADING. TABLES: spfli, sbook. DATA: num TYPE i, dat TYPE d. START-OF-SELECTION. num = 0. SET PF-STATUS 'FLIGHT'.

GET spfli. num = num + 1. WRITE: / spfli-carrid, spfli-connid, spfli-cityfrom, spfli-cityto. HIDE: spfli-carrid, spfli-connid, num. END-OF-SELECTION. CLEAR num. TOP-OF-PAGE. WRITE 'List of Flights'. ULINE. WRITE 'CA CONN FROM TO'. ULINE. TOP-OF-PAGE DURING LINE-SELECTION. CASE sy-pfkey. WHEN 'BOOKING'. WRITE sy-lisel. ULINE. WHEN 'WIND'. WRITE: 'Booking', sbook-bookid, / 'Date ', sbook-fldate. ULINE. ENDCASE. AT USER-COMMAND. CASE sy-ucomm. WHEN 'SELE'. IF num NE 0. SET PF-STATUS 'BOOKING'. CLEAR dat. SELECT * FROM sbook WHERE carrid = spfli-carrid AND connid = spfli-connid. IF sbook-fldate NE dat. dat = sbook-fldate. SKIP. WRITE / sbook-fldate. POSITION 16. ELSE. NEW-LINE. POSITION 16. ENDIF. WRITE sbook-bookid. HIDE: sbook-bookid, sbook-fldate, sbook-custtype, sbook-smoker, sbook-luggweight, sbook-class. ENDSELECT. IF sy-subrc NE 0. WRITE / 'No bookings for this flight'. ENDIF. num = 0. CLEAR sbook-bookid. ENDIF. WHEN 'INFO'. IF NOT sbook-bookid IS INITIAL. SET PF-STATUS 'WIND'. SET TITLEBAR 'BKI'. WINDOW STARTING AT 30 5 ENDING AT 60 10. WRITE: 'Customer type :', sbook-custtype, / 'Smoker :', sbook-smoker,

/ 'Luggage weigtht :', sbook-luggweight UNIT 'KG', / 'Class :', sbook-class. ENDIF. ENDCASE. At the event START-OF-SELECTION, the system sets the status FLIGHT for the basic list. In status FLIGHT, function code SELE (text SELECT) is assigned to function key F2 and to a pushbutton. So the event AT USER-COMMAND is triggered if the user double-clicks, presses F2, or chooses the pushbutton SELECT. The three fields spfli-carrid, spfli-connid, and num are stored in the HIDE area while creating the basic list. After selecting a line, the system displays the detail list defined in the AT USER-COMMAND event for function code SELE. In the AT USER-COMMAND event, the system refills all fields of the selected line that were stored in the HIDE area. You use num to check whether the user selected a line from the actual list. The detail list has statusBOOKING, where F2 is assigned to function code INFO (text: Booking Information). The detail list presents data that the program selected using the HIDEfields of the basic list. For each list line displayed, the system stores additional information in the HIDE area. If the user selects a line of the detail list, the system displays the stored information in a dialog box with the status WIND. For the WIND status, the default values for the status type Dialog box have been adopted with the list status adjustment. The program uses sbook-bookid to check whether the user selected a valid line. The program itself sets all page headers and the title bar of the dialog box.

Reading Lines from Lists


All of the lists generated by a single program are stored internally in the system. You can therefore access any list in a program that was created for the same screen and that has not yet been deleted by returning to a lower list level. To read lines, use the statements READ LINE and READ CURRENT LINE. To read a line from a list after an interactive list event, use the READ LINE ...statement: To read a line twice in succession, use the READ CURRENT LINE ... statement This statement reads a line read before by an interactive event (F2) or by READ LINE. The following program is connected to the logical database F1S. REPORT demo_list_read_line NO STANDARD PAGE HEADING. TABLES: sflight. DATA: box(1) TYPE c, lines TYPE i, free TYPE i. START-OF-SELECTION. SET PF-STATUS 'CHECK'. GET sflight. WRITE: box AS CHECKBOX, sflight-fldate. HIDE: sflight-fldate, sflight-carrid, sflight-connid, sflight-seatsmax, sflight-seatsocc. END-OF-SELECTION. lines = sy-linno - 1. TOP-OF-PAGE. WRITE: 'List of flight dates'. ULINE. TOP-OF-PAGE DURING LINE-SELECTION. WRITE: 'Date:', sflight-fldate. ULINE. AT USER-COMMAND. CASE sy-ucomm. WHEN 'READ'. box = space. SET PF-STATUS 'CHECK' EXCLUDING 'READ'. DO lines TIMES.

READ LINE sy-index FIELD VALUE box. IF box = 'X'. free = sflight-seatsmax - sflight-seatsocc. IF free > 0. NEW-PAGE. WRITE: 'Company:', sflight-carrid, 'Connection: ',sflight-connid, / 'Number of free seats:', free. ENDIF. ENDIF. ENDDO. ENDCASE. After the selection screen has been selected, the system displays a basic list where the user can fill in checkbox fields. The self-defined page header of the basic list uses the parameters CITY_FR und CITY_TO. The parameters are defined in the logical database F1S. The program uses the status CHECK, where the function code READ (text Read Lines) is assigned to function key F5 and to a pushbutton in the application toolbar. The corresponding user action triggers the AT USER-COMMAND event. The system now reads all lines of the basic list using READ LINE in a DOloop. For each line, the values stored previously using HIDE are placed in the respective fields for each line. Using the FIELD VALUE option, the system also reads the checkbox box. If seats are still free, the system writes the company, the connection, and the number of free seats into a detail list for each line in which the checkbox was selected. The system starts a new page with an individual page header for each output. On the detail list, the function code READ is deactivated using the EXCLUDINGaddition of the SET PF-STATUS statement. After returning from the detail list, the checkboxes are still filled.

Reading Lists at the Cursor Position


To retrieve information about the current cursor position in an interactive event, use the GET CURSOR statement. You can retrieve information either about the current field or the current line. For field information, use the variant: GET CURSOR FIELD ... For field information, use the variant: GET CURSOR LINE ... REPORT SAPMZTST NO STANDARD PAGE HEADING LINE-SIZE 40. DATA: HOTSPOT(10) VALUE 'Click me!', F(10), OFF TYPE I, LIN TYPE I, VAL(40), LEN TYPE I. FIELD-SYMBOLS <FS>. ASSIGN HOTSPOT TO <FS>. WRITE 'Demonstration of GET CURSOR statement'. SKIP TO LINE 4. POSITION 20. WRITE <FS> HOTSPOT COLOR 5 INVERSE ON. AT LINE-SELECTION. WINDOW STARTING AT 5 6 ENDING AT 45 20. GET CURSOR FIELD F OFFSET OFF LINE LIN VALUE VAL LENGTH LEN. WRITE: 'Result of GET CURSOR FIELD: '. ULINE AT /(28). WRITE: / 'Field: ', F, / 'Offset:', OFF, / 'Line: ', LIN, / 'Value: ', (10) VAL, / 'Length:', LEN. SKIP.

GET CURSOR LINE LIN OFFSET OFF VALUE VAL LENGTH LEN. WRITE: 'Result of GET CURSOR LINE: '. ULINE AT /(27). WRITE: / 'Offset:', OFF, / 'Value: ', VAL, / 'Length:', LEN. In this program, the HOTSPOT field is assigned to the field symbol <FS> and displayed as a hotspot on the output screen. If the user positions the cursor on a list line and selects it, a dialog box appears containing the results of the GET CURSOR statements in the AT LINE-SELECTION event. Note that, after GET CURSOR FIELD, the name of the field assigned to the field symbol <FS> is stored in F, and not the name of the field symbol.

Determining the Attributes of Lists


If you need to know the attributes of list levels that were not stored in system variables during list creation, you can use the DESCRIBE LISTstatement. To retrieve the number of lines or pages of a list, use: DESCRIBE LIST NUMBER OF LINES|PAGES n ... To get the page number of a particular line number, use: DESCRIBE LIST LINE lin PAGE pag ... To get the properties of a particular page, use: DESCRIBE LIST PAGE pag ... Use DESCRIBE LIST for completed lists only, since for lists in creation (index is sy-lsind) some properties are not up to date. REPORT demo_list_describe_list NO STANDARD PAGE HEADING LINE-SIZE 40 LINE-COUNT 5(1). DATA: lin TYPE i, pag TYPE i, col TYPE i, len TYPE i, lin1 TYPE i, top TYPE i, tit TYPE i, head TYPE i, end TYPE i. DO 4 TIMES. WRITE / sy-index. ENDDO. TOP-OF-PAGE. WRITE 'Demonstration of DESCRIBE LIST statement'. ULINE. END-OF-PAGE. ULINE. AT LINE-SELECTION. NEW-PAGE LINE-COUNT 0. WINDOW STARTING AT 1 13 ENDING AT 40 25. DESCRIBE LIST: numBER OF LINES lin INDEX 0, numBER OF PAGES pag INDEX 0. WRITE: 'Results of DESCRIBE LIST: '. ULINE AT /(25). WRITE: / 'Lines: ', lin, / 'Pages: ', pag. SKIP. DESCRIBE LIST LINE sy-lilli PAGE pag INDEX 0. WRITE: / 'Line', (1) sy-lilli, 'is on page', (1) pag. SKIP. DESCRIBE LIST PAGE pag INDEX 0 LINE-SIZE col LINE-COUNT len LINES lin FIRST-LINE lin1 TOP-LINES top

TITLE-LINES tit HEAD-LINES head END-LINES end. WRITE: 'Properties of Page', (1) pag, ':', / 'Width: ', col, / 'Length: ', len, / 'Lines: ', lin, / 'First Line: ', lin1, / 'Page Header: ', top, / 'Title Lines: ', tit, / 'Header Lines:', head, / 'Footer Lines:', end. This program creates a two-page list of five lines per page. Two lines are used for the self-defined page header and one line for the page footer. If the user selects a line, a dialog box appears containing the list attributes. During creation of the secondary list, all variants of the DESCRIBE LIST statement apply to the basic list. The system displays the results in the dialog box. The lines and pages to be described are addressed dynamically using sy-lilli.