Instruction manuals

ABAP Basics

Description
SAP ABAP
Published
of 3
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
  ABAP Internal Table Types Choose table type (and access method) by most frequently performed operation 1.Standard tables a. Access by linear table index or key b. Response time proportional to table size 2.Sorted tables a. Filled in sorted order b. Access by linear index or sort key c. Response time logarithmically proportional to table size 3.Hashed tables a. Direct access (only) by table key b. Constant, fast response time Internal Table Types ABAP offers standard, sorted, & hashed types of internal tables. The type of table that you should use (and hence the access method) is determined by the operations that will be performed most frequently with the table. Standard tables Most appropriate for general table operations. Accessed by referring to the table index (which is the quickest access method) . Access time for standard table increases linearly with respect to the number of table entries. New rows are appended to the table. Individual rows are accessed by reading the table at a specified index value. Internal Table Types Sorted tables Most appropriate where the table is to be filled in sorted order. Sorted tables are filled using the INSERT statement. Inserted entries are sorted according to a sort sequence defined by the table key. Illegal entries are recognized as soon as you try to insert them into the table. Response time is logarithmically proportional to the number of table entries (since the system always uses a binary search). Sorted tables are particularly useful if you wish to process row by row using a LOOP. Hashed tables Most appropriate when access to rows is by a key. (Cannot access hashed tables via the table index)response time remains constant regardless of the number of rows in the table. Declaring Internal Tables with reference to existing internal or database table type DATA <itab> type <tabtypedef> [WITH HEADER LINE]. with reference to an existing line structure DATA <itab> like <tabtypedef> [WITH HEADER LINE]. Difference between user exits & customer exits:   User exit - A user exit is a three character code that instructs the system to access a program during system processing. SXX: S is for standard exits that are delivered by SAP. XX represents the 2-digit exit number. UXX: U is for user exits that are defined by the user. XX represents the 2-digit exit number Customer exit  - The R/3 enhancement concept allows you to add your own functionality to SAP’s standard business applications without having to modify the srcinal applications. SAP creates Internal Tables Database tables store long-life data Internal tables store temporary data-Table calculations on subsets of database tables Implementing complex data structures Reorganize the contents of database tables according to specific processing needs Generate ranked lists Combine contents from more than one database table into a single table for easier processing Internal Tables Used as Snapshots of database tables Containers for volatile data Exist only at runtime, (unlike database tables) Consist of any number of records Note that it is not necessary to declare the initial size of the table: sap’s memory management allows the table to be ‘infinitely’ extensible   When to use which table Declaring Internal Tables   DATA : <itab> TYPE <itabkind> of <linetpye> [WITH [UNIQUE | NON-UNIQUE] <keydef>] [INITIAL SIZE <n>] [With header line]. <itabkind>[STANDARD] TABLE | SORTED TABLE | Hashed table | any table keydef>KEY <f1>…<fn> |  Key table line | Default key   Hashed Table Declaration TYPES: begin of LineType, F1,f2, End of LineType. DATA: itab TYPE HASHED TABLE OF LineType WITH UNIQUE KEY f1 Initial size 100 With header line .  Standard Table Declaration TYPES: begin of LineType, F1,f2, End of LineType. DATA: itab TYPE STANDARD TABLE OF LineType [WITH DEFAULT KEY] Initial size 100 With header line. Sorted Table Declaration TYPES: begin of LineType, F1,f2, End of LineType. DATA: itab TYPE SORTED TABLE OF LineType WITH {NON- UNIQUE|UNIQUE} KEY f1 With header line  customer exits for specific programs, screens, and menus within standard R/3 applications. These exits do not contain any functionality. Instead, the customer exits act as hooks. You can hang your own add-on functionality onto these hooks. *-- Mani  The following document is about exits in SAP :- The R/3 enhancement concept allows you to add your own functionality to SAP’s standard business applications without having to modify the srcinal applications. SAP creates user exits for specific programs, screens, and menus within standard R/3 applications. These exits do not contain any functionality. Instead, the customer exits act as hooks. You can hang your own add-on functionality onto these hooks. Types of Exits There are several different types of user exits. Each of these exits acts as hooks where you can attach or hang your own add-ons. Menu Exits  Menu exits add items to the pulldown menus in standard SAP applications. You can use these menu items to call up your own screens or to trigger entire add-on applications. SAP creates menu exits by defining special menu items in the Menu Painter. These special entries have function codes that begin with + (a plus sign). You specify the menu item’s text when activating the item in an add-on project. Screen Exits  Screen exits add fields to screens in R/3 applications. SAP creates screen exits by placing special subscreen areas on a standard R/3 screen and calling a customer subscreen from the standard screen’s flow logic. Function Module Exits Function module exits add functions to R/3 applications. Function module exits play a role in both menu and screen exits. When you add a new menu item to a standard pull down menu, you use a function module exit to define the actions that should take place once your menu is activated. Function module exits also control the data flow between standard programs and screen exit fields. SAP application developers create function module exits by writing calls to customer functions into the source code of standard R/3 programs. These calls have the following syntax: CALL CUSTOMER- FUNCTION ‘001’.   Field Exits  Field exits allow you to create your own programming logic for any data element in the Dictionary. You can use this logic to carry out checks, conversions, or business-related processing for any screen field. Example: The data element BBBNR identifies a company’s international location number. You might want to set up your R/3 System so that all international location numbers are larger than 100. The field exit concept lets you create a special function module that contains this logic. You assign the special function module to the data  element BBBNR. You then assign the module to any programs and screens in which users can add new international location numbers. When you activate your field exit, the system automatically triggers your special routine whenever a user enters a company location number. You can use RSMODPRF program to create field exits. An example of a user exits :-  MODULE user_exit_0001 INPUT CASE okcode. WHEN 'BACK OR EXIT'. CASE sy-dynnr. WHEN '100'. SET SCREEN 0. LEAVE SCREEN. WHEN '200'. ****************************************************************************** **** Note that you can write any code that satisfy your needs. **** **** But in this case, this was wrote as a sample code for reference sake. **** **** And you can test it. **** ****************************************************************************** SET SCREEN 100. LEAVE SCREEN. ENDCASE. ENDCASE.
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks