<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: System variable types in a sqlprocedure in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/system-variable-types-in-a-sqlprocedure/qaa-p/802611#M248503</link>
    <description>&lt;P&gt;Without the actual error message we have to guess here. My guess would be that the problem is that the SELECT does not provide the correct column names for the table variable.&lt;/P&gt;&lt;P&gt;PURCHASEID simply is not  the same as AP_ID.&lt;/P&gt;&lt;P&gt;That should be fixable by simply using column aliases.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Jan 2019 10:23:20 GMT</pubDate>
    <dc:creator>lbreddemann</dc:creator>
    <dc:date>2019-01-14T10:23:20Z</dc:date>
    <item>
      <title>System variable types in a sqlprocedure</title>
      <link>https://community.sap.com/t5/technology-q-a/system-variable-types-in-a-sqlprocedure/qaq-p/802610</link>
      <description>&lt;P&gt;I have created a table in a HDBCDS file;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/258905-2019-01-14-10-39-56-window.png" /&gt;&lt;/P&gt;
  &lt;P&gt;In a store procedure i would like to use this entity and write the following code;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/258906-2019-01-14-10-41-02-window.png" /&gt;&lt;/P&gt;
  &lt;P&gt;But when i try to build the procedure, it will return with an error.&lt;/P&gt;
  &lt;P&gt;THere is a mismatch with HEADER.PURCHASEID and the variable AP_ID.&lt;/P&gt;
  &lt;P&gt;The first one is of the type CORE/EPM.BusinessKey. My own declared variable, AP_ID is of the type BIGINT.&lt;/P&gt;
  &lt;P&gt;So in my procedure file, i also would like to address the CORE library , so i can set my variable AP_ID at the right &lt;/P&gt;
  &lt;P&gt;one. &lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/258907-2019-01-14-10-43-53-window.png" /&gt;&lt;/P&gt;
  &lt;P&gt;But i cannot find anything who it is done.&lt;/P&gt;
  &lt;P&gt;Or, how can i know how the CORE data type BusinessKey is build up?&lt;/P&gt;
  &lt;P&gt;Kindly here from you!&lt;/P&gt;
  &lt;P&gt;Anton Pierhagen&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 09:47:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/system-variable-types-in-a-sqlprocedure/qaq-p/802610</guid>
      <dc:creator>AntonPierhagen</dc:creator>
      <dc:date>2019-01-14T09:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: System variable types in a sqlprocedure</title>
      <link>https://community.sap.com/t5/technology-q-a/system-variable-types-in-a-sqlprocedure/qaa-p/802611#M248503</link>
      <description>&lt;P&gt;Without the actual error message we have to guess here. My guess would be that the problem is that the SELECT does not provide the correct column names for the table variable.&lt;/P&gt;&lt;P&gt;PURCHASEID simply is not  the same as AP_ID.&lt;/P&gt;&lt;P&gt;That should be fixable by simply using column aliases.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 10:23:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/system-variable-types-in-a-sqlprocedure/qaa-p/802611#M248503</guid>
      <dc:creator>lbreddemann</dc:creator>
      <dc:date>2019-01-14T10:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: System variable types in a sqlprocedure</title>
      <link>https://community.sap.com/t5/technology-q-a/system-variable-types-in-a-sqlprocedure/qaa-p/802612#M248504</link>
      <description>&lt;P&gt;Hi Lars&lt;/P&gt;&lt;P&gt;That's correct. I would like to set for the vairable AP_ID the same data type as the PURCHASEID.&lt;/P&gt;&lt;P&gt;The PurchaseID has the type CORE.Businesskey. The AP_ID doesn't. If i let it as it is in the example which is described above, the error would be;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;    Deploying "src/functions/get_po_header_data.hdbprocedure"...&lt;BR /&gt;Error: com.sap.hana.di.procedure: Could not create the database object [8250005]&lt;BR /&gt;at "src/functions/get_po_header_data.hdbprocedure" (40:2)&lt;BR /&gt;Error: com.sap.hana.di.procedure: Database error 1306: : return type mismatch: Procedure shine:functions::get_po_header_data: Attribute name "ap_id" different from Attribute name: "PURCHASEORDERID" : line 40 col 2 (at pos 831) [8201003]&lt;BR /&gt;at "src/functions/get_po_header_data.hdbprocedure" (40:2)&lt;BR /&gt;Warning: Worker 1 running the "com.sap.hana.di.procedure" plugin has encountered an error while deploying 1 objects [8212030]&lt;BR /&gt;Warning: Command failed [8210001]&lt;BR /&gt;Error: Worker 1 has encountered an error; all remaining jobs will be canceled [8214600]&lt;BR /&gt;Error: Processing work list... failed [8212102]&lt;BR /&gt;Make failed (3 errors, 1 warnings): tried to deploy 1 files, undeploy 0 files, redeploy 0 dependent files&lt;BR /&gt;Error: Making... failed [8211605]&lt;BR /&gt;Error: Starting make in the container "SHINE_HDI_DB_1" with 1 files to deploy, 0 files to undeploy... failed [8214168]&lt;BR /&gt;Command failed&lt;BR /&gt;Deployment to container SHINE_HDI_DB_1 failed - error: HDI make failed [Deployment ID: none].&lt;BR /&gt;Error: HDI make failed&lt;BR /&gt;(2s 816ms)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;If i try to make it like;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/258910-2019-01-14-11-27-50-window.png" /&gt;&lt;/P&gt;&lt;P&gt;so the AP_ID has the same data type as the PO.HEADER had;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/258912-2019-01-14-11-28-39-window.png" /&gt;&lt;/P&gt;&lt;P&gt;Then the CORE is not regonized.&lt;/P&gt;&lt;P&gt;If haven't found any statement for the PROCEDURE, like;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/258913-2019-01-14-11-29-35-window.png" /&gt;&lt;/P&gt;&lt;P&gt;Which i have in the CDS file who is creating the Header table. &lt;/P&gt;&lt;P&gt;How do i create the same data type in the procedure whom is the same as the table type?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 10:31:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/system-variable-types-in-a-sqlprocedure/qaa-p/802612#M248504</guid>
      <dc:creator>AntonPierhagen</dc:creator>
      <dc:date>2019-01-14T10:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: System variable types in a sqlprocedure</title>
      <link>https://community.sap.com/t5/technology-q-a/system-variable-types-in-a-sqlprocedure/qaa-p/802613#M248505</link>
      <description>&lt;P&gt;You didn't read the relevant part of my first answer: it is about the NAME of the column and not about the technical data type.&lt;/P&gt;&lt;P&gt;This is confirmed by the error message:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Error: com.sap.hana.di.procedure: Database error 1306: : return type mismatch: Procedure shine:functions::get_po_header_data: &lt;STRONG&gt;Attribute name "ap_id" different from Attribute name: "PURCHASEORDERID" : line 40 col 2 (at pos 831) [8201003]&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;If you change the code in your procedure to &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ap_table = SELECT PURCHASEORDERID as "ap_id"
                , GROSSAMOUNT     as "ap_netto"
                , NETAMOUNT       as "ap_brutto"
                , TAXAMOUNT       as "ap_tax"
                , GROSSAMOUNT + NETAMOUNT + TAXAMOUNT as "ap_combi"
           FROM "PO.Header" 
           ORDER BY "ap_combi" DESC LIMIT 3;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The error should not occur anymore.&lt;/P&gt;&lt;P&gt;Note that you have to put the lowercase column names from your table definition in quotation marks to avoid automatic case-conversion. Also, you might want to check whether GROSSAMOUNT really should map to "ap_netto"...&lt;/P&gt;&lt;P&gt;Note additionally how formatting the SELECT "vertically" helps matching it to the table definition and makes reading the structure of the statement easier by avoiding the "scroll to the far side of the editor".&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 11:25:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/system-variable-types-in-a-sqlprocedure/qaa-p/802613#M248505</guid>
      <dc:creator>lbreddemann</dc:creator>
      <dc:date>2019-01-14T11:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: System variable types in a sqlprocedure</title>
      <link>https://community.sap.com/t5/technology-q-a/system-variable-types-in-a-sqlprocedure/qaa-p/802614#M248506</link>
      <description>&lt;P&gt;ah check! Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 11:51:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/system-variable-types-in-a-sqlprocedure/qaa-p/802614#M248506</guid>
      <dc:creator>AntonPierhagen</dc:creator>
      <dc:date>2019-01-14T11:51:38Z</dc:date>
    </item>
  </channel>
</rss>

