ABAP/4 Defining Data • Defining Data: – – – – – Data statement Parameters statement Tables statement Constants statement Data statement to define field strings – User defined Data types – Type-pools ABAP/4 Defining Data • Defining Variables: – Data statement data f1(2) type c. data f2 like f1. data : max_value type I value 100, cur_date type d value ‘19990201’ – Parameters statement • Special type of variable that will accept input from user. – Parameters p1(2) type c. – Parameters cur_date type d default ‘19980211’ obligatory. ABAP/4 Defining Data • Data types – Character and Numeric • Character Data types Data Type Internal Description Default Internal Length Max Internal Length Valid Values Default Initial Value c character 1 65535 Any char Blank n Numeric text 1 65535 0-9 0 d date 8 (fixed) - 0-9 00000000 t time 6 (fixed) - 0-9 000000 x hexadecimal 1 65535 Any ABAP/4 Defining Data • Data types – Character and Numeric • Numeric Data types Data Type Internal Description Default Internal Length Max Length/ Dec Valid Values Default Initial Value I integer 4(fixed) -/0 -231 to + 231 0 P Packed decimal 8 16 / 14 0-9 0 F Floating point 8 22 / 15* -E-307 to 1E308 0.0 • Use integers for simple computations, counters, indexes etc • Floating point for very large values or many decimal places. ABAP/4 Defining Data • Defining constants: – Identical to a variable except that its value cannot be changed. – Constants c1(2) type c value ‘AA’. – Constants c2 like c1 value ‘BB’ • Defining Field strings: • Type of variable, equivalent structure in DDIC but is defined within ABAP program • Has global and local visibility. – Data: begin of totals, region(7) value ‘unknown’, debits(15) type p, count type I, end of totals. Totals-debits = 100. Totals-counts = 10. ABAP/4 Defining Data • Using Tables statement to define a field string. • Has global and external visibility no matter where it is placed in the program. – Tables ztxlfa1. – Ztxlfa1-name1 = ‘Bugsy’. – Ztxlfa1-land1 = ‘US’. • User defined types: – Types : dollars(16) type p decimals 2. – Data : petty_cash type dollars, – Pay_outs type dollars, – lump_sums type dollars. ABAP/4 Defining Data • Using Type groups (Type-pool) to define types or constants. – Data Dictionary object that contains one or more types or constants statements. – Multiple programs can share a type group.