Sunday, 28 December 2014

qRFC with Outbound Queue & Inbound Queue between two different SAP systems as source and target

---------------------------------------------------------------------------------------------------------------------------------

Queue technique is used to call the rfc FMs in a sequential way in the target system when there is a dependency between two FM calls like first creating a record and then updating it or first creating a record and then deleting it. Outbound queue can be used without an inbound queue to sequentialize  the calls . The outbound queues only exists in the source system. So from the target system we can't determine who is responsible for a rfc fm call. So outbound queue with an inbound queue technique helps in determining this. So in this case outbound queue exists in the source system and after it is processed in the source system, the corresponding inbound queue appeared in the target system and after the inbound queue is processed in the target system the RFC FM is called and executed.


-------------------------------------------------------------------------------------------------------------------------------
The below post describes how to create a record and then update it by inbound queue technique.
-------------------------------------------------------------------------------------------------------------------------------
Step1. Target  system: The below post will create a record in this table and then will update the same record by inbound queue technique.



Step2. Target system: The RFC fm to create a flight record.

Step3. FM importing parameters.

Step4. FM source code.

Step5. Target system . One more rfc FM to update the flight record.

Step6. FM importing parameters.

Step7. FM source code.

Step8. Source system: Here we have the RFC destination created in TX- SM59 of the source system to call the two above RFC FM in the program.

Step9. Source system: Do a connection test.

Step10.Source system:  Connection works fine.

Step11. Source system: Go to Tx- SMQS ( out bound queue scheduler)  to register the RFC destination. Click on the Registration button.

Step12. Source system:

Step13. Source system: Provide the RFC destination name created above and continue.

Step14. Source system: After registration of RFC destination the type appears as R. SO when a queue RFC call is made with this RFC destination, the outbound scheduler automatically starts processing which is used in production. Now for our test purpose let's deregister the rfc destination so that when the call is made with this RFC, we can observe the details of the outbound queue and the rfc calls. So select the check box and select the Deregistration button.

Step15. Source system: Continue.

Step16. Source system: So that type changed to U. Now select the line ( check box against the rfc destination name) and select the qRFC monitor button.

Step17. Source system: So currently no out bound queue is there for this RFC destination.

Step18. Target system: go to Tx- SMQR to register the inbound queue for the inbound queue scheduler.

Step19. Target system: Click on register button.

Step20.  Target system: Provide the queue name as * and no rfc destination as this is configured in the target system and continue.

Step21.  Target system: So we have to change the type from R. So check the line and select De registration button.

Step22.Target system: Continue.

Step23. Target system: So the type is changed to U. now again select the line and click on the button qRFC monitor.

Step24. Target system: So no inbound queue exist.

Step25. Source  system: So run the below report which calls the twp RFC FMs one after another with inbound queue technique.
-----------------------------------------------------------------------------------------------------------------------------------

DATA : ls TYPE scarr.

CALL FUNCTION 'TRFC_SET_QIN_PROPERTIES'
  EXPORTING
   qout_name                = 'OUT_FLIGHT'
   qin_name                 = 'INN_FLIGHT'
*   QIN_COUNT                =
*   CALL_EVENT               = ' '
*   NO_EXECUTE               = ' '
* EXCEPTIONS
*   INVALID_QUEUE_NAME       = 1
*   OTHERS                   = 2
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

ls-carrid = 'XX'.
CALL FUNCTION 'ZCREATE_FLIGHT_REC'
  IN BACKGROUND TASK
  AS SEPARATE UNIT
  DESTINATION 'SRC_TO_TGT'
  EXPORTING
    is = ls.

CALL FUNCTION 'TRFC_SET_QIN_PROPERTIES'
  EXPORTING
   qout_name                 = 'OUT_FLIGHT'
   qin_name                  = 'INN_FLIGHT'
*   QIN_COUNT                =
*   CALL_EVENT               = ' '
*   NO_EXECUTE               = ' '
* EXCEPTIONS
*   INVALID_QUEUE_NAME       = 1
*   OTHERS                   = 2
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

ls-carrname = 'XX AIRLINES'.

CALL FUNCTION 'ZUPDATE_FLIGHT_REC'
  IN BACKGROUND TASK
  AS SEPARATE UNIT
  DESTINATION 'SRC_TO_TGT'
  EXPORTING
    is = ls.

IF sy-subrc = 0.
  COMMIT WORK.
  WRITE :/ 'Check Tx- SMQS in source system to process outbound queue'.
  WRITE :/ 'Check Tx- SMQR in target system to process inbound queue'.
ENDIF.


----------------------------------------------------------------------------------------------------------------------------------

Step26.  Source  system: So here the report output.

Step27. Source  system: go to Tx- SMQS. Select the RFC Destination line and select qRFC monitor button.

Step28. Source  system: So here one outbound queue exists with entries as 2 as we have two fm calls under this outbound queue. Now double click on the Queue name.

Step29. Source  system: Double click again on the Queue name.

Step30. Source  system: so here we have two RFC FM calls with the inbound queue names. go Back.

Step31.  Target  system: go to Tx- SMQR and select the line and click the button qRFC Monitor.

Step32. So up to this point we don't have nay inbound queues exists in the target system .as the outbound queues are not yet processed in the source system.

Step33. Source  system: Go to Tx- SMQS and select the check box against the RFC destination and click on Registration button to process the outbound queue..

Step34. Source  system: continue.

Step35. Source  system; So the outbound scheduler starts processing the RFC FM calls under the outbound queue called in this RFC destination. Observe the scheduler status turned to Starting from Inactive. Then refresh the screen and then select the line and click on the qRFC monitor button.

Step36.Source  system: So all the outbound queues under this rfc destination is processed successfully and the call is send to the target system.

Step37. Target  system: Go to Tx- SMQR and select the line and click on the button qRFC Monitor.

Step38. Target  system: So here we have the inbound queue. now double click on the queue name.

Step39. Target  system: Again double click on the Queue name.

Step40. Target  system: So here we have the details . Go back to the initial screen of the Tx- SMQR to process the inbound queue.

Step41. Target  system: Select the line and click on the registration button.

Step42. Target  system: Continue. 

Step43. Target  system: So the inbound scheduler status changed to Starting.

Step44. Target  system: So here the inbound scheduler starts executing the Fm ans as we set the debugger it is triggered. So F8 to finish the execution of this first Fm call.

Step45. Target  system: Again the second FM is called by the inbound scheduler. Don't F8 at this moment.

Step46. Target  system: Go to Tx- SMQR and select the line and click the button qRFC Monitor.

Step47. Target  system: So now we have the same inbound queue exists but now we only have one entry as first fm is already executed. Double click on the queue name,

Step48. Target  system: Double click on the queue name.

Step49. Target  system: So here we have only one FM . Go back.

Step50. Target  system: Finish the execution of the update fm by F8.

Step51. Target  system: Again go to the Tx- SMQR and select the line and click on the button qRFC Monitor.

Step52. Target  system: So then no pending inbound queue exsists.

Step53. Target  system: Now refresh the screen if already open.






 So here we have the new record.
--------------------------------------------------------------------------------------------------------------------------------

1 comment:

herymeelon said...

Really success this fabulous interlock which you impale furnished for all of us. My partner and i assurance this will end up being flirtatious pertaining to a lot of the personss. Indeed propitious look for me, Love limited that you're molecule on the main web owners My partner and i long-term saw. Blesss pertaining to putting up this informative issue.. Queue System

Comments system

Disqus Shortname