Calling RFC Function Modules in ABAP
Calling RFC Function Modules in ABAP
Home
ABAP
Welcome
Register
Articles
Certifications
Downloads
Featured Article
What People Have To Say About Us!!
Forum
Search
search site Go
email address
Performance
[email protected]
Jul 8th, in SAP ABAP, by Ajay
Have you ever thought of achieving parallel processing using ABAP. Check out how you can do this so as Chat with SAP Ignite
Offline
to best utilize your current infrastructure for better performance.
Categories
ABAP Debugger
ABAP Interview Guide
Articles
Author : Ajay Certifications
Code Inspector
Author's Website | Articles from Ajay Coding Challenge
Data Dictionary
Ajay is a Functional Consultant in Supply Chain Management. He is a SAP Certified SCM APO Downloads
consultant and ABAP Developer. He is also involved in SAP implementations, Migration and Support Enhancement & User Exit
activities as a Consultant. Follow me on Facebook Featured Article
Free Access to SAP IDES system
Parallel Processing in ABAP GUI
Home
Every ABAPer would have definitely encountered issues regarding performance tuning. Usually we use SAP ABAP
trivial methods of optimizing the performance. SAP HANA
Unicode
In this article we would be covering topic for parallel processing in ABAP with respect to asynchronous Webdynpro For ABAP
RFC Function Modules. Slight different perspective for performance tuning. What people have to say about us!!
The idea behind this would be Asynchronous call of a remote-capable function module using the RFC
interface.
To understand the concept we would take a simple example where we would use
‘BAPI_MATERIAL_GET_DETAIL’ to fetch the Material Description from the Material Number and then
we will try to optimize the performance using parallel processing.
sapignite.com/learn-parallel-processing-in-abap/ 1/7
11/6/12 Learn Parallel Processing in ABAP – Speed up Performance « SAP Ignite
_____________________________________________________________________
REPORT ZMATERIAL_WITHOUT_PARALLEL.
TABLES : MARA.
DATA : BAPIMATDOA TYPE BAPIMATDOA,
BAPIRETURN TYPE BAPIRETURN.
SELECT-OPTIONS S_MATNR FOR MARA-MATNR.
LOOP AT S_MATNR.
CALL FUNCTION ‘BAPI_MATERIAL_GET_DETAIL’
EXPORTING
MATERIAL = S_MATNR-LOW
IMPORTING
MATERIAL_GENERAL_DATA = BAPIMATDOA. Find us on Facebook
write : BAPIMATDOA-MATL_DESC.
SAP Ignite
ENDLOOP.
Like 985
_____________________________________________________________________
985 people like SAP Ignite.
Here every time the during loop execution the control would wait for the Function Module to return its
value only then the loop will continue with the next record.
H ardik Ramesh Ram Kumar S omesh Koundiny
Leandro
a
In this case only One Work Process is busy executing your program it does not consider other work
processes even if they are sitting idle.
Let us have a look on the program first and then we will try to understand in detail.
S itharam S habbir N av y asri M ano Rajathi
REPORT ZMATERIAL_DISPLAY_PARALLEL.
TABLES : MARA.
DATA : BAPIMATDOA TYPE BAPIMATDOA,
BAPIRETURN TYPE BAPIRETURN.
My journey to ABAP Certification 307
DATA : SYSTEM TYPE RZLLI_APCL, comment(s)
taskname(8) type c, How to prepare for ABAP Certification 251
comment(s)
index(3) type c,
snd_jobs TYPE i,
Get Free Access to SAP IDES system 188
rcv_jobs TYPE i, comment(s)
exc_flag TYPE i, SAP ABAP interview questions and answers
mess TYPE c LENGTH 80. 64 comment(s)
TYPES : BEGIN OF type_material,
Tutorial for interactive forms by Adobe using
desc TYPE maktx, Webdynpro for ABAP 42 comment(s)
END OF type_material. Most frequently asked Differences in ABAP
interview 39 comment(s)
DATA : Material type table of type_material with header line. How to Implement a BADI in SAP ABAP
with Tutorial 39 comment(s)
data: functioncall1(1) type c. Consuming a Web Service in ABAP 38
constants: done(1) type c value ‘X’. comment(s)
What is SAP HANA ? 36 comment(s)
SELECT-OPTIONS S_MATNR FOR MARA-MATNR. My journey to PI 7.1 Certification
(C_TBIT44_71) 30 comment(s)
system = ‘parallel_generators’. ” RFC Server Group
LOOP AT S_MATNR.
index = sy-tabix.
CONCATENATE ‘Task’ index into taskname. ” Generate Unique Task Name
CALL FUNCTION ‘BAPI_MATERIAL_GET_DETAIL’ STARTING NEW TASK taskname
DESTINATION IN GROUP system
performing set_function1_done on end of task
EXPORTING
MATERIAL = S_MATNR-LOW
EXCEPTIONS
system_failure = 1 MESSAGE mess
communication_failure = 2 MESSAGE mess
resource_failure = 3.
CASE sy-subrc.
WHEN 0.
snd_jobs = snd_jobs + 1.
WHEN 1 OR 2.
MESSAGE mess TYPE ‘I’.
WHEN 3.
IF snd_jobs >= 1 AND
exc_flag = 0.
exc_flag = 1.
sapignite.com/learn-parallel-processing-in-abap/ 2/7
11/6/12 Learn Parallel Processing in ABAP – Speed up Performance « SAP Ignite
UP TO 5 SECONDS.
ENDIF.
IF sy-subrc = 0.
exc_flag = 0.
ELSE.
ENDIF.
WHEN OTHERS.
ENDCASE.
ENDLOOP.
loop at material.
write : material-desc.
endloop.
rcv_jobs = rcv_jobs + 1.
_____________________________________________________________________
For group, you must specify a data object of the type RZLLI_APCLfrom the ABAP Dictionary. This
is usually one of the RFC server group created in transaction RZ12. In our case it is “parallel_generators”.
For each asynchronous RFC where the group is specified, the most suitable application server is
determined automatically, and the called function module is executed on this.
Below is the values configured for the Server Group which we are using.
SYNTAX :
sapignite.com/learn-parallel-processing-in-abap/ 3/7
11/6/12 Learn Parallel Processing in ABAP – Speed up Performance « SAP Ignite
With this statement, you are instructing the SAP system to process function module calls in parallel.
Typically, you’ll place this keyword in a loop in which will divide up the data that is to be processed into
work packets.
Calling program is continued using the statement CALL FUNCTION, as soon as the remotely
called function has been started in the target system, without having to wait for its processing to be
finished.
———————————-
———————————–
———————————-
——————————————- .
It creates Different task name TASK in a separate work process. Each such task executes “form
set_function1_done” in a separate work process.
The statement WAIT UNTIL rcv_jobs >= snd_jobs makes sure that all the call to the asynchronous
RFC call has been completed after which we are ready to write the remaining logic for the program.
Result : The run time analysis of both the program are given as below.
Both the Program was executed for 200 material numbers as input.
Clearly the program with parallel processing is around 50% more effective than the normal program
considering 200 materials as input.
sapignite.com/learn-parallel-processing-in-abap/ 4/7
11/6/12 Learn Parallel Processing in ABAP – Speed up Performance « SAP Ignite
Next time when you face any similar scenario , don’t feel helpless come back read and surprise your
functional tracker with the enhanced performance.
ADVERTISE HERE
Faça seu pedido
User Comments
Ramesh
July 18, 2011
REPLY
SGSONG
February 15, 2012
REPLY
Saravanan
March 13, 2012
sapignite.com/learn-parallel-processing-in-abap/ 5/7
11/6/12 Learn Parallel Processing in ABAP – Speed up Performance « SAP Ignite
REPLY
Good blog; however, you’re not mentioning the processor load of the
actual RFC’s when you do your measurement. True, the main program
trond
April 25, 2012
takes shorter time, but the total load on the application server is higher.
Might be worth considering!
REPLY
Eryanta
May 2, 2012
REPLY
Ebrahim
May 30, 2012
REPLY
Hi,
vivek I am not using the RFC, when i am using the normal function module can i
August 27, 2012
use the above technique…
REPLY
Hi Vivek,
You can use for all the FMs for which the processing type of the FM if
it is remotely enabled.
Cheer
Ajay Ajay
August 27, 2012
REPLY
Thanks Ajay …
vivek
August 27, 2012
REPLY
Leave a Reply
Name
URL (optional)
sapignite.com/learn-parallel-processing-in-abap/ 6/7
11/6/12 Learn Parallel Processing in ABAP – Speed up Performance « SAP Ignite
Submit
sapignite.com/learn-parallel-processing-in-abap/ 7/7