Abap Basic's

Data types and variables ABAP provides a set of built-in data types. In addition, every structure, table, view or data element defined in the ABAP Dictionary can be used to type a variable. Also, object classes and interfaces can be used as types. Data and Types The built-in data types are: Type Description I Integer (4-bytes) P Packed decimal F Floating point N Character numeric C Character D Date T Time X Hexadecimal (raw byte) STRING Variable-length string XSTRING Variab
of 11
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
  Data types and variables ABAP provides a set of built-in data types. In addition, every structure, table, view or data elementdefined in the ABAP Dictionary can be used to type a variable. Also, object classes and interfaces can beused as types. Data and Types  The built-in data types are: Type Description I Integer (4-bytes)P Packed decimalF Floating pointN Character numericC Character D DateT TimeX Hexadecimal (raw byte)STRING Variable-length stringXSTRING Variable-length raw byte array Date variables or constants (type D) contain the number of days since January 1, AD 1. Time variables or constants (type T) contain the number of seconds since midnight. A special characteristic of both types isthat they can be accessed both as integers and as character strings (with internal format YYYYMMDD for dates and hhmmss for times), which makes date/time handling very easy. For example, the codesnippet below calculates the last day of the previous month (note: SY-DATUM is a system-definedvariable containing the current date): DATA  LAST_EOM TYPE D.  last end-of-month date  * Start from today's date   LAST_EOM=SY-DATUM.  * Set characters 6 and 7 (0-relative) of the YYYYMMDD string to 01 , * giving the first day of the current month LAST_EOM+6(2) = '01'.  * Subtract one day LAST_EOM=LAST_EOM-1.  WRI TE : 'Last day of previous month was',LAST_EOM.  All ABAP variables must be explicitlydeclaredin order to be used. Normally all declarations are placed atthe top of the code module (program, subroutine, function) before the first executable statement; thisplacement is a convention and not an enforced syntax rule. The declaration consists of the name, type,length (where applicable), additional modifiers (e.g. the number of implied decimals for a packed decimalfield) and optionally an initial value: * Primitive types:  DATA  :COUNTER TYPE I, VALIDITY TYPE I VALUE 60, TAXRATE(3)  TYPE P DEC IM  ALS 1, LASTNAME(20)  TYPE C, DESCRIPTION TYPE   ST RING . * Dictionary types:  DATA  :ORIGIN TYPE   COU N T R  Y . * Internal table:  DATA  :T_FLIGHTS TYPE   TABLE OF FLIGHTINFO, T_LOOKUP TYPE   HASHED TABLE OF FLT_LOOKUP. * Objects:  DATA  :BOOKING TYPE   R  EF TO CL_FLT_BOOKING.  Notice the use of the colon to chain together consecutive DATA statements. Internal tables in ABAP Internal tables are an extremely important feature of the ABAP language and merit to be explained atsome length. Internal tables provide a means of taking data from a fixed structure and storing it in workingmemory in ABAP. The data is stored line by line in memory, each line having the same structure. InABAP, internal tables fulfil the function of arrays. Internal tables are used whenever there is a need toprocess a dataset with a fixed structure within a program. A particularly important use for internal tables isfor storing and formatting data from a database table within a program. They are also a good way of including very complicated data structures in an ABAP program.  An internal table would be defined as a vector of  struct  s in C++ or a vector of objects in Java. The maindifference with these languages is that ABAP provides a collection of statements to easily access andmanipulate the contents of internal tables. It should be noted that ABAP does not support arrays; the onlyway to define a multi-element data object is to use an internal table.Like all elements in the ABAP type concept, internal tables can exist both as data types and as dataobjects. A data type is the abstract description of an internal table, either in a program or centrally in theABAP Dictionary Internal tables as data typesInternal tables and structures are the two structured data types in ABAP.The data type of an internal table is fully specified by its line type, key,and table type. Line type The line type of an internal table can be any data type. The data type of an internal table is normally a structure. Each component of the structureis a column in the internal table. However, the line type may also beelementary or another internal table.Line Type can also refer to an ABAP Object's reference pointer value. If two ABAP Objects are not related, they do not have the same line type.The line type is stored in the value of the reference pointer and can beviewed in the debugger. If one object attempts to access another unrelated object's components, you will receive an error specifying thatthe line types do not match. Key The key identifies table rows. There are two kinds of key for internaltables - the standard key and a user-defined key. You can specifywhether the key is UNIQUE or NON-UNIQUE. Internal tables with aunique key cannot contain duplicate entries with the same key. Theuniqueness depends on the table access method.If a table has a structured line type, its default key consists of all of itsnon-numerical columns that are not references or themselves internaltables. If a table has an elementary line type, the default key is the entireline. An internal table which has a line type that is itself an internal table,has an empty key.
Related Search
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