{"id":1711,"date":"2019-02-13T23:58:30","date_gmt":"2019-02-13T23:58:30","guid":{"rendered":"https:\/\/www.se80.co.uk\/training-education\/?p=1711"},"modified":"2019-02-18T10:01:01","modified_gmt":"2019-02-18T10:01:01","slug":"abap-populate-sap-table","status":"publish","type":"post","link":"https:\/\/www.se80.co.uk\/training-education\/abap-populate-sap-table\/","title":{"rendered":"ABAP to populate SAP table"},"content":{"rendered":"<p>As discussed in the <a href=\"https:\/\/www.se80.co.uk\/sapinfo\/add-table-data.htm\">previous post<\/a> there are two basic ways you can add data to an SAP database table, manually using standard SAP transactions or via ABAP code. <\/p>\n<p>In that post, we have already discussed the first method which was to <a href=\"https:\/\/www.se80.co.uk\/sapinfo\/add-table-data.htm\">add data manually via t-codes such as SE16 and SM30<\/a>. We will now discuss the option of doing it via ABAP code. <\/p>\n<p>Using the ABAP method offers a lot more freedom to add data to any table. But with this freedom also comes great responsibility to understand what you are doing and to make sure what you are adding is correct or even valid. Mainly because this method allows you to also add data to fields that wouldn&#8217;t usually be accepted via user screen. i.e. you can ignore check tables or domain value restrictions or error messages with screen processing. <\/p>\n<p>Anyway here is a very simple ABAP program that shows you one way to add data to an SAP database table. The example demonstrates that there is no difference between tables that are maintainable and those that can&#8217;t when using ABAP code to update an SAP dictionary table. See to <a href=\"https:\/\/www.se80.co.uk\/sapinfo\/add-table-data.htm\">Add data manually via SE16\/SM30<\/a> for more info.<\/p>\n<pre>*&amp;---------------------------------------------------------------------*\r\n*&amp; Report ZADD_DATA.\r\n*&amp;\r\n*&amp;---------------------------------------------------------------------*\r\nREPORT ZADD_DATA.\r\ndata: wa_J_3RF_PRECMET type J_3RF_PRECMET,\r\n wa_EKKO type EKKO.\r\n***********************************************************************\r\n*START-OF-SELECTION.\r\nSTART-OF-SELECTION.\r\n* This table is maintainable via SE16\/SM30\r\nwa_J_3RF_PRECMET-PRECCODE = 1.\r\nwa_J_3RF_PRECMET-OKPCODE = 1.\r\nwa_J_3RF_PRECMET-COUNTABLE = 1.\r\nwa_J_3RF_PRECMET-QUNIT = 1.\r\nwa_J_3RF_PRECMET-WUNIT = 1.\r\nMODIFY <a href=\"https:\/\/www.se80.co.uk\/saptables\/j\/j_3r\/j_3rf_precmet.htm\">J_3RF_PRECMET<\/a> from wa_J_3RF_PRECMET.\r\n* This table is NOT maintainable via SE16\/SM30 but you can still\r\n* update it the same via ABAP code\r\n*wa_EKKO-EBELN =\r\n*wa_EKKO-BUKRS =\r\n*wa_EKKO-BSTYP =\r\n*wa_EKKO-BSART =\r\n*MODIFY <a href=\"https:\/\/www.se80.co.uk\/saptables\/e\/ekko\/ekko.htm\">EKKO<\/a> from wa_EKKO.<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>As discussed in the previous post there are two basic ways you can add data to an SAP database table, manually using standard SAP transactions or via ABAP code. In that post, we have already discussed the first method which was to add data manually via t-codes such as SE16 and SM30. We will now [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1800,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[11,53],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Populate SAP table with any data using ABAP code<\/title>\n<meta name=\"description\" content=\"Using ABAP code to add data to an SAP table offers a lot more freedom, but with this freedom comes great responsibility to understand how to do it correctly\" \/>\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-populate-sap-table\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Populate SAP table with any data using ABAP code\" \/>\n<meta property=\"og:description\" content=\"Using ABAP code to add data to an SAP table offers a lot more freedom, but with this freedom comes great responsibility to understand how to do it correctly\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.se80.co.uk\/training-education\/abap-populate-sap-table\/\" \/>\n<meta property=\"og:site_name\" content=\"SAP Help, Training and Education\" \/>\n<meta property=\"article:published_time\" content=\"2019-02-13T23:58:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-02-18T10:01:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.se80.co.uk\/training-education\/wp-content\/uploads\/2019\/02\/Screenshot-2019-02-18-09.59.01.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1168\" \/>\n\t<meta property=\"og:image:height\" content=\"809\" \/>\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=\"1 minute\" \/>\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-populate-sap-table\/\",\"url\":\"https:\/\/www.se80.co.uk\/training-education\/abap-populate-sap-table\/\",\"name\":\"Populate SAP table with any data using ABAP code\",\"isPartOf\":{\"@id\":\"https:\/\/www.se80.co.uk\/training-education\/#website\"},\"datePublished\":\"2019-02-13T23:58:30+00:00\",\"dateModified\":\"2019-02-18T10:01:01+00:00\",\"author\":{\"@id\":\"https:\/\/www.se80.co.uk\/training-education\/#\/schema\/person\/ddc6a049c1b0790f62d70278be75e511\"},\"description\":\"Using ABAP code to add data to an SAP table offers a lot more freedom, but with this freedom comes great responsibility to understand how to do it correctly\",\"breadcrumb\":{\"@id\":\"https:\/\/www.se80.co.uk\/training-education\/abap-populate-sap-table\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.se80.co.uk\/training-education\/abap-populate-sap-table\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.se80.co.uk\/training-education\/abap-populate-sap-table\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.se80.co.uk\/training-education\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ABAP to populate SAP table\"}]},{\"@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":"Populate SAP table with any data using ABAP code","description":"Using ABAP code to add data to an SAP table offers a lot more freedom, but with this freedom comes great responsibility to understand how to do it correctly","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-populate-sap-table\/","og_locale":"en_US","og_type":"article","og_title":"Populate SAP table with any data using ABAP code","og_description":"Using ABAP code to add data to an SAP table offers a lot more freedom, but with this freedom comes great responsibility to understand how to do it correctly","og_url":"https:\/\/www.se80.co.uk\/training-education\/abap-populate-sap-table\/","og_site_name":"SAP Help, Training and Education","article_published_time":"2019-02-13T23:58:30+00:00","article_modified_time":"2019-02-18T10:01:01+00:00","og_image":[{"width":1168,"height":809,"url":"https:\/\/www.se80.co.uk\/training-education\/wp-content\/uploads\/2019\/02\/Screenshot-2019-02-18-09.59.01.png","type":"image\/png"}],"author":"se80","twitter_card":"summary_large_image","twitter_misc":{"Written by":"se80","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.se80.co.uk\/training-education\/abap-populate-sap-table\/","url":"https:\/\/www.se80.co.uk\/training-education\/abap-populate-sap-table\/","name":"Populate SAP table with any data using ABAP code","isPartOf":{"@id":"https:\/\/www.se80.co.uk\/training-education\/#website"},"datePublished":"2019-02-13T23:58:30+00:00","dateModified":"2019-02-18T10:01:01+00:00","author":{"@id":"https:\/\/www.se80.co.uk\/training-education\/#\/schema\/person\/ddc6a049c1b0790f62d70278be75e511"},"description":"Using ABAP code to add data to an SAP table offers a lot more freedom, but with this freedom comes great responsibility to understand how to do it correctly","breadcrumb":{"@id":"https:\/\/www.se80.co.uk\/training-education\/abap-populate-sap-table\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.se80.co.uk\/training-education\/abap-populate-sap-table\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.se80.co.uk\/training-education\/abap-populate-sap-table\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.se80.co.uk\/training-education\/"},{"@type":"ListItem","position":2,"name":"ABAP to populate SAP table"}]},{"@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\/Screenshot-2019-02-18-09.59.01.png","_links":{"self":[{"href":"https:\/\/www.se80.co.uk\/training-education\/wp-json\/wp\/v2\/posts\/1711"}],"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=1711"}],"version-history":[{"count":1,"href":"https:\/\/www.se80.co.uk\/training-education\/wp-json\/wp\/v2\/posts\/1711\/revisions"}],"predecessor-version":[{"id":1712,"href":"https:\/\/www.se80.co.uk\/training-education\/wp-json\/wp\/v2\/posts\/1711\/revisions\/1712"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.se80.co.uk\/training-education\/wp-json\/wp\/v2\/media\/1800"}],"wp:attachment":[{"href":"https:\/\/www.se80.co.uk\/training-education\/wp-json\/wp\/v2\/media?parent=1711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.se80.co.uk\/training-education\/wp-json\/wp\/v2\/categories?post=1711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.se80.co.uk\/training-education\/wp-json\/wp\/v2\/tags?post=1711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}