Sunday, 28 December 2014

qRFC with Outbound Queue & Inbound Queue between two different SAP systems - One LUW per mixed part of the Queues

---------------------------------------------------------------------------------------------------------------------------------------
Step1. If  one queue contains two RFC FM calls and we have two such Queues, then some part of Each Queue can be put into a single LUW. Execute the program. 
--------------------------------------------------------------------------------------------------------------------------------
DATA ls TYPE scarr.
*** first luw multiple queue  *****
CALL FUNCTION 'TRFC_SET_QIN_PROPERTIES'
  EXPORTING
    qout_name = 'OUT_QUEUE1'
    qin_name  = 'INN_QUEUE1'.
clear ls.
ls-carrid = 'XX'.
CALL FUNCTION 'ZCREATE_FLIGHT_REC'
 IN BACKGROUND TASK
 "AS SEPARATE UNIT " creates a separate luw
 DESTINATION 'SRC_TO_TGT'
EXPORTING
  is = ls.

CALL FUNCTION 'TRFC_SET_QIN_PROPERTIES'
  EXPORTING
    qout_name = 'OUT_QUEUE2'
    qin_name  = 'INN_QUEUE2'.
clear ls.
ls-carrid = 'YY'.
CALL FUNCTION 'ZCREATE_FLIGHT_REC'
 IN BACKGROUND TASK
 "AS SEPARATE UNIT " creates a separate luw
 DESTINATION 'SRC_TO_TGT'
EXPORTING
  is = ls.
commit work. " First luw includes two queues

*** second luw multiple queue  *****
CALL FUNCTION 'TRFC_SET_QIN_PROPERTIES'
  EXPORTING
    qout_name = 'OUT_QUEUE1'
    qin_name  = 'INN_QUEUE1'.
CLEAR ls.
ls-carrid = 'XX'.
ls-carrname = 'XX AIRLINE'.
CALL FUNCTION 'ZUPDATE_FLIGHT_REC'
 IN BACKGROUND TASK
 "AS SEPARATE UNIT " creates a separate luw
 DESTINATION 'SRC_TO_TGT'
EXPORTING
  is = ls.

CALL FUNCTION 'TRFC_SET_QIN_PROPERTIES'
  EXPORTING
    qout_name = 'OUT_QUEUE2'
    qin_name  = 'INN_QUEUE2'.

CLEAR ls.
ls-carrid = 'YY'.
ls-carrname = 'YY AIRLINE'.
CALL FUNCTION 'ZUPDATE_FLIGHT_REC'
 IN BACKGROUND TASK
 "AS SEPARATE UNIT " creates a separate luw
 DESTINATION 'SRC_TO_TGT'
EXPORTING
  is = ls.
COMMIT WORK. " second luw with multiple queue
WRITE :/ 'Check outbound queues in source system in Tx- SMQS'.
WRITE :/ 'Check Inbound queues in target system in Tx- SMQR'.

--------------------------------------------------------------------------------------------------------------------------------
Step2. Source system: program output.

Step3.  Source system: Tx- SMQR ( out bound scheduler) . Select the Two queues. Double click on it.

Step4.  Source system:  Double click on queue name.

Step5.  Source system:  So here some part of the each queue is added to one LUW. process the queues.

Step6. Target system: :  Tx- SMQS( In bound scheduler) . Select the two queues and double click on it.

Step7.  Target system:  Double click on it.

Step8.  Target system:  So we have two LUWS each contains some part of both queues.

Step9.  Target system:  Juts a comparison of TIDs of the source and target system.

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

qRFC with Outbound Queue & Inbound Queue between two different SAP systems - One LUW per Queue Call

-------------------------------------------------------------------------------------------------------------------------------------
After calling the RFCs under a queue, the next commit work statement closes the current LUW and opens a new one. Here we have the report.. Execute it.
------------------------------------------------------------------------------------------------------------------------

DATA ls TYPE scarr.
*** first queue *****
CALL FUNCTION 'TRFC_SET_QIN_PROPERTIES'
  EXPORTING
    qout_name = 'OUT_QUEUE1'
    qin_name  = 'INN_QUEUE1'.
clear ls.
ls-carrid = 'XX'.
CALL FUNCTION 'ZCREATE_FLIGHT_REC'
 IN BACKGROUND TASK
 "AS SEPARATE UNIT " creates a separate luw
 DESTINATION 'SRC_TO_TGT'
EXPORTING
  is = ls.

CALL FUNCTION 'TRFC_SET_QIN_PROPERTIES'
  EXPORTING
    qout_name = 'OUT_QUEUE1'
    qin_name  = 'INN_QUEUE1'.

CLEAR ls.
ls-carrid = 'XX'.
ls-carrname = 'XX AIRLINE'.
CALL FUNCTION 'ZUPDATE_FLIGHT_REC'
 IN BACKGROUND TASK
 "AS SEPARATE UNIT " creates a separate luw
 DESTINATION 'SRC_TO_TGT'
EXPORTING
  is = ls.
COMMIT WORK. " End of first LUW

*** Second queue ***
CALL FUNCTION 'TRFC_SET_QIN_PROPERTIES'
  EXPORTING
    qout_name = 'OUT_QUEUE2'
    qin_name  = 'INN_QUEUE2'.
clear ls.
ls-carrid = 'YY'.
CALL FUNCTION 'ZCREATE_FLIGHT_REC'
 IN BACKGROUND TASK
 "AS SEPARATE UNIT " creates a separate luw
 DESTINATION 'SRC_TO_TGT'
EXPORTING
  is = ls.

CALL FUNCTION 'TRFC_SET_QIN_PROPERTIES'
  EXPORTING
    qout_name = 'OUT_QUEUE2'
    qin_name  = 'INN_QUEUE2'.

CLEAR ls.
ls-carrid = 'YY'.
ls-carrname = 'YY AIRLINE'.
CALL FUNCTION 'ZUPDATE_FLIGHT_REC'
 IN BACKGROUND TASK
 "AS SEPARATE UNIT " creates a separate luw
 DESTINATION 'SRC_TO_TGT'
EXPORTING
  is = ls.

COMMIT WORK. " end of second LUW
WRITE :/ 'Check outbound queues in source system in Tx- SMQS'.
WRITE :/ 'Check Inbound queues in target system in Tx- SMQR'.

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

Step2. Here we have the report output.


 Step3. Source System: Tx- SMQR( Out Bound Scheduler). Select both the queues and double click on it.

Step4. Source System: Double click on the queue name.

Step5. Source System: So here we have two LUWs for two Queues. Process the queues.


Step6. Target System: Tx- SMQS( Inbound Scheduler). The snap shot of comparison of the TIDs.


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

qRFC with Outbound Queue & Inbound Queue between two different SAP systems - One LUW for Multiple QUEUE Calls

----------------------------------------------------------------------------------------------------------------------------------------
The below post shows how to club multiple QUEUE ( one queue having multiple FM calls) into a single LUW. After calling the TWO queues with their respective FMs , at the end Commit work happens so every thing is put into a single LUW. Execute the program.
------------------------------------------------------------------------------------------------------------------------------------
REPORT  zoutqueue_inqueue.
DATA ls TYPE scarr.
*** first queue *****
CALL FUNCTION 'TRFC_SET_QIN_PROPERTIES'
  EXPORTING
    qout_name = 'OUT_QUEUE1'
    qin_name  = 'INN_QUEUE1'.
clear ls.
ls-carrid = 'XX'.
CALL FUNCTION 'ZCREATE_FLIGHT_REC'
 IN BACKGROUND TASK
 "AS SEPARATE UNIT " creates a separate luw
 DESTINATION 'SRC_TO_TGT'
EXPORTING
  is = ls.

CALL FUNCTION 'TRFC_SET_QIN_PROPERTIES'
  EXPORTING
    qout_name = 'OUT_QUEUE1'
    qin_name  = 'INN_QUEUE1'.

CLEAR ls.
ls-carrid = 'XX'.
ls-carrname = 'XX AIRLINE'.
CALL FUNCTION 'ZUPDATE_FLIGHT_REC'
 IN BACKGROUND TASK
 "AS SEPARATE UNIT " creates a separate luw
 DESTINATION 'SRC_TO_TGT'
EXPORTING
  is = ls.

*** Second queue ***
CALL FUNCTION 'TRFC_SET_QIN_PROPERTIES'
  EXPORTING
    qout_name = 'OUT_QUEUE2'
    qin_name  = 'INN_QUEUE2'.
clear ls.
ls-carrid = 'YY'.
CALL FUNCTION 'ZCREATE_FLIGHT_REC'
 IN BACKGROUND TASK
 "AS SEPARATE UNIT " creates a separate luw
 DESTINATION 'SRC_TO_TGT'
EXPORTING
  is = ls.

CALL FUNCTION 'TRFC_SET_QIN_PROPERTIES'
  EXPORTING
    qout_name = 'OUT_QUEUE2'
    qin_name  = 'INN_QUEUE2'.

CLEAR ls.
ls-carrid = 'YY'.
ls-carrname = 'YY AIRLINE'.
CALL FUNCTION 'ZUPDATE_FLIGHT_REC'
 IN BACKGROUND TASK
 "AS SEPARATE UNIT " creates a separate luw
 DESTINATION 'SRC_TO_TGT'
EXPORTING
  is = ls.

COMMIT WORK.
WRITE :/ 'Check outbound queue in source system in Tx- SMQS'.
WRITE :/ 'Check Inbound queue in target system in Tx- SMQR'.

-----------------------------------------------------------------------------------------------------------------------------
Step1. Source System: Tx- SMQR( out bound scheduler). Select the line and click on the qRFC Monitor button.

Step2. Source System: Select both the out bound queues and double click on it.

Step3. Source System: Double click on it.

Step4. Source System: So here we have a single TID for all the FM calls that  belongs to two different Queues.  process the out bound queue.

Step5. Target System: Tx- SMQS( Inbound Scheduler): Select the line and click on the qRFC monitor button.


Step6. Target System: Select both the inbound queues. Double click on it.

Step7. Target System: Double click on the queue name.

Step8. Target System:: So here we have a single technical ID for all the FM calls that belongs to two different queues.


 See the next post how each queue FM calls are assigned to separated LUWs
----------------------------------------------------------------------------------------------------------------------------------------


qRFC with Outbound Queue & Inbound Queue between two different SAP systems - One LUW per one QUEUE

-----------------------------------------------------------------------------------------------------------------------------------
In QUEUE RFC call if we skip the part 'AS SEPARATE UNIT' then all the RFC calls of all the QUEUEs are put into a single LUW upto the point when first Commit Work statement occurs.
Step1. Here we have a program that uses a single queue and inside that we have two RFC FM calls  and at last commit work happens so it creates a single TID- Transaction ID ( one luw) . Execute the program.

Step2. Output.

Step3. Source system: Tx- SMQR( out bound scheduler) - One TID(one luw) fro two RFC FM calls in a single out bound  queue.


Step4. Target System: Tx- SMQS[inbound scheduler] - One TID ( one luw) for both FM calls.

See next post where multiple calls Multiple queues are put into a single LUW. 
-----------------------------------------------------------------------------------------------------------------------------------


qRFC with Outbound Queue & Inbound Queue between two different SAP systems - One LUW per One RFC FM call

-----------------------------------------------------------------------------------------------------------------------------------
Step1. In single Queue- If we call multiple RFC FMs as separate unit then, for each FM call there is a separate TID - transaction Id means it is a separate LUW. Execute the report which calls two RFC FMs in separate  unit .

Step2. Output.

Step3. Source system - Tx- SMQS. Select the line and click on qRFC Monitor.

Step4. Source system: Double click on out bound queue name.

Step5. Source system : Double click on the OUT BOUND Queue name.

Step6. Source system: So here we have TWO RFC FM calls and each is associated with a different TID. Process the out bound queue.

Step7. Source system. TO process the queue register the RFC destination.

Step8. Source system. Continue to proceed.

Step9.  Target system : Tx- SMQS. Select the line and click on the qRFC Monitor button.

Step10.  Target system : Double click on the Inbound Queue name.

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

Step12.  A snap short of the comparison of the TIDs of the source system outbound queue and destination system inbound queues.
 See the next post where all FM calls are included in a single LUW.

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

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.
--------------------------------------------------------------------------------------------------------------------------------

Comments system

Disqus Shortname