Description:

  1. What is bgRFC.

  2. bgRFC configuration.

  3. bgRFC programming.

  4. bgRFC Monitoring.

 

1. What is bgRFC?

The bgRFC allows application to record data that is received later by a called

application. When the data is received, we must ensure that the data was transferred to

the receiver either once only in any order(transactional) or once only in the order of

creation(queued).

 

2. bgRFC Configuration?

  • Creation of supervisor Destination.

This is a mandatory step because the bgRFC can only function if a supervisor

destination has been define for bgRFC processing. For creation of supervisor

destination the t-code is SBGRFCCONF.

 

bgRFC_Configuration_1

bgRFC_Configuration_1

 

bgRFC_Configuration_2

bgRFC_Configuration_2

Prerequisite:

Need to verify the supervisor destination as an RFC destination using the transaction

SM59. This destination must be defined as either an ABAP connection or a logical

connection.

 

bgRFC_Configuration_3

bgRFC_Configuration_3

A user, password, and client must be entered for both connection types. Please refer

the attached screenshot.

 

bgRFC_Configuration_4

bgRFC_Configuration_4

ABAP Connection :

No load balancing can be defined.

No system number can be entered.

No server can be entered.

 

bgRFC_Configuration_5

bgRFC_Configuration_5

Creation of destination:

We have to create inbound/outbound destination name based on the requirement.

 

Creation of Inbound Destination:

On the define inbound Dest. Tab page in the transaction SBGRFCCONF, we can

maintain a separate inbound destination for each application. This is also mandatory

step to create any inbound bgRFC.

 

Logon/Server group can be defined using transaction RZ12.

 

All the settings and activities related to the transaction SBGRFCCONF is BASIS related

activity so before creating/configuring any bgRFC please consult with BASIS team.

bgRFC_Configuration_6

bgRFC_Configuration_6

bgRFC_Configuration_7

bgRFC_Configuration_7

bgRFC_Configuration_8

bgRFC_Configuration_8

 

Creation of outbound destination:

We can create outbound destination using transaction SM59. Creation of outbound

destination in SM59 is normal like any of the destination creation. Please refer the

below screenshot for reference.

 

bgRFC_Configuration_9

bgRFC_Configuration_9

 

We have to created outbound destination under ABAP Connections. For this destination

we have to maintain the necessary target destination IP, system no etc. Please refer all

the below screenshots for detailed setting in each tab.

 

bgRFC_Configuration_10

bgRFC_Configuration_10

bgRFC_Configuration_11

bgRFC_Configuration_11

bgRFC_Configuration_12

bgRFC_Configuration_12

 

After creation of the outbound destination in SM59 we have to maintain this destination

in SBGRFCCONF transaction. We have to maintain the destination in Scheduler

Destination tab of transaction SBGRFCCONF. Please refer the below screenshot.

 

bgRFC_Configuration_13

bgRFC_Configuration_13

 

3. bgRFC Programming

After the entire configuration now let’s talk about the programming.

 

  • Creation of unit:

We have to create one bgRFC unit by taking the reference from the configured

inbound/outbound destination name. Destination objects can be requested using the

class methods from the class CL_BGRFC_DESTINATION_OUTBIUND for the

outbound and the class CL_BGRFC_DESTINATION_INBOUND for the inbound. We

have to use method create of the above mentioned class to create a destination object.

Please see the below example of how to create an inbound destination object.

 

Pass any of the configured inbound destination name in the below mentioned variable.

 

Call the below mentioned method to create reference of inbound destination.

bgRFC_Programming_1

bgRFC_Programming_1

 

If the inbound/outbound destine is invalid the program is going to dump.

Please refer the blow screen shot for your reference.

bgRFC_Programming_2

bgRFC_Programming_2

 

For handling the runtime error we need to use exception class

CX_BGRFC_INVALID_DESTINATION. Please refer the below screenshot for your

reference.

bgRFC_Programming_3

bgRFC_Programming_3

 

After creation of the destination object it is time to create a bgRFC unit. bgRFC unite

can be two types like tRFC and qRFC. We have to use method CREATE_TRFC_UNIT

to create a tRFC unit and method CREATE_QRFC_UNIT to create a qRFC unit. Please

refer the below screenshot.

 

bgRFC_Programming_4

bgRFC_Programming_4

 

To create a qRFC unit we just have to call CREATE_QRFC_UNIT method instead of

CREATE_TRFC_UNIT method.

 

Calling a function module:

After creation of the unit we have to call any function module in background. The new

syntax for calling a function module for background processing is as follows.

 

CALL FUNTION ‘function_name’

IN BACKGROUND UNIT unit

EXPORTING…

Inside the calling function module we have to write our required logic which we want to

process in background (e.g Update a table). Please refer below screenshot for calling of

a function module.

 

bgRFC_Programming_5

bgRFC_Programming_5

 

In the above example the function module is called in background using the created

unit. In the exporting parameter we can define whatever we want to send in the function

module. If we want to send some table also we can define it in the calling module and

we can send it.

 

bgRFC_Programming_6

bgRFC_Programming_6

 

The above screenshot shows complete program to call bgRFC.

 

RFC Function module:

 

RFC_Fun

RFC_Fun_1

 

The function module must be RFC enabled function module.

 

RFC_Fun_2

RFC_Fun_2

 

Here one thing need to remembered, calling the function module will happen once

program does the COMMIT WORK. If we want to create bgRFC from our custom

program like report in that case we have to do external COMMIT WORK but if we are

trying to create bgRFC from any BADI/USER EXIT/Enhancement Spot in that case we

do not need to apply external COMMIT WORK. Once standard SAP do the COMMIT

WORK bgRFC unit will be Created.

 

4. bgRFC Monitoring:

bgRFC monitor typically required to check if any unit is failed or there are any issue in

any particular unit.

 

We have to use transaction SBGRFCMON to monitor bgrfc unit. In the selection screen

we have option to monitor Inbound/Outbound unit along with tRFC unit or qRFC unit.

Also there are several options in the selection screen. Please refer the below screen shot.

 

bgRFC_Mon_1

bgRFC_Mon_1

 

After execution the transaction we will be able to monitor all the erroneous units in the

system. We have to remember if any unit is created successfully and if there are no

data issue or any connection issue in that case it will be executed and we will not able

to see it in this transaction. Only erroneous and warning units will be displayed here.

Please refer the below screenshot.

 

bgRFC_Mon_2

bgRFC_Mon_2

Conclusion:

Background Remote Funtion Call (bgRFC) is a technology in SAP that allow for

asynchronous (qRFC) and synchronously (tRFC) communication between different

systems. It is used to enable background processing of distributed system in a secure

and reliable manner.

 

With bgRFC, developers can create and schedule processes to run in the background

of SAP system, which helps reduce the workload on the front-end and improve system

performance.  The technology ensure that all data is transmitted securely and can

handle large volumes of data efficiently.

 

I would like to hear your thoughts and feedback on this post and promoting relevant

community resources in the SAP community.

 

Related links

Other Blogs for related bgRFC:

https://support.sap.com/en/alm/sap-focused-run/expert-portal/integration-cloud-monitoring/bgrfc.html#:~:text=bgRFC%20is%20a%20superordinate%20term,classic%20tRFC%20and%20qRFC%20versions.

https://support.sap.com/en/alm/solution-manager/expert-portal/monitoring-of-integration-scenarios/bgrfc-channel.html

 

More Blogs:

https://community.sap.com/topics/abap-connectivity

https://answers.sap.com/tags/266264953119842772207986043063520

https://blogs.sap.com/tags/266264953119842772207986043063520/

 

Thank you for reading my content on SCN blog! If you enjoyed what you read and

would like to see more, I encourage you to follow my profile.

 

 

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x