In the previous article, we continued the example of connecting SAP to an external database.
Here we mainly talk about external MSS links:
First Run DBCO:
Click the first pen to enter the modification status:
Create an entry, such:
In, DBMS is filled with MSS, representing Microsoft's SQL server database. Link information:
MSSQL_SERVER = server name MSSQL_DBNAME = Database Name
Save.
Link field in ABAP:
PERFORM CONNECT_MSS USING 'test'. "Link
PERFORM DISCONNECT_DB USING 'test'. "disconnected
* LINK SQL
FORM CONNECT_MSS USING Test.
Exec SQL.
Connect to: Test
ENDEXEC.
IF SY-SUBRC = 0.
MESSAGE '(or all) data volume link successful 'type '.
"Perform database operations
ELSE.
MESSAGE 'Type s' is missing for some (or all) data links '.
ENDIF.
ENDFORM. "CONNECT_MSS
Remember to disconnect:
* Disconnect
FORM DISCONNECT_DB USING Test.
Exec SQL.
DISCONNECT: Test
ENDEXEC.
ENDFORM. "DISCONNECT_DB
Once the connection is successful, you can use Native SQL to directly operate the database ~ I will not go into details here!
Download this PDF:
Http://files.cnblogs.com/mengxin523/SAP%E9%93%BE%E6%8E%A5%E5%A4%96%E9%83%A8%E6%95%B0%E6%8D% AE %E5%BA%93%E7%9A%84%E5% AE %9E%E7%8E%B0%E6%96%B9%E6%B3%95.pdf