Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3316

Re: How to use variable in PLACEHOLDER in a SQL query ABAP progamming.

$
0
0

Hi Rossi

 

I think you got my question clearly. let me help you more. I am pasting some of code lines. Let me know whether we can use variable in place of dates.

 

lr_dbconn = cl_sql_connection=>get_connection( con_name = lv_con ).

  create object lr_sql_env

    exporting

      con_ref = lr_dbconn.

 

 

 

 

*Define sql script

  lv_sql = 'Select * '.

  lv_from = 'FROM "_SYS_BIC"."sap.is.retail.car/InventoryVisibility'.

  lv_from1 = 'WithSalesOrderReservedQuantity" (' & '''' & 'PLACEHOLDER' & '''' & '= (' & '''' & '$$P_DateFrom$$' & ''''  & ',' &

  '''' & '20160510' & '''' & '),' & '''' & 'PLACEHOLDER' & '''' & '= (' & '''' & '$$P_DateTo$$' & '''' & ',' & '''' & '20160510'

  & '''' & '))'.

  concatenate lv_from lv_from1 into lv_from respecting blanks.

 

 

  lv_where1 = 'WHERE "SAPClient" = ''' && V_CLIENT && ''''.

  lv_where2 = 'AND "Location" = ''' && V_PLANT && ''''.

  lv_where3 = 'AND "Article" = ''' && V_ARTICLE && ''''.

 

 

     I am consolidating all the lv_* variables. & executing the query to run in HANA Studio.

 

Thanks

Sumanjit


Viewing all articles
Browse latest Browse all 3316

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>