 SAP AG CSU Chico MINS298c ABAP/4 Programming Introduction to Data Types Chapter 4 Fall 1998.

Slides:



Advertisements
Similar presentations
Chapter 3. Expressions and Interactivity CSC125 Introduction to C++
Advertisements

Names and Bindings.
1 Chapter 2 Basic Elements of Fortran Programming.
Dale Roberts Basic I/O – printf() CSCI 230 Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Department of.
The Web Warrior Guide to Web Design Technologies
The Print Formatting Statement … named printf. 2 Introduction to printf statements print and println statements don’t allow us to easily format output.
Chapter 10.
 SAP AG CSU Chico MINS298c ABAP/4 Programming Gail Corbitt Fall 1998 Chapter 1-3.
VBA Modules, Functions, Variables, and Constants
1 Chapter 9 - Formatted Input/Output Outline 9.1Introduction 9.2Streams 9.3Formatting Output with printf 9.4Printing Integers 9.5Printing Floating-Point.
Chapter 9 Formatted Input/Output Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 9 - Formatted Input/Output Outline 9.1Introduction.
 2007 Pearson Education, Inc. All rights reserved C Formatted Input/Output.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 9 - Formatted Input/Output Outline 9.1Introduction 9.2Streams 9.3Formatting Output with printf.
Chapter 2: Introduction to C++.
 2007 Pearson Education, Inc. All rights reserved C Formatted Input/Output.
Input and Output in Console Mode UNIVERSITY OF THE PUNJAB (GUJRANWALA CAMPUS) ADNAN BABAR MT14028 CR
 2000 Prentice Hall, Inc. All rights reserved. Chapter 9 - Formatted Input/Output Outline 9.1Introduction 9.2Streams 9.3Formatting Output with printf.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Streams Streams –Sequences of characters organized.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 9 - Formatted Input/Output Outline 9.1Introduction.
Chapter 9 Formatted Input/Output. Objectives In this chapter, you will learn: –To understand input and output streams. –To be able to use all print formatting.
Chapter 9 Formatted Input/Output Associate Prof. Yuh-Shyan Chen Dept. of Computer Science and Information Engineering National Chung-Cheng University.
 Pearson Education, Inc. All rights reserved Formatted Output.
EPSII 59:006 Spring Introduction In this lecture  Formatted Input/Output scanf and printf  Streams (input and output) gets, puts, getchar, putchar.
Chapter 9 - Formatted Input/Output Outline 9.1Introduction 9.2Streams 9.3Formatting Output with printf 9.4Printing Integers 9.5Printing Floating-Point.
Lesson 1: Introduction to ABAP OBJECTS Todd A. Boyle, Ph.D. St. Francis Xavier University.
CHAPTER:14 Simple Queries in SQL Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
Chapter 3 Processing and Interactive Input. 2 Assignment  The general syntax for an assignment statement is variable = operand; The operand to the right.
CNG 140 C Programming Lecture Notes 2 Processing and Interactive Input Spring 2007.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
MIS 3020 ABAP Programming Lecture 2 Elementary & User Defined Types Domains, Elements, Variables/Fields.
Chapter 3: Formatted Input/Output Copyright © 2008 W. W. Norton & Company. All rights reserved. 1 Chapter 3 Formatted Input/Output.
Chapter 15 Introduction to PL/SQL. Chapter Objectives  Explain the benefits of using PL/SQL blocks versus several SQL statements  Identify the sections.
SQL Fundamentals  SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 2: Introduction to C++
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
ISBN Chapter 6 Data Types Introduction Primitive Data Types User-Defined Ordinal Types.
Chapter 3 – Variables and Arithmetic Operations. Variable Rules u Must declare all variable names –List name and type u Keep length to 31 characters –Older.
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
S CCS 200: I NTERACTIVE I NPUT Lect. Napat Amphaiphan.
SAP DEVELOPMENT BASICS Bohuslav Tesar. TRAINING OVERVIEW Amazing life of ABAP developer ;) SAP introduction ABAP basics ABAP Reporting.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
Introduction ABAP Fields and Variables. Slide 2 Fields (Introduction) In ABAP, fields (or data objects) are named locations in memory Variables store.
Operating System Discussion Section. The Basics of C Reference: Lecture note 2 and 3 notes.html.
C How to Program, 7/e © by Pearson Education, Inc. All Rights Reserved.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
Variables in C Topics  Naming Variables  Declaring Variables  Using Variables  The Assignment Statement Reading  Sections
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Introduction to C++
Chapter 3: Formatted Input/Output 1 Chapter 3 Formatted Input/Output.
+ Note On the Use of Different Data Types Use the data type that conserves memory and still accomplishes the desired purpose. For example, depending on.
Chapter 9 - Formatted Input/Output
C Formatted Input/Output
C++ Basic Input and Output (I/O)
Arithmetic Expressions Function Calls Output
BASIC ELEMENTS OF A COMPUTER PROGRAM
Value-Returning Functions
Fundamentals of PL/SQL part 1 (Basics)
TMF1414 Introduction to Programming
Variables and Arithmetic Operations
Variables In programming, we often need to have places to store data. These receptacles are called variables. They are called that because they can change.
Chapter 3 The DATA DIVISION.
Numbers.
Chapter 9 - Formatted Input/Output
Computing in COBOL: The Arithmetic Verbs and Intrinsic Functions
CHAPTER FOUR VARIABLES AND CONSTANTS
Chapter 2: Introduction to C++.
Data Types and Expressions
Variables in C Topics Naming Variables Declaring Variables
Presentation transcript:

 SAP AG CSU Chico MINS298c ABAP/4 Programming Introduction to Data Types Chapter 4 Fall 1998

 SAP AG CSU Chico Overview Introduction Declaration Data Types elementary complex Working with Data Types

 SAP AG CSU Chico Data Objects Data Object VariableFixed ??

 SAP AG CSU Chico Data Objects Data Object VariableFixed LiteralsConstants

 SAP AG CSU Chico Fixed Data Objects (Constants and Literals) CONSTANTS: company_name(3) type c value ‘SAP’. Literals are inside quotes WRITE: ‘Happiness is SAP’.

 SAP AG CSU Chico Hierarchy Variable Data Objects Table RecordField Table is made up of Records(s) is made up of have a structure Field(s) is made up of characters have a type

 SAP AG CSU Chico Fields are Variables may be declared at any point within the program may use up to 30 characters in name may use hyphen, but prefer dash for readability may not use an ABAP reserved word follow rules of scope definition

 SAP AG CSU Chico Normal Scope Program DATA A, B, C Form DATA X, Y, Z Form DATA D, E, F Write A Write F Write A Write F Write A Write F According to normal rules of “scope,” which Write statements are legal and which are not? Line

 SAP AG CSU Chico Data Types User defined Pre-defined (p,i,f,c,n,d,t,x) ElementaryStructured Structured typeTable type

 SAP AG CSU Chico Data Types User defined Pre-defined (p,i,f,c,n,d,t,x) ElementaryStructured Structured typeTable type

 SAP AG CSU Chico Pre-defined Types (with default length and value) Character DefaultJustify c 1 space left n 1 ‘0’ left Numbers i 4 0 right p 8 0 right f right Date (d) 8 ‘ ’ left Time (t) 6 ‘000000’ left Hexadecimal (x) 1 ‘00’ left

 SAP AG CSU Chico Data Types User defined Pre-defined (p,i,f,c,n,d,t,x) ElementaryStructured Structured typeTable type

 SAP AG CSU Chico Three Ways to Declare Types pre-defined elementary types non-elementary types existing fields

 SAP AG CSU Chico Types and Data Statement DATA var[(length)] [TYPE type] [DECIMALS num] [VALUE init] TYPES BEGIN OF rec-name [fieldname]… END OF rec-name DATA var LIKE table-field [VALUE init]

 SAP AG CSU Chico Similar Declarations Data: customer_name(25) type c, vendor_name(25) type c. TYPES name(25) type c. DATA: customer_name type name, vendor_name type name. DATA: customer_name(25) type c, vendor_name LIKE customer_name.

 SAP AG CSU Chico What are the defaults here? What are the default type and length of ‘flag’ and of ‘my_number’? DATA: flag, my_number. What is contained in ‘c_alpha’ and ‘n_alpha’? DATA: c_alpha(3) type c value ‘5’, n_alpha(3) type n value ‘5’.

 SAP AG CSU Chico Character: C vs N C = justifies left and has trailing blanks N = justifies right and has leading zeroes What happens with: DATA: var-1(4) type c value ‘1234’, var-2(4) type n value ‘1234’. WRITE:/ var-1, var-2.

 SAP AG CSU Chico What are the defaults here? What is contained in ‘c_alpha’ and ‘n_alpha’? DATA: c_alpha(3) type c value ‘5’, n_alpha(3) type n value ‘5’.

 SAP AG CSU Chico Numbers i - cannot have explicit length p - 15 digits, can explicitly define decimal places DATA Dollars TYPE p DECIMALS 2. f - handles exponential, subject to rounding errors sometimes (1.0/3.0)*3.0 is not 1.0

 SAP AG CSU Chico Dates and Times Date = d stored as YYYYMMDD with initial value of Time = t stored as HHMMSS with Why store in this format?

 SAP AG CSU Chico Which is easier to sort? 01/01/58 01/20/58 01/01/60 12/01/97 01/20/

 SAP AG CSU Chico Computations on Dates DATA my_date LIKE sy-datum. MOVE to my_date. my_date = my_date - 1. Write:\ my_date. Displays

 SAP AG CSU Chico Offset and Length Format One may address sub-parts of elementary data objects by specifying the offset and length !!! MOVE sy-datum+6(2) to hold_day sy-datum(0)sy-datum(6)

 SAP AG CSU Chico Parameter Statement Parameter statement creates a set of variable fields which are presented to the user for input on the selection screen. PARAMETERS var TYPE type [DEFAULT value]

 SAP AG CSU Chico Data Types User defined Pre-defined (p,i,f,c,n,d,t,x) ElementaryStructured Structured typeTable type

 SAP AG CSU Chico Records records or structures are called field strings in ABAP use BEGIN OF and END OF nesting is allowed use TYPES command

 SAP AG CSU Chico Field String Types TYPES : BEGIN OF ADDRESS, street(20) type c, city(20) type c, state(10) type c, zip type I, END OF ADDRESS. How large (in characters) is the record ADDRESS?

 SAP AG CSU Chico Using Field String Types TYPES : BEGIN OF ADDRESS, street(20) type c, city(20) type c, state(10) type c, zip type I, END OF ADDRESS. DATA: Old_Address TYPE Address, New_Address TYPE Address. MOVE Old_Address to New_Address.

 SAP AG CSU Chico Using Field String Types TYPES : BEGIN OF ADDRESS, street(20) type c, city(20) type c, state(10) type c, zip type I, END OF ADDRESS. DATA: Old_Address TYPE Address, New_Address TYPE Address. Old_Address Street City State Zip Old_Address-Zip Old_Address-City

 SAP AG CSU Chico Data Types User defined Pre-defined (p,i,f,c,n,d,t,x) ElementaryStructured Structured typeTable type

 SAP AG CSU Chico Creating Tables Use the occurs statement not necessary to identify the amount, may use zero (0). Format TYPES tablename TYPE type OCCURS 0. Example TYPES Address_Table TYPE ADDRESS OCCURS 0. Really creates the structure which will be allocated and maintained dynamically.

 SAP AG CSU Chico Declarative Statements DATA TYPE CONSTANTS PARAMETERS

 SAP AG CSU Chico Assignments Create program(s) to demonstrate the justification difference between the n and c types determine whether or not our system has a rounding error in the fixed point arithmetic find the difference between the current date and your birthday prove that one day before 01/01/98 is 12/31/97 using the ABAP date types use the parameter statement to interactively ask for two dates and display the difference between them.