title: How to use a field from an input parameter of a HANA stored procedure to generate table name dynamically for execute_immediate statement?
body: <p>I have been trying to solve a requirement with no luck where I have to pass a table containing 3 fields: object name, customer &amp; location from an AMDP to a stored procedure. The stored procedure should be used to return a table that stores the same customer, location &amp; a min(date).</p>
  <p>The min(date) is found in a table which is derived from the object name as follows: the concatenation of <code>'&quot;/BIC/A' || (object name passed from AMDP) || 2&quot;'</code>. So, let's say if the AMDP passes the parameter object as <code>YCUSTM01</code>, then the table name to look for the minimum date should be <code>&quot;/BIC/AYCUSTM012&quot;</code>. Thus I should be able to make an execute_immediate  statement (maybe?) to find what is the minimum date for a customer on a specific location &amp; return that table back to the AMDP for further calculations.</p>
  <p>Input Table:</p>
  <pre><code>| Object_name | Customer | Location |
  +-------------+----------+----------+
  | YCUSTM01    | Walgreen | Chicago  |
  </code></pre>
  <p>Sample Data in <code>&quot;/BIC/AYCUSTM012&quot;</code>:</p>
  <pre><code>| Customer | Location | Date       |
  +----------+----------+------------+
  | Walgreen | Chicago  | 24.09.2020 |
  | Walgreen | Chicago  | 07.02.2019 |
  | Walgreen | Chicago  | 12.12.2012 |
  | Walgreen | Chicago  | 01.04.2015 |
  </code></pre>
  <p>Desired Output Table from stored procedure :</p>
  <pre><code>  select
      customer,
      location,
      min(calday)
    from &quot;/BIC/AYCUSTM012&quot;
    where customer = :customer
      and location = :location
    group by
      customer,
      location;
  
    | Customer | Location | Min_date   |
    +----------+----------+------------+
    | Walgreen | Chicago  | 12.12.2012 |
  
  </code></pre>
  <p>Any lead would be very much appreciated.</p>