TYPES dtype [TYPE type|LIKE dobj] ...
types: begin of EMPLOYEE, " type definition WID(10) type C, FIRST_NAME(15) type C, LAST_NAME(15) type C, AGE type I, end of EMPLOYEE. data EMP1 type EMPLOYEE. " declare variant types EMP like EMP1. " type definition using exist variant data EMP2 like EMP1. " declare variant using exist variant宣告變數(EMPLOYEE):
DATA var [{TYPE type}|{LIKE dobj}] ...
data: begin of EMPLOYEE, " declare variant with structs WID(10) type C, FIRST_NAME(15) type C, LAST_NAME(15) type C, AGE type I, end of EMPLOYEE. data EMP3 like EMPLOYEE. " declare variant using exist variant宣告常數:
constants: CNAME(10) value 'Bruce', BIRTHDAY type D value '19650201'. constants: begin of MYADDRESS, NAME type C length 20 value 'Fred Flintstone', STREET type C length 20 value 'Cave Avenue', NUMBER type P value 11, POSTCODE type N length 5 value 98765, CITY type C length 20 value 'Bedrock', end of MYADDRESS.宣告表格:
tables: SPFL. " load from ABAP/4 Dictionary select * from SPFL. " iterator data write: SPFL-MANDT, SPFL-CARRID, SPFL-CONNECTION. endselect.