Abap report-basics

1,757 views

Published on

ABAP Reports basics sap webdynpro abap basics, sap hr abap basics, sap abap basic concepts, sap abap basic questions, sap abap report events, sap abap call report, alv report in sap abap, submit report in sap abap

0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,757
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
0
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

Abap report-basics

  1. 1. SAP ABAP Report BasicsSelection-screen design:1. Parameters: Use for single field2. Select-options: Use for rangesEvents in the Reports:1. Initialization.2. At selection-screen.3. Start-of-selection.4. End-of-selection.5. Top-of-page.6. End-of-page.Selection screen related events –1. At selection-screen.2. At selection-screen output.
  2. 2. 3. At selection-screen on field.4. At selection-screen on value request for <field>.5. At selection-screen on help request for <field>.INITIALIZATION.Called before standard selection screen. To initialize the input fields of the standard selection screen.And can also change the default values of those fields used in the selection screen.AT SELECTION-SCREEN.It’s the main event called after the selection screen is processed. Triggered after the user input(PAI) inthe selection screen, to validate the input fields.AT SELECTION-SCREEN OUTPUT.Called in PBO, to modify any screen fields before it is displayed.AT SELECTION-SCREEN ON field.Called in PAI, to validate a particular field.AT SELECTION-SCREEN ON HELP-REQUEST FOR field.Called when user presses F1 for the field. Can be used to create help for input fields without any tablereference / can override any help text defined for a field.AT SELECTION-SCREEN ON VALUE-REQUEST FOR field.Called when user presses F4 for the field. To display all the possible values for a field.START-OF-SELECTION.Called before data is to be read from database.END-OF-SELECTION.Called after data has been read and all data is ready to be formatted and displayed.TOP-OF-PAGE.This event is triggered with first WRITE statement or whenever new page is triggered. Advantage ofusing this event is that, whatever you write under this event, is applicable to all the pages. If you don’thave any write statement before TOP-OF-PAGE or in START-OF-SELECTION, this event is not triggered atall. For example, if you want the name of company and column headers for all the pages, it can bewritten in this event.END-OF-PAGE.
  3. 3. This event is triggered at the end of page.End-of-page.Write : / ‘page number’, sy-pagno.In this case page number will be written on every page.Interactive Report: User can interact with the displayed output list. .In the interactive report, we can create up to 21 lists. The first list is called ‘Basic List’ and all successivelists are called secondary lists. .The system variable associated with the list no is – SY-LSIND. For basic list this value is ‘0’ and forsecondary list varies from 1 to 20.All the events in the classical reports can be used on basic list.The event end-of-page can be used in secondary list but other events cannot be used on secondary list.Below are the additional events in interactive report.1. At line-selection – Triggers when double click on the list line.2. Top-of-page - during line selection.3. At user-command – based on the function code.SY-LISEL – Content of selected list line.SY-LSIND – Content of level of report (from 0 to 20).Hide - Hide statement holds the data to be displayed on secondary list when click on any field.Types of Internal Tables:1. Standard Internal tables.2. Sorted internal tables.3. Hashed internal tables.1. Standard tables have a linear index. You can access them using either the index or the key. Ifyou use the key, the response time is in linear relationship to the number of table entries. Thekey of a standard table is always non-unique, and you may not include any specification for theuniqueness in the table definition.
  4. 4. This table type is particularly appropriate if you want to address individual table entries usingthe index. This is the quickest way to access table entries. To fill a standard table, append linesusing the (APPEND) statement. You should read, modify and delete lines by referring to theindex (INDEX option with the relevant ABAP command). The response time for accessing astandard 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. Forexample, you can fill a standard table by appending records and then sort it. If you then use keyaccess with the binary search option (BINARY), the response time is in logarithmic relation to thenumber of table entries.2. Sorted tables are always saved correctly sorted by key. They also have a linear key, and, likestandard tables, you can access them using either the table index or the key. When you use thekey, the response time is in logarithmic relationship to the number of table entries, since thesystem uses a binary search. The key of a sorted table can be either unique, or non-unique, andyou must specify either UNIQUE or NON-UNIQUE in the table definition. Standard tables andsorted tables both belong to the generic group index tables. You fill the table using the (INSERT)statement, according to the sort sequence defined in the table key. Sorted tables areappropriate for partially sequential processing in a LOOP, as long as the WHERE conditioncontains the beginning of the table key.3. Hashes tables have no internal linear index. You can only access hashed tables by specifying thekey. The response time is constant, regardless of the number of table entries, since the searchuses a hash algorithm. The key of a hashed table must be unique, and you must specify UNIQUEin the table definition.This table type is particularly suitable if you want mainly to use key access for table entries. Youcannot access hashed tables using the index. When you use key access, the response timeremains constant, regardless of the number of table entries.Refresh or clear the internal tables.Reading the Internal Tables:1. LOOP and READ.When we want to read all the records from internal table one after the other, then useLOOP. If we want to read any one particular record, use read statement.Ex: Loop at <ITAB1> into <WA_TAB1>.ENDLOOP.Read <ITAB> into <WA_TAB> with key <KEY1> = ‘any value’ (binary search).
  5. 5. Move data from one internal table to another internal table.1. If both Internal tables having same structure, then use ITAB2[] = ITAB1[].2. If either structures are different, then use ‘Move-corresponding’ or fill the respective work areaand append the second internal table.Write records into Internal Table:1. ‘Append’ statement.2. ‘Insert’ statement.3. ‘Append lines of’.Sample statements:1. Read2. Delete3. Modify4. Collect5. Sort6. Concatenate7. Condense8. Split9. DescribeControl Statement:1. IF…ELSE…ENDIF.2. CASE….ENDCASE.3. LOOP….ENDLOOP.4. DO….ENDDO.5. WHILE….ENDWHILE.Comparison Operands:1. EQ ( = )2. GT ( > )3. GE ( >= )4. LT ( < )5. LE ( <= )6. NE ( <> )
  6. 6. SYSTEM-FIELDS:1. SY-UNAME – Login user ID.2. SY-DATUM – System date.3. SY-UZEIT – System time.4. SY-INDEX – Loop counter.5. SY-TABIX – Index of internal table.6. SY-DBCNT – Count selected records from table.7. SY- SUBRC – Status of latest statement execution (this value should be 0, 4, 8 or 12).Continue and Exit statements – In side LOOP…ENDLOOP.FOR SAP ABAP Online Training Contact:Keylabs TrainingUSA: 908-366-7933India: +91-9550645679UK: +44-203-004-8900Info@keylabstraining.comhttp://www.keylabstraining.com/sap-abap-online-training

×