KEMBAR78
Fila Com QRFC | PDF | Software | Software Engineering
0% found this document useful (0 votes)
27 views18 pages

Fila Com QRFC

The document discusses the implementation of qRFC with an outbound queue in ABAP, focusing on the serialization of function module executions in a target system. It provides a step-by-step guide on creating, updating, and deleting flight codes using RFC-enabled function modules, along with necessary configurations and testing procedures. The blog also highlights the importance of managing RFC destinations and the qRFC scheduler for successful execution of queued tasks.

Uploaded by

Elder Castro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views18 pages

Fila Com QRFC

The document discusses the implementation of qRFC with an outbound queue in ABAP, focusing on the serialization of function module executions in a target system. It provides a step-by-step guide on creating, updating, and deleting flight codes using RFC-enabled function modules, along with necessary configurations and testing procedures. The blog also highlights the importance of managing RFC destinations and the qRFC scheduler for successful execution of queued tasks.

Uploaded by

Elder Castro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

TECHSAP : qRFC with outbound Queue ( no Inbound Queue) in ABAP!!! http://freesapabap.blogspot.com/2014/11/qrfc-with-outbound-queue-n...

Hello Visitors,The blog contents are now available in my new site: https://sapcodes.com/ .

Sunday 30 November 2014

qRFC with outbound Queue ( no Inbound Queue) in


ABAP!!!
---------------------------------------------------------------------------------------------------------------------
---------------------------
If the process needs to serially execute the FMs in the target system, then QRFC is the
option. All the function modules that are assigned as a member with a counter number to
the QUEUE are executed one after another. The below post shows how this can be
achieved. This shows a flight code creation and then updating it in the target system. So we
want to serialize the process, first the creation would happen and then only update not
update first and then creation. Pages - Menu
---------------------------------------------------------------------------------------------------------------------
Home
---------------------------
ABAP
Step1. Target System: Create a RFC enabled function module..
ABAP-2
Web-Dynpro

qRFC with outbound Queue ( no Inbound

tRFC in ABAP? Here is One eaxmple!

Do business need a graphical chart?

ABAP : Program Progress Bar?

Kernel BAdI : How to Use Kernel BAdI

How Primary and Secondary Index

How to change Technical Settings of

RFC Communication between two

SAP RFC Connection between two R/3


systems
Table Buffering: How exactlysingle
buffering works...
Table Buffering: How exactly [Generic or
Step2. Target System: Import parameter. Fully] bu...
Controlling/Restricting SELECT-
OPTIONS features!!!
Need a Time Dependent View in ABAP?
Global MACRO in ABAP!!!
Need Different section in ALV TOP OF
PAGE? LEFT/MI...
SCRIPT: Creating BAR CODE and Using
it in SAP Script
SCRIPT: Determining Sub Total & Total in
SAP Script
SCRIPT: Displaying LOGO in SAP
SCRIPT
SCRIPT : Uses of FM:
CONTROL_FORM in SAP Script
SCRIPT: Calling ABAP Subroutines In
SAP Script
SCRIPT: How to Use conditional
statements in SAPsc...
SCRIPT: Multiple ways to debug a SAP
Script.
SCRIPT : Use of ADDRESS ....
ENDADDRESS in SAP Sc...
SCRIPT : How PROTECT -
ENDPROTECT works in SAP SCR...
SCRIPT : Use of NEW-PAGE and
NEW_WINDOW in SAP Scr...
SCRIPT : How to use multiple instances
(00->98 = 9...
SCRIPT: Creating Box /Shadow Box in
SAP SCript
SCRIPT: Want to use Standard Text
Element in Scrip...
SCRIPT: Window types in SCRIPT &
Uses of TOP - EN...
SCRIPT: Passing Internal table records
from Driver...
SCRIPT: Adding a Text Element to the
Step3. Target System: Source code. This FM creates (Insert) a new flight code. Main Window o...
SCRIPT : Page view Comparison :
Potrait Vs. Landscape
SCRIPT : Simple Design and driver
program for SAP ...
Database Lock(Open SQL Statement )
Vs. SAP Lock ...
Step4. Target System: Creates one more FM.
Screen Enhancement For Delivery
Header VL01N/VL02N...
Customer Exit (Screen Exit)- ME21N/
ME22N/ME23N- He...

October (32)
September (12)
August (1)
July (18)
June (21)
April (2)
March (7)
February (13)
January (9)

2013 (46)

1 of 18 22/08/2024, 18:49
2012 (14)

Total Pageviews

Step5. Target System: import parameter.

Step6. Target System: Source code which updates an existing flight code.

Step7. Target System: Create the last FM for the test purpose.
TECHSAP : qRFC with outbound Queue ( no Inbound Queue) in ABAP!!! http://freesapabap.blogspot.com/2014/11/qrfc-with-outbound-queue-n...

Step8. Target System: Import parameter.

Step9. Target System: Sourced code which deletes one flight code.

Step10. Target System: current record status in table.

3 of 18 22/08/2024, 18:49
TECHSAP : qRFC with outbound Queue ( no Inbound Queue) in ABAP!!! http://freesapabap.blogspot.com/2014/11/qrfc-with-outbound-queue-n...

Step11. Calling System: We will use this RFC destination created in Tcode- SM59 for our test
purpose. OD a connection test.

Step12. Calling System: The connection is successful.

4 of 18 22/08/2024, 18:49
TECHSAP : qRFC with outbound Queue ( no Inbound Queue) in ABAP!!! http://freesapabap.blogspot.com/2014/11/qrfc-with-outbound-queue-n...

Step13. Calling System: Here is the program which prepares a Queue with a particular
name and calls each RFC function modules.

Here for the demo purpose. We will call two RFC FMs in sequential order. One which
creates a flight code and then one more RFC FM which updates the flight code. As we want
to use qRFC technique, then before calling each CREATE & UPDATE RFC FM , we have to
call the FM 'TRFC_SET_QUEUE_NAME' before calling create or update FM.
---------------------------------------------------------------------------------------------------------------------
------------------------

REPORT zqrfc_flight_test.
TYPES: BEGIN OF ty_res,
dest TYPE rfcdest,
tid TYPE arfctid,
xcall TYPE i,
END OF ty_res.

SELECTION-SCREEN: BEGIN OF BLOCK b1.


PARAMETERS : carr TYPE scarr-carrid,
cr AS CHECKBOX, " create
up AS CHECKBOX, "update
dl AS CHECKBOX. "delete
SELECTION-SCREEN: END OF BLOCK b1.
DATA : ls TYPE scarr,
lt_res TYPE TABLE OF ty_res,
ls_res TYPE ty_res,
indx TYPE i.

ls-carrid = carr.

IF cr = 'X'.
CALL FUNCTION 'TRFC_SET_QUEUE_NAME' " sett the queue name by calling FM
EXPORTING
qname = 'DEV_TED_QUEUE_FLIGHT' " queue name
EXCEPTIONS
invalid_queue_name = 1
OTHERS = 2.

IF sy-subrc <> 0.
EXIT.
ENDIF.

CALL FUNCTION 'ZRFC_CREATE_AIRLINE_CODE'


IN BACKGROUND TASK AS SEPARATE UNIT " qRFC counter 1
DESTINATION 'QRFC_DEST_TEST'
EXPORTING
ls = ls.
CALL FUNCTION 'ID_OF_BACKGROUNDTASK' " call the FM which will gibe the TID
EXPORTING

5 of 18 22/08/2024, 18:49
TECHSAP : qRFC with outbound Queue ( no Inbound Queue) in ABAP!!! http://freesapabap.blogspot.com/2014/11/qrfc-with-outbound-queue-n...

dest = 'QRFC_DEST_TEST' " rfc destination name


IMPORTING
tid = ls_res-tid.
ls_res-dest = 'QRFC_DEST_TEST'.
indx = indx + 1.
ls_res-xcall = indx.
APPEND ls_res TO lt_res.
CLEAR ls_res.
ENDIF.

IF up = 'X'.
CALL FUNCTION 'TRFC_SET_QUEUE_NAME' " sett the queue name by calling FM
EXPORTING
qname = 'DEV_TED_QUEUE_FLIGHT'
EXCEPTIONS
invalid_queue_name = 1
OTHERS = 2.

IF sy-subrc <> 0.
EXIT.
ENDIF.
LS-CARRNAME = 'NEW CARRNAME'. " SENDING CARRNAME FIELD AS UPDATE
CALL FUNCTION 'ZRFC_UPDATE_AIRLINE_CODE'
IN BACKGROUND TASK AS SEPARATE UNIT " qRFC counter 2
DESTINATION 'QRFC_DEST_TEST'
EXPORTING
ls = ls.

CALL FUNCTION 'ID_OF_BACKGROUNDTASK'


EXPORTING
dest = 'QRFC_DEST_TEST'
IMPORTING
tid = ls_res-tid.
ls_res-dest = 'QRFC_DEST_TEST'.
indx = indx + 1.
ls_res-xcall = indx.
APPEND ls_res TO lt_res.
CLEAR ls_res.

ENDIF.

IF dl = 'X'.
CALL FUNCTION 'TRFC_SET_QUEUE_NAME' " sett the queue name by calling FM
EXPORTING
qname = 'DEV_TED_QUEUE_FLIGHT'
EXCEPTIONS
invalid_queue_name = 1
OTHERS = 2.

IF sy-subrc <> 0.
EXIT.
ENDIF.

CALL FUNCTION 'ZRFC_DELETE_AIRLINE_CODE'


IN BACKGROUND TASK AS SEPARATE UNIT " " qRFC counter 3
DESTINATION 'QRFC_DEST_TEST'
EXPORTING
ls = ls.
CALL FUNCTION 'ID_OF_BACKGROUNDTASK'
EXPORTING
dest = 'QRFC_DEST_TEST'
IMPORTING
tid = ls_res-tid.
ls_res-dest = 'QRFC_DEST_TEST'.
indx = indx + 1.
ls_res-xcall = indx.
APPEND ls_res TO lt_res.
CLEAR ls_res.
ENDIF.

COMMIT WORK. " triggers the outbound queue by the scheduler

LOOP AT lt_res INTO ls_res.


WRITE : / ls_res-dest, ls_res-tid, ls_res-xcall.
ENDLOOP.

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

Step14. Calling System: Go to tcode- SMQ1 which shows the outbound queues.

Step15. Calling System: execute.

Step16. Calling System: Currently there is no queue waiting.

6 of 18 22/08/2024, 18:49
TECHSAP : qRFC with outbound Queue ( no Inbound Queue) in ABAP!!! http://freesapabap.blogspot.com/2014/11/qrfc-with-outbound-queue-n...

Step17. Calling System: Go to Tcode- SMQS which is the qRFC scheduler.

Step18. Calling System: Let's register our RFC destination here which is used in our
program. Click on the registration button.

Step19. Calling System: Form the pop up, with F4 option select our RFC destination.

Step20. Calling System: Here is our rfc destination and continue.

Step21. Calling System: So here our rfc destination is added to the outbound scheduler.
Check that type is R. Which means the RFC destination is registered. When any call
happens from the program with this RFC destination, if its type - R then the system
automatically start processing it.

7 of 18 22/08/2024, 18:49
TECHSAP : qRFC with outbound Queue ( no Inbound Queue) in ABAP!!! http://freesapabap.blogspot.com/2014/11/qrfc-with-outbound-queue-n...

Step22. Calling System: Select our rfc destination by checking the check box from the left
side and click on deregistration button.

Step23. Calling System: Continue.

8 of 18 22/08/2024, 18:49
TECHSAP : qRFC with outbound Queue ( no Inbound Queue) in ABAP!!! http://freesapabap.blogspot.com/2014/11/qrfc-with-outbound-queue-n...

Step24. Calling System: So the type - U now, which means any call made by using this RFC
destination, the system/the scheduler will not process those automatically unless until the
type is R.
Actually we don't need to register any RFC destination in SMQS transaction. When ever any
call is made from program by using qRFC concept with a rfc destination and when the
subsequent commit work statement is executed in the program, then automatically the
RFC destination is added to this transaction with type R and the scheduler starts processing
it. For our demo process we need to understand how exactly it works, for that reason we
registered the RFC destination and make as type U from R. later we will make it as R to
execute our queue fMs.

Step25. Calling System: Execute the above report. Provide a flight code- ( carr field ) and
choose CR ( create) and UP( update) check box and execute it. Make sure that the debug
point is set in the report program also to under stand the process. Step 13 tells where to
set debug point. Also set debug point in RFC FMs in the target system.

Step26. Calling System: The debugger is triggered here. we are at line 45. when qRFC FM is
called, in the background it creates a transaction ID number which is temporarily stored in
the table. This can be retrieved by using the FM ID_OF_BACKGROUNDTASK and passing the
rfc destination name to it. Here we just need to display it.

Step27. Calling System: Continue the execution in the debugger with F5 or F6 button. as
we have selected the update check box also, it exeucutes this option.

9 of 18 22/08/2024, 18:49
TECHSAP : qRFC with outbound Queue ( no Inbound Queue) in ABAP!!! http://freesapabap.blogspot.com/2014/11/qrfc-with-outbound-queue-n...

Step28. Calling System: we are the point where the two qRFC are called ( create and
update). but the commit work statement has not been triggered yet. double click on
LT_RES internal table in the debugger to see its contents.

Step29. Calling System: Here we have two entries with the transaction id for both the qRFC
calls. Go back (F3).

10 of 18 22/08/2024, 18:49
TECHSAP : qRFC with outbound Queue ( no Inbound Queue) in ABAP!!! http://freesapabap.blogspot.com/2014/11/qrfc-with-outbound-queue-n...

Step30. Calling System: press F6 to complete commit work statement execution.

Step31. Calling System: So here we are. Now we have to check what has happened in the
system by the execution of commit work statement.

Step32. Calling System: go to tcode- SMQ1 . previously in our check there was no records
now we have one record. it displays the queue name and rfc destination name. in the
QUEUE Information section, no of queue is 1 and inside that queue there are two FM calls
one for create and one for update.

Step33. Calling System: Double click on the queue name and it will show the two RFC FM
names which will be called in sequence.

11 of 18 22/08/2024, 18:49
TECHSAP : qRFC with outbound Queue ( no Inbound Queue) in ABAP!!! http://freesapabap.blogspot.com/2014/11/qrfc-with-outbound-queue-n...

Step35. Calling System: Go to tcode- SMQS the outbound scheduler. From here also we can
move to the Tcode- SMQ1 as well. Select our destination by selecting the check box from
the left side and click on the QRFC Monitor button.

Step36. Calling System: So here we are again what we observed in SMQ1 tcode. Go back.

Step37. Calling System: Now we have to make ourRFC destination mode as R so that the
scheduler starts executing the queue. Select the check box from left side for the RFC
destination and click on registration button. Here mark some thing , the scheduler status is
inactive as nothing is there to process and also our RFC destination line status is inactive.
Select our destination by selecting the check from from the left side and click on
registration button.

12 of 18 22/08/2024, 18:49
TECHSAP : qRFC with outbound Queue ( no Inbound Queue) in ABAP!!! http://freesapabap.blogspot.com/2014/11/qrfc-with-outbound-queue-n...

Step38. Calling System: Continue.

Step39. Calling System: So the type is R now and notice the scheduler status is starting
from Inactive. Now the scheduler starts executing the FMs that line in this queue. If the
debug point has been set in the target RFC FMs that would have been triggered.

Step40. Target System: So here the debugger is. Hold here the debugger don't press F8.

13 of 18 22/08/2024, 18:49
TECHSAP : qRFC with outbound Queue ( no Inbound Queue) in ABAP!!! http://freesapabap.blogspot.com/2014/11/qrfc-with-outbound-queue-n...

Step41. Calling System: check the tcode- SMQ1 and here the status is running and also
there are 2 entries out of which first is executing.

Step42. Calling System: Go to tcode- SMQS and scheduler status is waiting and also our
destination status is waiting with action conn 1.

Step43. Target System: Go to the debugger and press F8. So the first create FM finished its
execution.

14 of 18 22/08/2024, 18:49
TECHSAP : qRFC with outbound Queue ( no Inbound Queue) in ABAP!!! http://freesapabap.blogspot.com/2014/11/qrfc-with-outbound-queue-n...

Step44. Target System: So again the scheduler starts executing the second FM in the
queue. Hold the debugger here don't press f8.

Step45. Target System: Check the table entries. So one record has been creates with id ZZ.

Step46. Calling System: Go to Tcode- SMQ1 and check the status and entries. Out of 1
entries first entry has already been executed and the second is running.

15 of 18 22/08/2024, 18:49
TECHSAP : qRFC with outbound Queue ( no Inbound Queue) in ABAP!!! http://freesapabap.blogspot.com/2014/11/qrfc-with-outbound-queue-n...

Step47. Calling System: Go to Tcode- SMQS and check the status as well.

Step48. Target System: Go to the debugger and press F8 to finish the execution.

16 of 18 22/08/2024, 18:49
TECHSAP : qRFC with outbound Queue ( no Inbound Queue) in ABAP!!! http://freesapabap.blogspot.com/2014/11/qrfc-with-outbound-queue-n...

Step49. Target System: check in the table. OS it has been properly updated with carrname
field.

Step50. Calling System: Goto tocde- SMQ1 and refresh it.

Step51. Calling System: there would be no more queues with our destination.

Step52. Calling System: check tcode- SMQS and the scheduler status is inactive and our rfc
destination line status is also inactive.

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

17 of 18 22/08/2024, 18:49
TECHSAP : qRFC with outbound Queue ( no Inbound Queue) in ABAP!!! http://freesapabap.blogspot.com/2014/11/qrfc-with-outbound-queue-n...

at 06:28:00

No comments:
Post a Comment

Newer Post Home Older Post

Subscribe to: Post Comments (Atom)

Comments system

Disqus Shortname

Simple theme. Powered by Blogger.

18 of 18 22/08/2024, 18:49

You might also like