Wednesday, February 20, 2019
Abap Data Dictionary
The ABAP lexicon centr eithery describes and manages in both the selective instruction definitions utilise in the carcass. The ABAP mental lexicon is all integrated in the ABAP learning Workbench. all(a) the an opposite(prenominal) comp cardinalnts of the Workbench squirt actively entrance fee the definitions stored in the ABAP mental lexicon. The ABAP lexicon supports the definition of practiser- qualifyd sheaths ( discipline elements, social expressions and card emblems). You bathroom excessively arrange the complex body part of selective in piddleationbase objects ( delays, indexes and understands) in the ABAP vocabulary. These objects mess then be automatically created in the informationbase with this definition.The ABAP lexicon in like manner provides tools for editing b enlist out argona, for exemplification for indicateing a celestial sphere an infix help (F4 help). Type definitions social structure selective informationbase objects fl urry DB turn off Data element put over fiber Tools Poss. look out Screen F4 The approximately important object causes in the ABAP mental lexicon be tabulates, views, flakes ( data elements, structures, postp wizard types), domains, search helps and toss objects. April cc1 9 BC ABAP lexicon ABAP vocabulary conk out AG ABAP Dictionary Purpose Data definitions (metadata) argon created and managed in the ABAP Dictionary.The ABAP Dictionary permits a central description of all the data used in the system without redundancies. New or modified in dression is automatically provided for all the system comp unitarynts. This ensures data integrity, data consistency and data security. You house create the correspond objects ( disheartens or views) in the underlying relational database exploitation these data definitions. The ABAP Dictionary on that pointof describes the logical structure of the objects used in action instruction and shows how they ar mapped to the under lying relational database in fountsteps or views.The ABAP Dictionary as well as provides standard functions for editing palm on the screen, for good deterrent pattern for assigning a screen electron orbit an infix help. What development is Stored in the ABAP Dictionary? The most important object types in the ABAP Dictionary atomic account 18 delays, views, types, domains, search helps and lock objects. add-ins Page 13 be adjustd in the ABAP Dictionary in babelikely of the database. A dining circuit board having the resembling structure is then created from this fudge definition in the underlying database. Views Page 97 be logical views on much than one circuit board. The structure of the view is defined in the ABAP Dictionary.A view on the database tin stub then be created from this structure. Types Page 136 be used in ABAP figure. The structure of a type provide be defined globally in ABAP programs. Changes to a type automatically take effect in all th e programs using the type. Lock objects Page 209 be used to synchronize access to the selfsame(prenominal) data by to a great fulfilment than one user. Function modules that mass be used in application programs atomic number 18 generated from the definition of a lock object in the ABAP Dictionary. Different plains having the same technical type buns be combined in domains Page 161.A domain defines the value country of all disconcert field and structure components that refer to this domain. The ABAP Dictionary also waits the information displayed with the F1 and F4 help for a field in an enter guidebook. The musical accompaniment about the field is created for a data element Page 138 that describes the meaning of the confine of a disconcert field. The list of practicable stimulation values that appears for the excitant help is created by a external pro ensnargon Page 19 or a search help Page 172. Integration in the ABAP Development Workbench The ABAP Dictionary is completely integrated in the ABAP Development Workbench.The R/3 musical arrangement works interpretatively, permitting the ABAP Dictionary to be actively integrated in the development environment. Instead of the original objects, the interpreters see tho internal representations of these objects. These internal representations ar adjusted automatically when the system finds that modifications seduce been do in the ABAP Dictionary. This ensures that the screen and ABAP interpreters, input help, database interface, and development tools always access current data. 10 April 2001 jester AG BC ABAP Dictionary ABAP DictionaryThe by-line ABAP program lists the airline carriers (see relief valve model Page 302) and carrier IDs contained in dining submit SCARR. DATA SCARR_TAB TYPE SCARR. portion out * INTO SCARR_TAB FROM SCARR. WRITE / SCARR_TAB-CARRID, SCARR_TAB-CARRNAME. END take aim. Only structure SCARR_TAB is declared in the program. All the information about this stru cture, such as the field unwraps, data types and field lengths, are copied from disconcert SCARR, which is defined in the ABAP Dictionary. This information about panel SCARR is called from the ABAP Dictionary when the program is generated.This government agency that the source text edition of the program need non be adjusted when a change is make to display board SCARR, for example when the length of a tabular array field is changed. The next meter the program is called, the system automatically determines that the structure of carry over SCARR has changed. The program is simply regenerated, in that respectby retrieving up-to-date information about table SCARR from the ABAP Dictionary. ?Development environment ? Development environment ABAP Tools Data Modeler Screen Painter ABAP Dictionary ABAP part Dialog Control Interfaces Screen InterpreterRuntime environment of the application Runtime environment of the application When you work on development projects, objects of the ABAP Dictionary piece of tail be changed each egress of times before being trigger Page 237 and made purchasable to the operative components of the system. Objects ignore drive both an active and an inactive edition in the ABAP Dictionary at the same time. Inactive ABAP Dictionary objects behave no effect on the runtime system (ABAP processor, database interface). This permits greater changes to some(prenominal) objects without impairing the April 2001 11 BC ABAP Dictionary ABAP Dictionary sucker AG executability of the system. The objects can moreover be actuated together when they have all been changed. 12 April 2001 SAP AG BC ABAP Dictionary put offs boards Tables can be defined in subordinately of the database in the ABAP Dictionary. The palm of the table are defined with their (database-independent) data types and lengths. When the table is activated, a sensible table definition is created in the database for the table definition stored in the ABAP Diction ary. The table definition is translated from the ABAP Dictionary to a definition of the particular database.Database-independent translation of the Tables in the ABAP Dictionary T1 T2 T3 Tn Activation program and DB UTILITY DB Definition of the tables in the database T1 T2 T3 Tn A table definition in the ABAP Dictionary contains the future(a) components Table palm Page 14 define the field label and data types of the handle contained in the table remote chance upons Page 19 define the familys between the table and some other tables. Technical settings Page 30 control how the table should be created in the database. Indexes Page 61 To speed up data selection, secondary indexes can be created for the tableThe customer can interchange SAP tables with append structures Page 69 and customizing accepts Page 68. This kind of modification ensures that the customer enhancements are automatically merged with the newly versions of the SAP tables when there is a release upgrade . adopt also Creating Tables Page 72 Making Changes to Tables Page 83 April 2001 13 BC ABAP Dictionary Table handle SAP AG Table handle You must(prenominal) define the by-line for a table field in the ABAP Dictionary cranial orbit name The field name can have a supreme of 16 places and whitethorn contain letters, digits and underscores.The field name must begin with a letter. Key stick determines whether the field should belong to the table come upon. sector type data type of the field in the ABAP Dictionary. orbit length number of binding places in the field. Decimal places number of places after the decimal point, arrogateing numerical data types. Short text dead text describing the meaning of the field. You can also include Page 16 the palm of a structure in the table. c erstssion of the Data Type, handle Length and Short text You can assign the data type Page 242, length and short text in dissimilar ays You at one time assign the field a data type, f ield length (and if prerequisite decimal places) and short text in the table definition. You can assign the field a data element Page 138. The data type, field length (and decimal places) are determined from the domain of the data element. The short description of the data element is depute to the field as a short text. Other Assignment Options tab give away table An input bring out for the field can be defined with a impertinent anchor Page 19. This input drive off appears on all the screens in which the field is used. front help assignment A search help Page 172 can be designate to a field.This search help defines the input help electric current on all the screens in which the field is used. filename extension field and summon table Page 15 You must specify the table field in which the jibe unit of measure or currency can be found for palm containing quantities (data type QUAN) or currency amounts (data type CURR). identify also Creating Tables Page 72 14 April 2001 SAP AG BC ABAP Dictionary Reference handle and Reference Tables Reference lands and Reference Tables You must specify a fictitious character table for handle containing quantities (data type QUAN) or currency amounts (data type CURR).This book of facts table must contain a field with the format for the currency unwrap (data type CUKY) or unit of measure (data type UNIT). This field is called the reference field of the output field. The reference field can also reside in the table itself. A field is and assigned to the reference field at program runtime. For example, if a field is filled with currency amounts, the corresponding currency is determined from the assigned reference field, that is the value entered in this field at the moment defines the currency. Table theatre 1 T1 sphere 3 cogitation 2 (CURR)Reference table Field 4 Field 5 (CUKY) T2 Field 7 Field 6 Reference field Runtime T1-Field 2 1,500. 00 T2-Field 5 DEM Table SBOOK in the career model Page 302 contai ns all the flight conflicts made by customers. Field FORCURAM contains the toll of the interlocking in the customers currency. Field FORCURKEY of table SBOOK contains the corresponding currency see for this price. SBOOK is accordingly the reference table for field FORCURAM and FORCURKEY is the reference field for field FORCURAM. April 2001 15 BC ABAP Dictionary Reference Fields and Reference Tables SAP AG allows In addition to listing the individual handle, you can also include the handle of a nonher structure in tables Page 13 and structures Page 144. individualistic field and includes can be mixed as required. Structure includes Table F1 F2 F3 F4 F5 F3 F4 F1 F2 F3 F4 F5 Database When an include is changed, all the tables and structures that include it are automatically adjusted. Structure A was included in table B. A new field is inserted in structure A. When structure A is activated, table B is adjusted to this change, that is the new field is also inserted there.You can assign the include a assembly name Page 148 with which the group of fields in the include can be intercommunicate as a unhurt in ABAP programs. acknowledges can also be nested, that is structure A includes structure B which in put to work includes a nonher structure C, etc. The maximum nesting depth is limited to nine. The maximum length of a path of nested includes in a table or structure is thereof nine (the table/structure itself non included). 16 April 2001 SAP AG BC ABAP Dictionary Reference Fields and Reference Tables Table/structure U1 Include U1 U2Include U2 U3 Maximum depth = 9 Include U8 U9 Include U9 Only flat structures Page 144 can be included. In a flat structure, every(prenominal) field either refers to a data element or is directly assigned a data type, length and by chance decimal places. Only structures may be included in a table. Tables, structures and views may be included in a structure. The length of the field names is more restricted in tables than in structures. In a table, a field name may not have more than 16 places, moreover in a structure up to 30 places are allowed for the field name.A structure and so can simply be included in a table if none of the field names of the structure are longer than 16 places. The path of nested includes may totally contain one table. Table TAB1 includes structure STRUCT1, which in turn includes structure STRUCT2. The path of the nested includes here only contains table TAB1. It is also workable to include TAB1 in a further structure STRUCT0, but no other table TAB2 may be included in TAB1 since in this subject a path of nested includes would contain two tables (TAB1 and TAB2). See also Inserting an Include Page 85 April 2001 17 BC ABAP Dictionary Named Includes SAP AGNamed Includes If an include Page 16 is used to define a database table or structure, a name can be assigned to the included substructure. The group of fields in the include can be addressed as a whole in ABAP programs w ith this name. In ABAP programs, you can either access the fields directly with or analogously with . You can access the fields of the group as a whole with -. Structure PERSON includes structure mete out with the name ADR. ADDRESS has a field CITY. With PERSON-ADR you can address all the fields in structure ADDRESS. The included field CITY can also be addressed with PERSON-CITY or PERSON-ADR-CITY.You can include a structure more than once (e. g. in a period group). Since direct access by field name should be permitted here, the included field names must be renamed to ensure that they are unique. A suffix can be assigned to each group, extending the names of the group fields. The fields can then be addressed in ABAP programs with or . Structure PERSON includes structure ADDRESS twice. An address is the private address with suffix H and name ADRH. The other address is the business address with suffix W and name ADRW. You can access field CITY in the private address with PERSON-CIT YH or PERSON-ADRH-CITY.The functionality of the named includes in the ABAP Dictionary corresponds to the ABAP construction INCLUDE TYPE AS RENAMING . 18 April 2001 SAP AG BC ABAP Dictionary unknown Keys hostile Keys You can define the relationships between tables in the ABAP Dictionary by creating unusual depicts. victimization irrelevant severalizes, you can easily create value lozenges for input fields. strange describes can also be used to connecter several tables in a view Page 97 or a lock object Page 209. Field Assignment in the Foreign Key A outside(prenominal) tell apart links two tables T1 and T2 by assigning fields of table T1 to the autochthonic secernate fields of table T2.Foreign report fields Foreign advert table T1 Field 1 Field 2 Field 3 Field 4 Primary cite Check table Field 5 Field 6 T2 Field 7 Primary chance upon Table T1 is called the outside make table (dependent table) and table T2 the dispel table (referenced table). The pair of fields for the two tables must have the same data type and length. i field of the orthogonal fall upon table therefore corresponds to each delineate field of the disablement table. This field is called the contrasted mention field. A foreign key permits you to assign data get downs in the foreign key table and forbear table.One accede of the foreign key table uniquely identifies one disgrace of the disclose table using the entries in the foreign key fields. Check Field and Value Check One of the foreign key fields is marked as the disclose field. This means that the foreign key relationship is maintained for this field. April 2001 19 BC ABAP Dictionary Foreign Keys SAP AG When an approach is made in the reserve field, there is a check whether the check table contains a render with the key defined by the values in the foreign key fields. If this is so, the entry is valid. Otherwise the system rejects the entry.Input template for foreign key table T1 Field1 Field2 Field3 Fi eld4 1 3 Field5 1 1 2 3 3 3 4 4 Check table T2 Field6 1 3 1 1 2 3 1 2 Field7 text edition 1 school text 2 text edition 3 textual matter 4 Text 5 Text 6 Text 7 Text 8 Input is valid since there is a corresponding immortalise in the check table In this example the entry Field2 = 2 and Field4 = 2 would be rejected since T2 does not contain a introduce with the key Field5 = 2 and Field6 = 2. If you do not want to check against all the key fields of the check table, you can exclude fields of the foreign key table from the assignment of the fields to the check table with generic wine wine and constant foreign keys Page 22.How the Input Check Works A SELECT statement is generated from the definition of the foreign key. If an entry is made in the check field, this SELECT statement is submitted. If a commensurate magnetic disk of the check table is found, the entry is valid. Otherwise the entry is rejected. The corresponding SELECT statement has the following(a) form for the forei gn key table shown in the above computer graphic SELECT * FROM T2 WHERE T2-FIELD5 = T1-FIELD2 AND T2-FIELD6 = T1-FIELD4. A screen entry for check field Field2 is therefore only valid if the check table contains a playscript with the entries made in the screen for Field2 and Field4 as key.Table SBOOK in the flight model Page 302 contains the customers flight bookings for a carrier. The flight bookings can be made by a croak agency or directly at the carriers sales counter. If the booking was made at a counter, its number is stored together with the booking in field COUNTER in table SBOOK. 20 April 2001 SAP AG BC ABAP Dictionary Foreign Keys You must make sure that only flush counter numbers racket can be entered. All the counters are entered in table SCOUNTER. The demand value check can be defined by creating a foreign key for check field COUNTNUM. Foreign key fields Foreign key table SBOOKMANDT CARRID CONNID FLDATE CUSTOMID COUNTER CANCELED Check field Check table SCOUNTER M ANDT CARRID COUNTNUM airport Key fields See also Multi-Structured Foreign Keys Page 29 Semantic Attributes of Foreign Keys Page 24 Creating Foreign Keys Page 75 April 2001 21 BC ABAP Dictionary generic and Constant Foreign Keys SAP AG generic and Constant Foreign Keys It is not always advisable to check a foreign key against all the key fields of the check table. This is true for example for time-dependent check tables and for check tables whose version number is a component of the key.You can use generic foreign keys in these cases. Fields are excluded from the assignment to the key fields of the check table here. The check is only against the remaining key fields. You can also assign a constant value to a key field of the check table. In this case you only have to check against the undertake constant. You can use this check if only phonograph scriptings of the check table which contain a constant value in this key field are valid. Foreign key table FTAB Field 6 Field 7 Field 8 Field 9 generic wine * Constant K Check table PTAB Field 1 Field 2 Field 3 Field 4 Field 5Primary key The corresponding SELECT statement for the screen check has the following form for the foreign key definition in the graphic SELECT * FROM PTAB WHERE PTAB-FIELD1 = FTAB-FIELD6 AND PTAB-FIELD3 = FTABFIELD8 AND PTAB-FIELD4 = K. An entry is only valid in check field Field6 if a temperament of check table PTAB exists containing the input value for Field6 in PTAB-Field1, the input value for Field8 in PTAB-Field3 and constant K in PTAB-Field4. 22 April 2001 SAP AG BC ABAP Dictionary generic wine and Constant Foreign KeysInput template for foreign key table FTAB Field 6 Field 7 Field 8 Field 9 3 30 1 B Check table PTAB Field 1 Field 2 Field 3 Field 4 Field 5 1 1 2 3 3 3 4 4 1 1 1 2 1 2 1 2 1 3 1 1 2 3 3 4 A B A K A A C C Text 1 Text 2 Text 3 Text 4 Text 5 Text 6 Text 7 Text 8 Input is valid since Field 7 and Field 9 were removed from the assignment The values entered on the screen fo r Field7 and Field9 are meaningless when checking against the check table. An entry with Field6 = 1, Field8 = 3 and Field9 = B would not be valid in this case since there is no memorialise with PTAB-Field1 = 1, PTAB-Field3 = 3 and PTAB-Field4 = K in the check tableApril 2001 23 BC ABAP Dictionary Semantic Attributes of Foreign Keys SAP AG Semantic Attributes of Foreign Keys A foreign key describes a relationship between two tables. You can define this relationship more precisely by specifying the cardinality Page 25 and type of foreign key fields Page 26. This information is facultative and is primarily for documentary purposes. In particular, the definitions of the cardinality and type of the foreign key fields are not used in the value check for the foreign key. The definition of the semantic attributes is only sed in the following cases If Key fields of a text table is selected as the type of the foreign key fields, the foreign key table is considered to be the text table Pa ge 27 for the check table. If a screen field is checked against a table, the key entries of the check table are commonly displayed in the input help (F4 help) for this field. If there is a text table for the check table, each key entry displayed is enhanced with an instructive text (contents of the initiative character-like field of the text table) in the users logon language.Tables can only be included in a help view Page 115 or maintenance view Page 117 if they are united with a foreign key. It only makes sense to create such a help or maintenance view if for each shew in the primary table of the view there is no more than one corresponding say in each secondary table of the view. The system therefore checks if the foreign key with which the tables were linked in the view have suitable cardinalities when it creates a maintenance or help view. See also Restrictions for nutrition and Help Views Page 119. The foreign key between tables SBOOK and SCOUNTER ensures that only viv acious counters can be entered in field COUNTER (counter at which the flight was booked). See the example in Foreign Keys Page 19 . A booking can be made at either a travel agency or at the carriers sales counter. If the booking is made at a travel agency, the field COUNTER of table SBOOK remains empty. The foreign key fields do not have to be filled, that is the left side of the cardinality is C. Any number of bookings may be made at each counter. there may therefore be whatsoever number of entries (bookings) in foreign key table SBOOK for each record of the check table SCOUNTER. The right side of the cardinality is therefore CN. Of course several bookings can be made for the same carrier at a counter. These bookings do not differ in their foreign key fields (MANDT, CARRID, COUNTER). The entries in the foreign key fields therefore do not uniquely identify an entry in the foreign key table SBOOK (a booking). The foreign key fields therefore have the type No key fields/candidates. 2 4 April 2001 SAP AG BC ABAP Dictionary Cardinality CardinalityThe cardinality (nm) describes the foreign key relationship with regard to the number of possible dependent records (records of the foreign key table) or referenced records (records of the check table). The left side (n) of the cardinality is defined as follows n=1 on that point is exactly one record assigned to the check table for each record of the foreign key table. n=C The foreign key table may contain records which do not correspond to any record of the check table because the foreign key field is empty. This can occur for example if the field of the foreign key table is optional, in which case it does not have to be filled. =1 There is exactly one dependent record for each record of the check table. m=C There is at most one dependent record for each record of the check table. m=N There is at least one dependent record for each record of the check table. m=CN There may be any number of dependent records for each record of the check table. The right side (m) of the cardinality is defined as follows April 2001 25 BC ABAP Dictionary Type of Foreign Key Fields SAP AG Type of Foreign Key Fields The Type of foreign key fields describes what the foreign key fields in the foreign key table mean.The following types of foreign key field can be defined No key fields/candidates The foreign key fields are neither primary key fields of the foreign key table nor do they uniquely identify a record of the foreign key table (key candidates). For this reason, the foreign key fields do not (partially) identify the foreign key table. Key fields/candidates The foreign key fields are either primary key fields of the foreign key table or they al empathisey uniquely identify a record of the foreign key table (key candidates). The foreign key fields therefore (partially) identify the foreign key table.Key fields of a text table The foreign key table is a text table Page 27 for the check table, that is the key of the foreign key table only differs from the key of the check table in that it has an additional language key field. This is a special case of the type Key fields/candidates. 26 April 2001 SAP AG BC ABAP Dictionary Text Tables Text Tables Table A is a text table of table B if the key of A comprises the key of B and an additional language key field (field of data type LANG). Table A may therefore contain explanatory text in several languages for each key entry of B.To link the key entries with the text, text table A must be linked with table B using a foreign key. Key fields of a text table must be selected here for the type of foreign key fields (see Semantic Attributes of Foreign Keys Page 24). Table B Key fields K1 and K2 K1 1 1 K2 1 2 F1 XX YY F2 YY XX Text table A for B Key fields K1, K2 and L (type LANG) K1 1 1 1 1 K2 1 1 2 2 L DE EN DE EN TEXT Text 1 (German) Text 1 (English) Text 2 (German) Text 2 (English) Text foreign keyIf table B is the check table of a field, the existing key entries of table B are displayed as possible input values when the input help (F4) is pressed. The explanatory text (contents of the first character-like non-key-field of text table A) is also displayed in the users logon language for each key value in table B. April 2001 27 BC ABAP Dictionary Text Tables SAP AG Hit list if user logs on in English K1 1 1 K2 1 2 Text Text1 (English) (English) Text2 (English) (English) Maintenance screen Field 1 Field 2 Call the input help Field is checked against table BOnly one text table can be created for table B The system checks this when you attempt to activate a table with text foreign keys for B. 28 April 2001 SAP AG BC ABAP Dictionary Multi-Structured Foreign Keys Multi-Structured Foreign Keys When you define a foreign key, a field of the work ambit that is not contained in the foreign key table can also be assigned to a check table (for example a field of another table). This is possible for all fields ex cept for the check field. Table T2 is the check table of foreign key table T1. Field F of the work celestial sphere is assigned to key field Field6 of check table T2.Foreign key table T1 Field 1 Field 2 Field 3 Field 4 Primary key Field F of work rural area Check table T2 Field 5 Field 6 Field 7 Primary key The corresponding SELECT statement for the input check is then SELECT * FROM T2 WHERE T2-FIELD5 = T1-FIELD2 AND T2-FIELD6 = F. If an entry is made in field T1-Field2 (check field), this SELECT statement testament be submitted. If a corresponding record is found, the entry is valid otherwise it is rejected. If a field that is not contained in the foreign key table is assigned to a field of the check table, this field must be filled at the time of the input check.Otherwise the check always fails, and no values can be entered in the check field. April 2001 29 BC ABAP Dictionary Technical Settings SAP AG Technical Settings The technical settings of a table define how the table d epart be handled when it is created in the database, that is whether the table will be minceed and whether changes to data records of the table will be logged. The most important parameters are Data class The data class Page 31 defines the physical area of the database (table pose) in which the table should be created. Size category The surface category Page 32 defines the size of it of the extents created for the table.When the table is created in the database, the required information about the memory area to be selected and the extent size is determined from the technical settings. Buffering permission The relenting permission Page 33 defines whether the table may be weakened. Buffering type If the table may be piloted, you must define a caramel browning type ( exuberant, singlerecord, generic). The buffering type Page 34 defines how many table records are nettled into the buffer when a table entry is accessed. enter This parameter defines whether changes to the tabl e entries should be logged.If log Page 41 is switched on, each change to a table record is recorded in a log table. The Convert to transparent table flag (transparent flag Page 42) is also displayed for pooled tables or for tables which were converted into transparent tables forward on with this flag. See also Maintaining Technical Settings Page 77 Buffering Database Tables Page 43 30 April 2001 SAP AG BC ABAP Dictionary Data Class Data Class If you submit the data class correctly, your table is automatically assigned to the correct area (tablespace or DBspace) of the database when it is created.Each data class corresponds to a physical area in which all the tables assigned to this data class are stored. There are the following data classes APPL0 (master data) Data which is seldomly changed. An example of master data is the data contained in an address file, such as the name, address and telephone number. APPL1 ( performance data) Data that is much changed. An example of tra nsaction data is the goods in a warehouse, which change after each purchase order. APPL2 (organizational data) Customizing data that is defined when the system is installed and seldomly changed.An example is the table with country codes. Two further data classes, USR and USR1, are provided for the customer. These are for user developments. The tables assigned to these data classes are stored in a tablespace for user developments. Tables in the ABAP Dictionary Master data Table 1 Table 3 Organizational data Table 2 Transaction data Table 4 Table 7 ashes data Table 5 Table 6 Tablespace master data Table 1 Table 3 Tablespace Org. data Table 2 Tablespace Trans. data Table 4 Table 7 Tablespace System data Table 5 Table 6 Database April 2001 31 BC ABAP Dictionary Size crime syndicate SAP AG Size CategoryThe size category defines the expected space required for the table in the database. You can choose a size category from 0 to 4 for your table. Each category is assigned a certain fixed memory size in the database, which depends on the database system used. When a table is created, initial space (an Initial Extent) is reserved in the database. If more space is required at a later time due to data entries, additional memory will be added depending on the selected size category. Technical settings Size category TABA 1 3 4 TABB TABC Initial First Second Extent Extent Extent TABA TABB TABC Database Selecting the correct size category pr regularts a large number of very lilliputian extents from being created for a table. It also prevents space from being wasted if extents which are too large are created. 32 April 2001 SAP AG BC ABAP Dictionary Buffering Permission Buffering Permission You must define whether and how a table is buffered in the technical settings for the table. There are three possibilities here Buffering not permitted Table buffering is not permitted, for example because application programs always need the most recent data from the table or the ta ble is changed too frequently.Buffering permitted but not activated Buffering is permitted from the business and technical points of view. Applications which access the table die hard correctly with and without table buffering. Whether or not table buffering will outlet in a gain in performance depends on the table size and access profile of the table (frequency of the different types of table access). Table buffering is deactivated because it is not possible to know what these values will be in the customer system. If table buffering would be advantageous for the table size and access profile of the table, you can activate it in the customer system at any time.Buffering activated The table should be buffered. In this case you must specify a buffering type Page 34. See also Buffering Database Tables Page 43 Which Tables Should be Buffered? Page 53 April 2001 33 BC ABAP Dictionary Buffering Types SAP AG Buffering Types The buffering type defines which table records are loaded in to the buffer of the application server when a table record is accessed. There are the following buffering types Full buffering Page 35 All the records of the table are loaded into the buffer when one record of the table is accessed.Generic buffering Page 37 When a record of the table is accessed, all the records having this record in the generic key fields (part of the table key that is left-justified, identified by specifying a number of key fields) are loaded into the buffer. Single-record buffering Page 39 Only the records of a table that are in reality accessed are loaded into the buffer. See also Buffering Database Tables Page 43 34 April 2001 SAP AG BC ABAP Dictionary Full Buffering Full Buffering With full buffering, either the complete table is in the buffer or the table is not in the buffer at all.All the records of the table are loaded into the buffer when one record of the table is realise. In this example, a program depicts the record highlighted in red from tab le SCOUNTER. If the table is fully buffered, all the records of the table are loaded into the buffer. Database table SCOUNTER MANDT CARRID COUNTNUM AIRPORT Buffer contents 001 001 001 001 001 001 001 001 001 001 001 001 001 001 AA BA BA BA BA LH LH LH LH LH LH LH LH UA 00000001 00000001 00000002 00000003 00000004 00000001 00000002 00000003 00000004 00000005 00000006 00000007 00000008 00000001 ACA ACE BER LCY LHR BER DEN FRA LCY LGW LHR MUC RTM ham 01 001 001 001 001 001 001 001 001 001 001 001 001 001 AA BA BA BA BA LH LH LH LH LH LH LH LH UA 00000001 00000001 00000002 00000003 00000004 00000001 00000002 00000003 00000004 00000005 00000006 00000007 00000008 00000001 ACA ACE BER LCY LHR BER DEN FRA LCY LGW LHR MUC RTM ham it up Application server SELECT * FROM SCOUNTER WHERE MANDT = 001 AND CARRID = LH AND COUNTNUM = 00000004. The buffered data records are screen in the buffer by table key. Accesses to the buffered data can therefore only analyze field contents up to the last speci fied key field for restricting the dataset to be searched.The left-justified part of the key should therefore be as large as possible in such accesses. For example, if you do not define the first key field, the system has to cream off the full table. In this case direct access to the database can be more efficient if the database has suitable secondary indexes Page 61. When Should you Use Full Buffering? When decision making whether a table should be fully buffered, you should take into account the size of the table, the number of read accesses, and the number of write accesses. Tables best suited to full buffering are small, read frequently, and rarely written.Full buffering is recommended in the following cases April 2001 35 BC ABAP Dictionary Full Buffering SAP AG Tables up to 30 KB in size. If a table is accessed frequently, but all accesses are read accesses, this value can be exceeded. However, you should always pay attention to the buffer utilization. Larger tables where large numbers of records are frequently accessed. If these mass accesses can be formulated with a very selective WHERE condition using a database index Page 61, it could be better to dispense with buffering.Tables for which accesses to non-existent records are frequently submitted. Since all the table records reside in the buffer, the system can determine directly in the buffer whether or not a record exists. 36 April 2001 SAP AG BC ABAP Dictionary Generic Buffering Generic Buffering With generic buffering, all the records in the buffer whose generic key fields match this record are loaded when one record of the table is accessed. The generic key is a part of the primary key of the table that is left-justified. In this example, the record highlighted in red is read by a program from table SCOUNTER.If the table is generically buffered, all the records read whose generic key fields (MANDT and CARRID) agree are loaded into the buffer. Database table SCOUNTER MANDT CARRID COUNTNUM AI RPORT Buffer contents 001 001 001 001 001 001 001 001 LH LH LH LH LH LH LH LH 00000001 00000002 00000003 00000004 00000005 00000006 00000007 00000008 BER DEN FRA LCY LGW LHR MUC RTM 001 001 001 001 001 001 001 001 001 001 001 001 001 001 AA BA BA BA BA LH LH LH LH LH LH LH LH UA 00000001 00000001 00000002 00000003 00000004 00000001 00000002 00000003 00000004 00000005 00000006 00000007 00000008 00000001ACA ACE BER LCY LHR BER DEN FRA LCY LGW LHR MUC RTM HAM Application server Generic key SELECT * FROM SCOUNTER WHERE MANDT = 001 AND CARRID = LH AND COUNTNUM = 00000004. When Should you Use Full Buffering? A table should be buffered generically if only certain generic areas of the table are normally needed for processing. Client-specific, fully-buffered tables are automatically generically buffered since normally it is not possible to work in all invitees at the same time on an application server. The client field is the generic key. Language-specific tables are another example where g eneric buffering is recommended.In general, only records of one language will be needed on an application server. In this case, the generic key includes all the key fields up to and including the language field. How Should you Define the Generic Key? In generic buffering, it is crucial to define a suitable generic key. April 2001 37 BC ABAP Dictionary Generic Buffering SAP AG If the generic key is too small, the buffer will contain a hardly a(prenominal) very large areas. During access, too much data efficacy be loaded in the buffer. If the generic key is too large, the buffer might contain too many small generic areas.These can reduce buffer performance since there is an administrative entry for every buffered generic area. It is also possible that too many accesses will beltway the buffer and go directly to the database, since they do not fully define the generic key of the table. If there are only a few records in each generic area, it is usually better to fully buffer the ta ble. Only 64 bytes of the generic key are used. You can specify a longer generic key, but the part of the key colossal 64 bytes is not used to create the generic areas. Access to Buffered DataIt only makes sense to generically buffer a table if the table is accessed with fully-specified generic key fields. If a field of the generic key is not assigned a value in a SELECT statement, it is read directly from the database, bypassing the buffer. If you access a generic area that is not in the buffer with a fully-specified generic key, you will access the database to load the area. If the table does not contain any records in the specified area (No record found), this area in the buffer is marked as non-existent. It is not necessary to access the database if this area is needed again. 8 April 2001 SAP AG BC ABAP Dictionary Single-Record Buffering Single-Record Buffering With single-record buffering, only the records that are actually read are loaded into the buffer. Single-record buffe ring therefore requires less storage space in the buffer than generic and full buffering. The administrative costs in the buffer, however, are greater than for generic or full buffering. Considerably more database accesses are necessary to load the records than for the other buffering types. In this example, the record highlighted in red is read by a program from table SCOUNTER.If single-record buffering is selected for the table, only the record that was read is loaded into the buffer. Database table SCOUNTER MANDT CARRID COUNTNUM AIRPORT Buffer contents 001 LH 00000004 LCY 001 001 001 001 001 001 001 001 001 001 001 001 001 001 AA BA BA BA BA LH LH LH LH LH LH LH LH UA 00000001 00000001 00000002 00000003 00000004 00000001 00000002 00000003 00000004 00000005 00000006 00000007 00000008 00000001 ACA ACE BER LCY LHR BER DEN FRA LCY LGW LHR MUC RTM HAM Application server SELECT SINGLE FROM SCOUNTER WHERE MANDT = 001 AND CARRID = LH AND COUNTNUM = 00000004.When Should you Use Single-Rec ord Buffering? Single-record buffering should be used particularly for large tables where only a few records are accessed with SELECT SINGLE. The size of the records being accessed should be between 100 and 200 KB. Full buffering is usually more suitable for smaller tables that are accessed frequently. This is because only one database access is necessary to load such a table with full buffering, whereas several database accesses are necessary for single-record buffering. Access to Buffered Data All accesses that are not submitted with SELECT SINGLE go directly to the database, bypassing the buffer.This applies even if the complete key is specified in the SELECT statement. April 2001 39 BC ABAP Dictionary Single-Record Buffering SAP AG If you access a record which is not yet buffered with SELECT SINGLE, there is a database access to load the record. This record is marked in the buffer as non-existent if the table does not contain a record with the specified key. This prevents anoth er database access when accessing the table at a later time with the same key. 40 April 2001 SAP AG BC ABAP Dictionary Logging Logging Using the logging flag you can define whether changes to the data records of a table should be logged.If logging is switched on, each change to an existing data record (with UPDATE, DELETE) by the user or application program is recorded in the database in a log table (DBTABPRT). ABAP Dictionary Log TAB Application transaction TAB Change a record Field 1 Field 2 Field 3 System profile rec/client = solely TAB Field 1 Field 2 Field 3 Log table Database To switch on logging, the R/3 System must be started with a profile containing parameter rec/client. This parameter defines whether all clients or only selected clients should be logged. The parameter can have the following values rec/client = ALL Log all clients. ec/client = 000, Log the specified clients. rec/client = OFF Do not log. Logging slows down accesses that change the table. First of all, a record must be written in the log table for each change. Secondly, a number of users access this log table in parallel. This can cause lock situations although the users are working with different application tables. Logging is independent of the update. The existing logs can be displayed with Transaction Table History (SCU3). April 2001 41 BC ABAP Dictionary Converting Pooled Tables to Transparent Tables SAP AG Converting Pooled Tables to Transparent Tables
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment