One of the prerequisites of CPI-C communication is that the recipient system is available.Asynchronous data transmission (or buffered data transmission) is useful for cases where the recipient system is unavailable or overloaded (and so unable to receive and process data).

The data that is to be sent is first placed in a queue. Then a job is automatically scheduled that starts an active CPI-C send program (driver program) at the set time to read and send the queue data.You specify the recipient passive program in the queue attributes, which is then called at the appropriate time to receive and process the data.

The system only schedules the transmission job for queues with the value 'A' (automatic transmission) in the 'Start mode' attribute.

The job has the same name as the queue, and is scheduled for the time and date specified in the 'Transmission date/time' attribute. The only step in the job is to call the active CPI-C program specified in the 'Driver program' attribute of the queue.

The specified driver program is started automatically at the chosen start time. This active CPI-C program calls the relevant recipient program and sends the queue to it. The driver program reads the relevant parameters for the CPI-C communication from the corresponding queue attributes.

The SAP standard driver program, RSQAPI20, has the following properties:
- If the connection to the remote system cannot be established, the driver program schedules itself again (-> new job). You can set the interval between attempts using the constant DELAYTIME in the driver program. (300 sec.) .

- If the 'CLIENT' attribute (client in remote SAP system) is set; the corresponding CPI-C connect string is constructed and sent automatically after establishing the connection with the remote system.

The queue records are then read and sent in ping pong mode.
LUWs that have been sent successfully are deleted from the queue (an LUW is a set of records that belong together). (LUW = records that belong together)

- If the connection is terminated when the data is transmitted, the current LUW in the queue is rolled back, the queue status is set to 'E' and an express mail is sent to the queue creator.

(In this error case the recipient program must roll back the current LUW in the remote system itself.). If required, you can adapt the driver program to your own needs, or write your own driver program for use in queue transmission.

You must create a passive recipient program in the remote system that can receive and process the queue data.



When you open a queue using the function module QUEUE_OPEN, you must supply the following parameters:

NAME Name of queue to be opened

This parameter is not specified when opening a new queue.The queue therefore the queue receives the current time stamp as its name, which you receive from the
export parameter NAME of the function module.)

OPENMODE 'W' Write ; ' R ' : Read

ERASE ' X ' : Deletes the queue shell when the queue is empty

TYPE ' U ' : Unique (Queue can only be filled with data once,

cannot subsequently be extended) Appendable (Queue may be extended, even during transmission)

START ' A ' : Automatic (queue data is automatically sent via an internally scheduled job at the specified send time (DATE / TIME).

' M ' : Manual (queue must be sent manually using Transaction SM38) -> internal scheduling of an immediate job)

'E' : Event controlled (Used to start transmission immediately once the queue has been created.) To do this, you must manually create an appendable queue from the start mode 'E' first using Transaction SM38. When the queue is activated, a job is created internally that is executed at the event SAP-QEVENT / parameter . If you place data from this program in this queue, the accompanying event is triggered automatically at QUEUE_CLOSE. The scheduled job for sending data begins running.

DATE/TIME Transmission start time and date (only applies to start type 'A').

The function module QUEUE_PUT requires the following input parameters:
NAME Name of the queue into which you want to place the record.
SATE Position of the current record within its LUW:
' S ' : Current record is the only record in the LUW
'F': Current record is the first (but not only) record in the LUW
SAPCE: Current record is neither the first nor the last record in the LUW
'L': Current record is the last of several records in the LUW
BUFFER Current record
LENGTH Length of current record

The function module QUEUE_CLOSE requires the following input parameters:
NAME Name queue to be closed

OPENMODE Open mode used when queue was opened

If you created the queue with start mode 'A' (automatic transmission), the corresponding job is scheduled automatically when you call QUEUE_CLOSE. The job name is the same as the queue name.

If you modify driver program RSQAPI20 or write your own driver program, you can use the above function modules to read or delete queues. For further information about their use, refer to their documentation in the Function Builder.

You can administrate queues in the queue pool using Transaction SM38.

The standard R/3 System contains the following demonstration programs, which show how to create a queue and send and receive data:
Creating a queue: SAPBC415D_CREATE_QUEUE or RSQAPI10
Sending data: RSQAPI20 (Standard driver program)
Receiving data: RCVQDATP (Passive recipient program in the remote system)

You can also use asynchronous (buffered) data transmission from an R/2 System. For more information, refer to the online documentation on CPI-C / Asynchronous data transmission.



No comments :

Post a Comment