Use the transaction code DBCO to implement SAP connection to external databases and read routines, dbcosap

Source: Internet
Author: User

Use the transaction code DBCO to implement SAP connection to external databases and read routines, dbcosap

1. Link to the SQLServer Database

Execute the transaction code DBCO. Click the new entry button and fill in the information shown in


The connection information here is very similar to the connection string of SQL Server, but the parameter name is slightly different. Specify the Host IP address and database name.


2. Link to the DB2 database

Execute the transaction code DBCO. Click the new entry button and fill in the information shown in


The connection information looks direct, including the database name, port number, and Host IP address.


3. Link to the Oracle database

Execute the transaction code DBCO. Click the new entry button and fill in the information shown in


The connection information is relatively concealed. You must install the Oracle Client on the SAP application server, set the connection, and specify the connection information here to be consistent with the connection name.
To prevent garbled characters, add the following parameter after link information: ZHS16GBK
Format: ORCL. WORLD: ZHS16GBK


4. Connect to the MaxDB Database

Execute the transaction code DBCO. Click the new entry button and fill in the information shown in


MaxDB is an SAP database. This connection is a default connection created in NetWeaver Developer.


Access External Database


 
1. instance: SAP system accesses eaglesoft Database
* & Region *&-----------------------------------------------------------------------------------------------------&*
* & Define constants &*
* & Region *&------------------------------------------------------------------------------------------------------&*
CONSTANTS: CNS_YGJK type c length 10 VALUE 'hr9dev '.
 
** Open a connection
Exec SQL.
Connect to: CNS_YGJK
ENDEXEC.
 
*** Obtain personnel data
TRY.
Exec SQL washming PF_GET_RS.
Select mandt,
ZID,
OTYPE,
INFTY,
ZUPDATE,
OPERA,
ZDATA
INTO: WA_HR01-MANDT,
: WA_HR01-ZID,
: WA_HR01-OTYPE,
: WA_HR01-INFTY,
: WA_HR01-ZUPDATE,
: WA_HR01-OPERA,
: WA_HR01-ZDATA
FROM z00hrjzlch01
WHERE SAP_GET =''
ENDEXEC.
 
** Process personnel data
IF IT_HR01 [] is not initial.
Loop at IT_HR01 INTO WA_HR01.
Exec SQL.
UPDATE z00hrjzlch01
SET SAP_GET = 'X'
Where mandt =: WA_HR01-MANDT
And zid =: WA_HR01-ZID
ENDEXEC.
IF SY-SUBRC = 0.
* ******** Update the ERP Database Table
Exec SQL.
COMMIT
ENDEXEC.
MODIFY Z00HRJZLCH01 FROM WA_HR01.
Commit work.
ENDIF.
ENDLOOP.
ENDIF.
** Close the connection
Exec SQL.
DISCONNECT: CNS_YGJK
ENDEXEC.
** An error occurred while obtaining the data.
CATCH CX_SY_NATIVE_ SQL _ERROR INTO CL_EXEC_REF.
EXIT.
CATCH CX_ SQL _EXCEPTION INTO CL_SQLERR_REF.
EXIT.
ENDTRY.
*&---------------------------------------------------------------------*
* & Form PF_GET_ZZ
*&---------------------------------------------------------------------*
* Organize incremental data
*----------------------------------------------------------------------*
FORM PF_GET_ZZ.
APPEND WA_HR02 TO IT_HR02.
ENDFORM.


Transaction code: DBCO view, the existing connection of the SAP system

Connection [HR9DEV. WORLD] is used in the program. Double-click this line, as shown in:


Edit the TNS file in the underlying ORACLE database of SAP, which is generally configured by BASIS. The configuration path is DIR_ORAHOME-> network-> admin-> tnsnames. ora; after the configuration is complete, we can use the transaction code: AL11 to check whether the configuration is correct, AL11 to view the connection [HR9DEV. WORLD Configuration




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.