You can call ABAP programs (or more precisely, ABAP form routines) in an R/2 or an R/3 System remotely using CPI-C. However, you cannot communicate with them directly.Instead, the connection must be made via the SAP Basis System of the passive program.

In the R/2 System, the SAP Basis System is the task handler, called using X1SA. In the R/3 System, it is the dispatcher which you address using sapdpxx.

The above procedure for calling a remote ABAP routine is the same, regardless of whether the active program is an ABAP program in an R/2 or an R/3 System, or a C program in an external system.The valid format for a connect string is contained in the ABAP Dictionary structure CPICCONN. Refining a structure with reference to it is the easiest way to create your own connect string.

If you are programming in C, use the call SAP_CMLOGON to create a connect string in EBCDIC.All of the values in a connect string must be entered in uppercase.In the NAME field, enter a user with type CPI-C that is already defined in the relevant client of the remote system.The one-character language key is converted into the corresponding two-character key by the remote Basis system. This must be made known to the remote system.

In the PROG field, enter the main program of the remote routine. The syntax must be correct. The name of this main program may have a maximum of 8 characters.

The form routine that you enter in the MODN field must exist within the specified main program.If the remote Basis system's check on the connect string is positive (valid logon data, main program and form routine syntactically correct, and both exist in the target system), the active program receives the 12 byte EBCDIC string 'APPCCPIC1' with the return code 0 and send permission. As of this point, the system can communicate directly with the called ABAP routine. The data format is completely open.

If the checks fail, the remote Basis system sends a corresponding error message with the 12 byte header 'FREECPIC1' in EBCDIC and terminates the connection.


In R/3, the CPI-C calls are contained in the language scope of ABAP.

However, on external platforms you must install the CPI-C library (CPI-C-SDK). How to use the CPI-C calls is described in the text files and sample programs delivered with the SDK.

The standard system contains the CPI-C test programs ACPICT1 and ACPICT2 (in R/2 from Release 5.0G). ACPICT1 is an active CPI-C program, ACPICT2 is a passive CPI-C program. You can use them to test R/3 - R/3 and R/3 - R/2 CPI-C connections.

SAP also supplies the SAP CPI-C SDK (Software Development Kit) with every SAP R/3 System. This helps you to develop CPI-C programs in C. The SDK contains the C programs ccpict1t (active) and ccpict2t (passive).

You can use these to test connections between two external systems, but, above all, to test connections between external systems and an R/3 System. ccpict1 can call not only ccpict2t remotely, but also the passive ABAP program ACPICT2. Likewise, the active ABAP program ACPICT1 can call the passive C program ccpict2t.

When you run ACPICT1, you must specify:
- If ACPICT2 or ccpict2t should be called remotely (parameter 'ABAP') ,
- If test data should be converted from ASCII to EBCDIC (parameter 'CONVERT').

If you choose to call ACPICT2, you must also enter the logon data for the connect string on the selection screen of ACPICT1.

You can use the Debugger to analyze an active ABAP CPIC-C program in R/3. This does not apply in R/2, since screen changes are not allowed in R/2 during a CPI-C connection (Debugging involves screen changes). You cannot analyze passive programs in the Debugger.

you can use the Gateway monitor (Transaction SMGW) to monitor SAP Gateway activity (existing CPI-C connections) and generate and display gateway traces.

One of the tasks of the system log is to record failed CPI-C logons that have been sent from remote systems to the current system. You can display the system log using Transaction SM21.


No comments :

Post a Comment