SAP ABAP IMG Activity OKCM_TR_PROGRAM (Programming hints for user-defined data transfer programs)
Hierarchy
BBPCRM (Software Component) BBPCRM
   CRM (Application Component) Customer Relationship Management
     CRM_APPLICATION (Package) All CRM Components Without Special Structure Packages
       KC (Package) Cost Accounting Controlling EIS
IMG Activity
ID OKCM_TR_PROGRAM Programming hints for user-defined data transfer programs  
Transaction Code S_ALR_87000524   IMG Activity: OKCM_TR_PROGRAM 
Created on 19981222    
Customizing Attributes OKCM_TR_PROGRAM   Programming hints for user-defined data transfer programs 
Customizing Activity    
Document
Document Class SIMG   Hypertext: Object Class - Class to which a document belongs.
Document Name OKCM_TR_PROGRAM    

Interfaces for sender programs

If you write programs in an R/2 or R/3 system to collect data and send it to an R/3 system, you must use the following interface:

  • OPEN_QUEUE(SAPFKCIS) USING GRPID - Data transfer is started. Field GRPID is only contained in the parameter list for purposes of upward compatibility. If it is not filled, the transfer method is determined by the sender structure.
  • TRANSFER_TO_QUEUE(SAPFKCIS) USING REC - Record REC is transferred.
  • CLOSE_QUEUE - The transfer is ended.

The functions are contained in module pool SAPFKCIS. The routine OPEN_QUEUE only needs to be called for R/3 - R/3 communication. No routine is required for R/2 - R/3 communication.

The interface for master and transaction data is identical.

Example for a data transfer

You want to transfer records with structure I_CF001. In the data declaration portion of your program, you declare the structure as follows:

DATA: BEGIN OF I_CF001,
        VERSO(2) TYPE N,
        GJAHR(4) TYPE N,
        PERDE(3) TYPE N,
        MERKMAL(8) TYPE N,
        KENNZAHL(8) TYPE P,
      END OF I_CF001.

If you wish to send data from an R/3 System, define parameter GRPID and call up function OPEN_QUEUE:

PARAMETERS: GRPID LIKE T242X-GRPID DEFAULT 'CPIC'
                  OBLIGATORY MEMORY ID HRK.
  PERFORM OPEN_QUEUE(SAPFKCIS) USING GRPID.

In the selection portion of your program, fill structure I_CF001 with data and send each record with the command:

  PERFORM TRANSFER_TO_QUEUE(SAPFKCIS) USING I_CF001.

When all the data has been selected, close the transfer with:

  PERFORM CLOSE_QUEUE(SAPFKCIS).

Remote Function Call (RFC)

You can use a further interface if the sender structure in the target system is stored in the ABAP/4 dictionary and the ABAP/4 dictionary structure was referenced during sender structure maintenance. In this case, you can generate a remote function call module (RFC) in the target system during sender structure maintenance under 'Environment', transfer the calling interface to the source system and include it in the data collection program there. The name of the function module is
EIS_DATA_TRANSFER_<ABAP/4 dictionary structure>. This interface is available for both R/2 and R/3. If the ABAP/ dictionary structure contains only CHAR and NUMC fields, C code can also be generated for the generated RFC. This can be used to call up the RFC from any program.

R/2 program interfaces

In R/2 as of Release 5.0F, there are the following additional interfaces

  1. To collect data in an extract before it is written in the queue, there are the routines below:

  PERFORM TRANSFER_TO_QUEUE_EXTRACT(SAPFKCIS) USING VALUE(I_CF001). and
  PERFORM CLOSE_QUEUE_EXTRACT(SAPFKCIS).

In order to be able to use these calls, no other extract can be used in the data collection program. The advantage of this call is that you can carry out a broader selection of data. There are some limits where the above call is concerned because a task cannot be interrupted after an ABAP statement OPEN QUEUE and therefore the loop counter parameter limits the selection.

  1. In order to summarize R/2 data in advance, you can use the following rou

  PERFORM COLLECT_TO_QUEUE(SAPFKCIS) USING VALUE(I_CF001). and
  PERFORM CLOSE_COLLECT_QUEUE(SAPFKCIS).

The data records are collected in an internal table and summarized with the ABAP statement COLLECT before they are written in the queue.

  1. If you have created a query in R/2 with a list of statistics which you wish to use to collect data, you can copy the query and, for example, instead of using routine %DOWNLOAD AT PF15, use call

  PERFORM QUERYEIS_TRANSFER(SAPFKCIS) TABLES T01.

Internal interfaces

If you want to transfer data from an R/3 system to SAP-EIS, you can use the same interfaces which the programs for importing data or summarizing aspects use. The interface requires a sender structure and transfer rule s to have been maintained. Initialization takes place using call:

  PERFORM OPEN_EIS_POOL(SAPFKCIM) USING REPID GRPID SUBRC.

  1. REPID is the name of the sender program
  2. GRPID is the transfer method
  3. SUBRC is the return code. The return codes are explained in the routine.

Records REC are transferred using call

  PERFORM TRANSFER_EIS_SENDER(SAPFKCIM) USING REC.

If the sender record contains fields of type 'I' or 'F', the following call is necessary:

  PERFORM CONVERT_TO_INTERN_FORMAT(SAPFKCIM) USING REC.

Fields of type I are changed into fields of type P (as in R/2) with a length of 6 bytes and without decimal points. Fields of type F are changed into fields of type P with a length of 8 bytes and 5 decimal places. This is necessary for technical reasons.

Summarization and update are triggered by call:

  PERFORM CLOSE_EIS_POOL(SAPFKCIM) USING SUBRC.

SUBRC is the return code. Possible values are commented in the routine.

Read in Data

Data is read in with report RKCFILE0, which has parameter NOLOCK. If youset this value to X, no SAP locks can be set. You may set NOLOCK to X only if you are certain that only disjunctioned data is updated. If you start RKCFILE0 from another program, you can view whether the data transfer was successful by importing field SUBRC from the ABAP/4 memory. Field SUBRC is stored under the ID RKCFILE0 and has the value 0 after a successful data transfer.

Business Attributes
ASAP Roadmap ID 253   Create Data Transfer Programs 
Mandatory / Optional 2   Optional activity 
Critical / Non-Critical 2   Non-critical 
Country-Dependency A   Valid for all countries 
Assigned Application Components
Documentation Object Class Documentation Object Name Current line number Application Component Application Component Name
SIMG OKCM_TR_PROGRAM 0 HLA0009491 Data Collection 
Maintenance Objects
Maintenance object type    
History
Last changed by/on SAP  19981222 
SAP Release Created in