MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
Lecture04 abap on line
1. Lecture 4 Local Data Types and Definitions BCO5647 Applications Programming Techniques (ABAP)
2.
3.
4.
5.
6.
7.
8.
Notes de l'éditeur
Elementary Data Types There are 10 pre-defined or “built-in” data types in ABAP. Numeric Data: P suitable for amounts of money, lengths and weights ; I suitable for counters and quantities ; F suitable for calculations involving very large values .
Elementary Data Types The data statement is used to define variables in an ABAP program. Variable names can be 1 to 30 characters long. Character or text fields are type c. This is the default type when no type is specified. The city and flag fields both default to type c. Fields of type n (numeric text) are appropriate for numbers used for identification. E.g. Postcodes, account numbers, student numbers . Type n fields pad the left side with zeros What would be the output of the write statement in the slide? 0006980 Numbers: Integers (type i) mainly used for counting Packed numbers (type p) used for values with a constant number of decimal places, such as prices.
User-defined Data Types The first approach on the slide uses the like for referencing a variable. The variable vendor_name inherits all attributes (type c and length 25) from the variable customer_name . Changes to the definition of the customer_name automatically cause the same changes in the definition of vendor_name . Where does the variable carridcode gets its attributes from? (Data Dictionary) You can refer to fields in the ABAP Dictionary that come with the R/3 system. What is the advantage of this? (Consistency and efficiency) The Dictionary’s active integration ensures that all changes to the definitions of fields are automatically forwarded to all programs using those fields, so your references will always access the most current information. Using the Dictionary is highly recommended - it allows large program systems to be developed using correct consistent information. The second approach on the slide makes reference to the types statement. The definition used for type t_name is applied to both the customer_name and vendor_names fields, and any change to the t_ name definition automatically causes the same change in the definitions of both fields. The last example: carridcode type s_carr_id illustrates that type can reference the DD via naming a data element.
Structure (was referred to as a Field Strings in previous versions) In the above example the field string customer contains 3 variables - id fname and l name. Information has been added for each of the fields. What is the output from the write statements? Can you see an application for field strings? (dates) To make variables reusable in other programs (global) you can define them as structures in the Dictionary, making them automatically available in all ABAP programs. Have you used any variables in your workshop exercises that were not defined in your program ? (system variables - these have been defined in an object called a structure in the Dictionary and are available to all programs. )