{"id":2169,"date":"2019-02-28T04:18:21","date_gmt":"2019-02-28T04:18:21","guid":{"rendered":"https:\/\/www.se80.co.uk\/training-education\/?p=2169"},"modified":"2019-02-28T04:31:19","modified_gmt":"2019-02-28T04:31:19","slug":"abap-predefined-data-types","status":"publish","type":"post","link":"https:\/\/www.se80.co.uk\/training-education\/abap-predefined-data-types\/","title":{"rendered":"ABAP predefined data types such as Char, Date, Time, integer"},"content":{"rendered":"<p> Simple ABAP code to demonstrate the  ABAP predefined data types such as Char, Date, Time, integer. Note you would usually have all the WRITE statements after all the data declarations but just makes it clearer to put them together for this example<\/p>\n<h2>ABAP code list to demonstrate data types<\/h2>\n<p><pre>\r\n*&-------------------------------*\r\n*& Report  ZABAP_DATA_TYPES\r\n*&-------------------------------*\r\n*&-------------------------------*\r\nREPORT ZABAP_DATA_TYPES.\r\n<\/pre>\n<p><H3>Type I (Integer)<\/h3>\n<p>This is the basic numeric integer type which only accepts whole numbers<\/p>\n<pre>DATA: ld_int type I.\r\nld_int = 200.\r\nWRITE:\/ ld_int.<\/pre>\n<h3>Type F (Floating point number)<\/h3>\n<p>This is a numeric value with decimal places used for calculation results<\/p>\n<pre>DATA: ld_float  type f.\r\nld_float = ld_int \/ 22.\r\nWRITE:\/ ld_float.<\/pre>\n<h3>Type P (Packed number)<\/h3>\n<p> This is a numeric value with decimals places, packed data types also allow you to define the number of decimal places<\/p>\n<pre>DATA: ld_packed type p decimals 2 value '88.345'.\r\nWRITE:\/ ld_packed. \"notice because it is only 2 decimal places the value is rounded<\/pre>\n<h3>Type C (Character)<\/h3>\n<p>This is an alphanumeric text value of whatever length you specify up to the maximum length<\/p>\n<pre>DATA: ld_char      type c, \"length = 1\r\n      ld_char2(30) type c value 'Hello'. \"length = 30\r\nWRITE:\/ ld_char2.<\/pre>\n<h3>Type D (Date)<\/h3>\n<p>This field stores a date value in the format YYYYMMDD<\/p>\n<pre>DATA: ld_date  type d value '19991230',\r\n      ld_date2 type begda. \"using a dictionary type\r\n\r\nld_date2 = sy-datum. \"set value to today's date\r\n*Although the value is stored in YYYYMMDD it is displayed in a different\r\n*format either based on the users setting or specifying the output i.e.\r\nWRITE:\/ ld_date2 DD\/MM\/YYYY,\r\n      \/ ld_date2 DDMMYY.\"etc<\/pre>\n<h3>Type N (Numeric)<\/h3>\n<p>This stores a numeric text value fills any unused capacity with zeros<\/p>\n<pre>DATA: ld_numc      type n, \"1 char long\r\n      ld_numc2(10) type n value 1025. \"30 chars long\r\nWRITE:\/ ld_numc2. \"0000001025<\/pre>\n<h3>Type T (Time)<\/h3>\n<p>This stores a time value, the value is stored in seconds but displayed in HHMMSS<\/p>\n<pre>DATA: ld_time      type t value 1, \"displayed as 00:00:01 i.e. 1 second\r\n      ld_time2     type t value 60, \"displayed as 00:01:00 i.e. 1 minute\r\n      ld_time3     type t value 3661. \"displayed as 01:01:01 i.e. 1 hour,1 minute & 1 second\r\nWRITE:\/ ld_time,  \"000001\r\n      \/ ld_time2, \"000100\r\n      \/ ld_time3. \"010101<\/pre>\n<h3>Type X (Hexadecimal)<\/h3>\n<p>This stores a hexadecimal value could be used for creating files and inserting hexadecimal characters to insert tabs a new line<\/h3>\n<pre>DATA: ld_hex type x value '09', \"Tab\r\n      ld_hex2 type x value '0D'. \"Carriage Return(new line)\r\nWRITE:\/ ld_hex,\r\n      \/ ld_hex2.<\/pre><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Simple ABAP code to demonstrate the ABAP predefined data types such as Char, Date, Time, integer. Note you would usually have all the WRITE statements after all the data declarations but just makes it clearer to put them together for this example ABAP code list to demonstrate data types *&#038;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-* *&#038; Report ZABAP_DATA_TYPES *&#038;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-* *&#038;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-* [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2185,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[11],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>ABAP predefined data types such as Char, Date, Time, integer<\/title>\n<meta name=\"description\" content=\"List of ABAP predefined data types such as Char, Date, Time, integer, numeric and how they can be used within your SAP reports\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.se80.co.uk\/training-education\/abap-predefined-data-types\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ABAP predefined data types such as Char, Date, Time, integer\" \/>\n<meta property=\"og:description\" content=\"List of ABAP predefined data types such as Char, Date, Time, integer, numeric and how they can be used within your SAP reports\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.se80.co.uk\/training-education\/abap-predefined-data-types\/\" \/>\n<meta property=\"og:site_name\" content=\"SAP Help, Training and Education\" \/>\n<meta property=\"article:published_time\" content=\"2019-02-28T04:18:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-02-28T04:31:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.se80.co.uk\/training-education\/wp-content\/uploads\/2019\/02\/abap-data-types.png\" \/>\n\t<meta property=\"og:image:width\" content=\"450\" \/>\n\t<meta property=\"og:image:height\" content=\"355\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"se80\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"se80\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.se80.co.uk\/training-education\/abap-predefined-data-types\/\",\"url\":\"https:\/\/www.se80.co.uk\/training-education\/abap-predefined-data-types\/\",\"name\":\"ABAP predefined data types such as Char, Date, Time, integer\",\"isPartOf\":{\"@id\":\"https:\/\/www.se80.co.uk\/training-education\/#website\"},\"datePublished\":\"2019-02-28T04:18:21+00:00\",\"dateModified\":\"2019-02-28T04:31:19+00:00\",\"author\":{\"@id\":\"https:\/\/www.se80.co.uk\/training-education\/#\/schema\/person\/ddc6a049c1b0790f62d70278be75e511\"},\"description\":\"List of ABAP predefined data types such as Char, Date, Time, integer, numeric and how they can be used within your SAP reports\",\"breadcrumb\":{\"@id\":\"https:\/\/www.se80.co.uk\/training-education\/abap-predefined-data-types\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.se80.co.uk\/training-education\/abap-predefined-data-types\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.se80.co.uk\/training-education\/abap-predefined-data-types\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.se80.co.uk\/training-education\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ABAP predefined data types such as Char, Date, Time, integer\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.se80.co.uk\/training-education\/#website\",\"url\":\"https:\/\/www.se80.co.uk\/training-education\/\",\"name\":\"SAP Help, Training and Education\",\"description\":\"Learn SAP\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.se80.co.uk\/training-education\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.se80.co.uk\/training-education\/#\/schema\/person\/ddc6a049c1b0790f62d70278be75e511\",\"name\":\"se80\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.se80.co.uk\/training-education\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3fd4e388f05bf3c763e46cd1f77afeb2?s=96&d=retro&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3fd4e388f05bf3c763e46cd1f77afeb2?s=96&d=retro&r=g\",\"caption\":\"se80\"},\"url\":\"https:\/\/www.se80.co.uk\/training-education\/author\/se80\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ABAP predefined data types such as Char, Date, Time, integer","description":"List of ABAP predefined data types such as Char, Date, Time, integer, numeric and how they can be used within your SAP reports","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.se80.co.uk\/training-education\/abap-predefined-data-types\/","og_locale":"en_US","og_type":"article","og_title":"ABAP predefined data types such as Char, Date, Time, integer","og_description":"List of ABAP predefined data types such as Char, Date, Time, integer, numeric and how they can be used within your SAP reports","og_url":"https:\/\/www.se80.co.uk\/training-education\/abap-predefined-data-types\/","og_site_name":"SAP Help, Training and Education","article_published_time":"2019-02-28T04:18:21+00:00","article_modified_time":"2019-02-28T04:31:19+00:00","og_image":[{"width":450,"height":355,"url":"https:\/\/www.se80.co.uk\/training-education\/wp-content\/uploads\/2019\/02\/abap-data-types.png","type":"image\/png"}],"author":"se80","twitter_card":"summary_large_image","twitter_misc":{"Written by":"se80","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.se80.co.uk\/training-education\/abap-predefined-data-types\/","url":"https:\/\/www.se80.co.uk\/training-education\/abap-predefined-data-types\/","name":"ABAP predefined data types such as Char, Date, Time, integer","isPartOf":{"@id":"https:\/\/www.se80.co.uk\/training-education\/#website"},"datePublished":"2019-02-28T04:18:21+00:00","dateModified":"2019-02-28T04:31:19+00:00","author":{"@id":"https:\/\/www.se80.co.uk\/training-education\/#\/schema\/person\/ddc6a049c1b0790f62d70278be75e511"},"description":"List of ABAP predefined data types such as Char, Date, Time, integer, numeric and how they can be used within your SAP reports","breadcrumb":{"@id":"https:\/\/www.se80.co.uk\/training-education\/abap-predefined-data-types\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.se80.co.uk\/training-education\/abap-predefined-data-types\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.se80.co.uk\/training-education\/abap-predefined-data-types\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.se80.co.uk\/training-education\/"},{"@type":"ListItem","position":2,"name":"ABAP predefined data types such as Char, Date, Time, integer"}]},{"@type":"WebSite","@id":"https:\/\/www.se80.co.uk\/training-education\/#website","url":"https:\/\/www.se80.co.uk\/training-education\/","name":"SAP Help, Training and Education","description":"Learn SAP","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.se80.co.uk\/training-education\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.se80.co.uk\/training-education\/#\/schema\/person\/ddc6a049c1b0790f62d70278be75e511","name":"se80","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.se80.co.uk\/training-education\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3fd4e388f05bf3c763e46cd1f77afeb2?s=96&d=retro&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3fd4e388f05bf3c763e46cd1f77afeb2?s=96&d=retro&r=g","caption":"se80"},"url":"https:\/\/www.se80.co.uk\/training-education\/author\/se80\/"}]}},"jetpack_featured_media_url":"https:\/\/www.se80.co.uk\/training-education\/wp-content\/uploads\/2019\/02\/abap-data-types.png","_links":{"self":[{"href":"https:\/\/www.se80.co.uk\/training-education\/wp-json\/wp\/v2\/posts\/2169"}],"collection":[{"href":"https:\/\/www.se80.co.uk\/training-education\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.se80.co.uk\/training-education\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.se80.co.uk\/training-education\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.se80.co.uk\/training-education\/wp-json\/wp\/v2\/comments?post=2169"}],"version-history":[{"count":15,"href":"https:\/\/www.se80.co.uk\/training-education\/wp-json\/wp\/v2\/posts\/2169\/revisions"}],"predecessor-version":[{"id":2184,"href":"https:\/\/www.se80.co.uk\/training-education\/wp-json\/wp\/v2\/posts\/2169\/revisions\/2184"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.se80.co.uk\/training-education\/wp-json\/wp\/v2\/media\/2185"}],"wp:attachment":[{"href":"https:\/\/www.se80.co.uk\/training-education\/wp-json\/wp\/v2\/media?parent=2169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.se80.co.uk\/training-education\/wp-json\/wp\/v2\/categories?post=2169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.se80.co.uk\/training-education\/wp-json\/wp\/v2\/tags?post=2169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}