Site icon SAP Human Resources Experts And Solutions

Connect to external database

<p>Once I needed to create a program to download data fro external database into my own&period; It happened to be very easily&period;<&sol;p>&NewLine;<p>In DBACOCKPIT transaction create a new connection to a database&period;<&sol;p>&NewLine;<p>And user it in ABAP like this&colon;<&sol;p>&NewLine;<p>EXEC SQL&period;<br &sol;>&NewLine;CONNECT TO &&num;8216&semi;BSK&&num;8217&semi;<br &sol;>&NewLine;ENDEXEC&period;<br &sol;>&NewLine;EXEC SQL&period;<br &sol;>&NewLine;SET CONNECTION &&num;8216&semi;BSK&&num;8217&semi;<br &sol;>&NewLine;ENDEXEC&period;<br &sol;>&NewLine;EXEC SQL&period;<br &sol;>&NewLine;SELECT db&lowbar;name&lpar;&rpar; INTO &colon;DBN FROM SVERS<br &sol;>&NewLine;ENDEXEC&period;<br &sol;>&NewLine;WRITE&colon; &sol; &&num;8216&semi;current database name&&num;8217&semi;&comma; DBN&period;<br &sol;>&NewLine;EXEC SQL&period;<br &sol;>&NewLine;SET CONNECTION DEFAULT<br &sol;>&NewLine;ENDEXEC&period;<br &sol;>&NewLine;EXEC SQL&period;<br &sol;>&NewLine;SELECT db&lowbar;name&lpar;&rpar; INTO &colon;DBN FROM SVERS<br &sol;>&NewLine;ENDEXEC&period;<br &sol;>&NewLine;WRITE&colon; &sol; &&num;8216&semi;current database name&&num;8217&semi;&comma; DBN&period;<&sol;p>&NewLine;<p>It&&num;8217&semi;s basic Native SQL &quest; ABAP&period; Some SAP notes for reference&period;<&sol;p>&NewLine;<p>Note 178949 &&num;8211&semi; MSSQL&colon; Database MultiConnect<br &sol;>&NewLine;Note 323151 &&num;8211&semi; Several DB connections with Native SQL<&sol;p>&NewLine;

Exit mobile version