<?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>topic MS SQL Server in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/ms-sql-server/m-p/3447024#M827940</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear all, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to connect to a Database (MS SQL Server) that does not correspond &lt;/P&gt;&lt;P&gt;to the DB platform of the R/3 database through ABAP &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to achive this ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have SAP 4.7 , Basis 620 .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Feb 2008 10:35:25 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-26T10:35:25Z</dc:date>
    <item>
      <title>MS SQL Server</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ms-sql-server/m-p/3447024#M827940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear all, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to connect to a Database (MS SQL Server) that does not correspond &lt;/P&gt;&lt;P&gt;to the DB platform of the R/3 database through ABAP &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to achive this ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have SAP 4.7 , Basis 620 .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2008 10:35:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ms-sql-server/m-p/3447024#M827940</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-26T10:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: MS SQL Server</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ms-sql-server/m-p/3447025#M827941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should add the two tables in the FM header without type or likepart. They're declared in the caller and they haven't restrictions. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here you have an example of how to call the FM (IN this example I neededboth tables to have 255 char per line but they may be greater if youneed so. That's why the tables should not have a type or like part inthe FM declaration. &lt;/P&gt;&lt;P&gt;I hope this clarify your doubts. If not, just let me know. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ps: here is the example &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of sqltable occurs 0, &lt;/P&gt;&lt;P&gt;linea(255), &lt;/P&gt;&lt;P&gt;end of sqltable. &lt;/P&gt;&lt;P&gt;data: begin of recordset occurs 0, &lt;/P&gt;&lt;P&gt;linea(255), &lt;/P&gt;&lt;P&gt;end of recordset. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;define addsql. &lt;/P&gt;&lt;P&gt;if &amp;amp;1 &amp;lt;&amp;gt; ''. &lt;/P&gt;&lt;P&gt;sqltable-linea = &amp;amp;1. append sqltable. &lt;/P&gt;&lt;P&gt;endif. &lt;/P&gt;&lt;P&gt;end-of-definition. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;zrepid = sy-repid. &lt;/P&gt;&lt;P&gt;zlevel = sy-uname. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate ' empresa = "' p_empre '"' into g_cndempresa. &lt;/P&gt;&lt;P&gt;concatenate ' and periodo_pago = "' p_ppago '"' into g_cndppago. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;refresh sqltable. &lt;/P&gt;&lt;P&gt;addsql: &lt;/P&gt;&lt;P&gt;'Select nro_leg, centro_costo, sum(importe_final * 1000 ) if ', &lt;/P&gt;&lt;P&gt;' from histcon_propor where ', &lt;/P&gt;&lt;P&gt;g_cndempresa , &lt;/P&gt;&lt;P&gt;g_cndppago , &lt;/P&gt;&lt;P&gt;' and cod_cpto between "0001" and "0599"', &lt;/P&gt;&lt;P&gt;' group by 1,2', &lt;/P&gt;&lt;P&gt;' Union ', &lt;/P&gt;&lt;P&gt;' Select distinct nro_leg, centro_costo, 0 if ', &lt;/P&gt;&lt;P&gt;' from histcon_propor where ', &lt;/P&gt;&lt;P&gt;g_cndempresa , &lt;/P&gt;&lt;P&gt;g_cndppago , &lt;/P&gt;&lt;P&gt;' and cod_cpto in ("0625", "3566")'. &lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;the sql should look like: &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;*select nro_leg, centro_costo, sum(importe_final) if &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;from histcon_propor &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;where periodo_pago = "200407" &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;and empresa = "0001" &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;and cod_cpto between "0001" and "0599" &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;group by nro_leg, centro_costo &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;union &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;select distinct nro_leg, centro_costo, 0 if &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;from histcon_propor &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;where empresa = "0001" &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;and periodo_pago = "200407" &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;and cod_cpto in ("0625","3566") &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'ZEXECSQL' &lt;/P&gt;&lt;P&gt;exporting &lt;/P&gt;&lt;P&gt;dsn1 = dsn &lt;/P&gt;&lt;P&gt;zrepid1 = zrepid &lt;/P&gt;&lt;P&gt;zlevel1 = zlevel &lt;/P&gt;&lt;P&gt;tables &lt;/P&gt;&lt;P&gt;sqltable = sqltable &lt;/P&gt;&lt;P&gt;recordset = recordset. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at recordset. &lt;/P&gt;&lt;P&gt;clear wa_liquidado. &lt;/P&gt;&lt;P&gt;split recordset at ',' into wa_liquidado-nro_leg &lt;/P&gt;&lt;P&gt;wa_liquidado-centro_costo &lt;/P&gt;&lt;P&gt;wa_liquidado-importe_final. &lt;/P&gt;&lt;P&gt;perform some_work_with_wa_liquidado &lt;/P&gt;&lt;P&gt;endloop. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here you have a copy of the FM: I've translated as many comments as ican. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;notes: the FM receives three parameters and a table and returns the &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;recordset in another table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;the parameters are: DSN1 Data source name to be used (because we can &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;access more than one database) &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;zrepid1 (a variable that maintains the name of the caller report, DONOT &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;USE sy-repid, move it to another variable and use this new variable inthe &lt;/P&gt;&lt;P&gt;caller program, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;because sy-repid is maintained by the system and when the systemissues &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;the fm call sy-repid changes it's name to the FM's name) &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;zlevel (just in case you want to issue several sql's from the samepc, you &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;can send 'vbs' in this field for example). &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;sqltable: an itab with the sql you want to run. The only thing youhave to &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;keep in mind is that every line - except the first one - should startwith &lt;/P&gt;&lt;P&gt;at column 2 at least. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;FM code: &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function zexecsql.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2008 08:46:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ms-sql-server/m-p/3447025#M827941</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-28T08:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: MS SQL Server</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ms-sql-server/m-p/3447026#M827942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;good&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check whether the JDBC related services are up in Visual admin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MS Sql Server Drivers.Could you please give me details &lt;/P&gt;&lt;P&gt;msbase.jar&lt;/P&gt;&lt;P&gt;mssqlserver.jar&lt;/P&gt;&lt;P&gt;msutil.ja&lt;/P&gt;&lt;P&gt;The JDBC drivers should be:&lt;/P&gt;&lt;P&gt;com.microsoft.jdbc.sqlserver.SQLServerDriver&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The connection :&lt;/P&gt;&lt;P&gt;jdbc:microsoft:sqlserver://STPROTO:XXXX;DatabaseName=Prototype&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will help you&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/how%20to%20install%20and%20configure%20external%20drivers%20for%20jdbc%20and%20jms%20adapters.doc" target="test_blank"&gt;https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/how%20to%20install%20and%20configure%20external%20drivers%20for%20jdbc%20and%20jms%20adapters.doc&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;mrutyun^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2008 09:13:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ms-sql-server/m-p/3447026#M827942</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-28T09:13:24Z</dc:date>
    </item>
  </channel>
</rss>

