Push asynchronous RFC execution over Queue (SMQR)

If program takes much time to execute synchronous FM calls, then we can send it to Queue (created in TCode SMQR) which will execute asynchronously.

It can be useful when Non SAP calls SAP and that will have some time limitation. While sending to Queue, acknowledgement can be provided to Non SAP and Queue RFC will send the actual execution status later through IDoc/API Call etc.

Create Queue in TCode: SMQR → Registration → Enter Queue name and details → Ok

To trace the each Queue, register it with Initials and *, and while pushing the RFC on Queue, use some ‘increment variable / date & time’ and concatenate.

After clicking on Ok, Queue name will appear in SMQR

Sample code:

  DATA : _t_qrfcrcv TYPE TABLE OF qrfcrcv.

* Queue
  _t_qrfcrcv = VALUE #( BASE _t_qrfcrcv ( qname = |{ 'TEST_' }{ sy-datum }{ sy-uzeit }| ) ).
      qnamlist = _t_qrfcrcv.

* Push execution on Queue
      order_header = _ord_hdr
      sales_org    = _sales_org
      dist_channel = _dist_chan
      division     = _division
      order_items  = _t_item_out
      t_bapiret2   = t_bapireturn2_.

Commit work is required to trigger Background task

To check/test/debug the queue, unregister it to block the execution.

Select the Queue → Deregistration

After deregistration, Type will be updated from ‘R’ to ‘U’.

Now execute the Main program to check the Queue. In SMQR, double click the Queue name

Double click the Queue name

Again double click and select the Queue to debug → click on highlighted icon

After test, register it back for self execution.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s