Professional Documents
Culture Documents
Products
Products Industries
Industries Services and Support
Services Support Training
Training Community
Community Developer
Developer
Partner
Partner About
About
Technical Articles
Bruno Esperança
March 13, 2019 7 minute read
Intro
Throughout my career as an ABAP developer I found very limited real world cases of parallel processing in
ABAP. Truth is, 90% of the times, poor performance is coming from an unreasonable number of accesses to the
database, normally in the order of several thousands of accesses, which is very easily xable by changing the
selection strategy, and the other 9.9% of the time, from not de ning internal tables properly (as sorted or
hashed tables when suitable), etc. Only very rarely there comes a situation where performance can be best
improved by proper parallel processing, and I think that when these situations nally come around, the
developer forgets that this is possible, it simply doesn’t come to the developer’s mind, or the developer is lazy
to educate him or herself about it.
https://blogs.sap.com/2019/03/13/and-now-a-real-world-case-of-parallel-processing/?source=email-g-community-newsletter-Apr19&sap-outbound-id… 1/13
4/1/2019 And now, a real world case of parallel processing | SAP Blogs
So, this blog post serves mainly to raise awareness once again to the fact that parallel processing is possible in
SAP ABAP and actually quite easy, and maybe it will help someone getting it to work, even if I think the technical
part is not very challenging. The “inspiration” for this came from the following link:
https://help.sap.com/doc/saphelp_nw70/7.0.31/en-
US/fa/096e92543b11d1898e0000e8322d00/content.htm?no_cache=true
Coming to the topic at hand, at my company we bought and installed a piece of software called “Transport
Pro ler” (hopefully this is not con dential information) which checks all transport requests which are planned
to be imported into production, to check for integrity, missing dependencies, or any issues that might prevent a
smooth import. The software is sometimes a bit unstable, but it has become quite helpful, I can recommend it.
Anyway, as we have several productive systems, to make it practical for the operator who is checking the
results, we created a program that could be executed from a central system (Solution Manager in our case) and
trigger the API for this Transport Pro ler for each productive system, gather the results and display them to the
operator. Typically, this would be done sequentially, but it’s an excellent opportunity for parallel processing, so I
took this opportunity.
Implementation
The rst step is creating an RFC that you will need to propagate for each system, or for other cases, for example
if you need to perform some expensive calculations that you’d like to do in parallel, you need to create a remote-
enabled function module anyway, because that’s simply how this works.
https://blogs.sap.com/2019/03/13/and-now-a-real-world-case-of-parallel-processing/?source=email-g-community-newsletter-Apr19&sap-outbound-id… 2/13
4/1/2019 And now, a real world case of parallel processing | SAP Blogs
I will simply copy/paste the coding now that I wrote to call this in parallel. As in my situation we only need 3
processes, and we pretty much always have enough processes available, my resource handling is atrocious. In
another case, I created a proper loop which will wait for a few second and try a few times to get an available
process. If it continues to fail for a long time, it gives up. You can get an “inspiration source” in the link above.
The idea is simple… call the function module to initialize the environment, whatever that means… and from this
initialization you can get the number of processes available. This could be helpful if you want to guarantee, for
example, that you don’t completely drain the resources of the system and you always leave enough margin for
other activities. Following, you call the remote-enabled function module which is responsible for performing the
calculations or whatever you want to do in parallel, specifying the subroutine which is responsible for gathering
the results. You can use the “taskname” counter to identify this, or you can simply include some identi cation in
the results of the function module, it’s a design decision, however you feel most comfortable. The code snippets
should be enough for you to understand how this is working, if necessary.
If you need more information or something is not clear, feel free to ask.
https://blogs.sap.com/2019/03/13/and-now-a-real-world-case-of-parallel-processing/?source=email-g-community-newsletter-Apr19&sap-outbound-id… 3/13
4/1/2019 And now, a real world case of parallel processing | SAP Blogs
FUNCTION ZSOL_CHECK_TP_PROD.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(IT_TRKORRS) TYPE TRKORRS
*" EXPORTING
*" VALUE(EV_ERROR_OCCURRED) TYPE FLAG
*" VALUE(ET_TP_RESULTS) TYPE ZSOL_TP_PROD_RESULTS_TT
*"----------------------------------------------------------------------
PERFORM clear_global_variables.
CLEAR:
ev_error_occurred,
et_tp_results.
* Something to check?!
CHECK it_trkorrs IS NOT INITIAL.
PERFORM get_systems
CHANGING
lt_systems.
PERFORM initialize_pbt_environment
CHANGING ev_error_occurred.
CHECK ev_error_occurred IS INITIAL.
PERFORM start_trans_profiler_remote
https://blogs.sap.com/2019/03/13/and-now-a-real-world-case-of-parallel-processing/?source=email-g-community-newsletter-Apr19&sap-outbound-id… 4/13
4/1/2019 And now, a real world case of parallel processing | SAP Blogs
USING
lv_taskname
ls_system
it_trkorrs.
ADD 1 TO lv_taskname.
ADD 1 TO gv_snd_jobs.
ENDLOOP.
DO.
WAIT UP TO 1 SECONDS.
ENDDO.
et_tp_results = gt_check_results.
ENDFUNCTION.
*----------------------------------------------------------------------*
***INCLUDE LZSOL_TPF01.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form GET_SYSTEMS
*&---------------------------------------------------------------------*
* Get systems from customizing
https://blogs.sap.com/2019/03/13/and-now-a-real-world-case-of-parallel-processing/?source=email-g-community-newsletter-Apr19&sap-outbound-id… 5/13
4/1/2019 And now, a real world case of parallel processing | SAP Blogs
*----------------------------------------------------------------------*
FORM get_systems
CHANGING
ct_systems TYPE tt_system.
CLEAR ct_systems.
CLEAR ls_system.
ENDLOOP.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form RETRIEVE_INFO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM retrieve_info USING iv_taskname.
https://blogs.sap.com/2019/03/13/and-now-a-real-world-case-of-parallel-processing/?source=email-g-community-newsletter-Apr19&sap-outbound-id… 6/13
4/1/2019 And now, a real world case of parallel processing | SAP Blogs
EXCEPTIONS
communication_failure = 1
system_failure = 2.
IF sy-subrc <> 0.
<lf_results>-check_result = 'E'.
RETURN.
ENDIF.
ADD 1 TO gv_rcv_jobs.
IF lv_contains_error = abap_true.
<lf_results>-check_result = 'E'.
ELSE.
<lf_results>-check_result = abap_false.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form INITIALIZE_PBT_ENVIRONMENT
*&---------------------------------------------------------------------*
* Initialize the PBT environment, whatever it is
*----------------------------------------------------------------------*
FORM initialize_pbt_environment
CHANGING
pv_error_occurred TYPE flag.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form START_TRANS_PROFILER_REMOTE
*&---------------------------------------------------------------------*
* Start Transport Profiler in the remote system
*----------------------------------------------------------------------*
FORM start_trans_profiler_remote
USING
iv_taskname TYPE n
is_system TYPE ty_system
https://blogs.sap.com/2019/03/13/and-now-a-real-world-case-of-parallel-processing/?source=email-g-community-newsletter-Apr19&sap-outbound-id… 7/13
4/1/2019 And now, a real world case of parallel processing | SAP Blogs
zcl_utilities=>get_rfc_destination(
EXPORTING
im_tech_sys_name = is_system-system " Extended System ID
im_client = is_system-client " The ABAP Client
im_rfc_type = zcl_utilities=>co_rfc_type-trusted " RFC Destination Type
IMPORTING
ex_rfc_dest = DATA(ls_trusted_rfc_dest) " Logical Destination (Specified in Function Ca
).
PERFORM filter_irrelevant_trkorrs
USING
is_system
CHANGING
it_trkorrs.
https://blogs.sap.com/2019/03/13/and-now-a-real-world-case-of-parallel-processing/?source=email-g-community-newsletter-Apr19&sap-outbound-id… 8/13
4/1/2019 And now, a real world case of parallel processing | SAP Blogs
ENDIF.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form CLEAR_GLOBAL_VARIABLES
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM clear_global_variables.
CLEAR:
gv_snd_jobs,
gv_rcv_jobs,
gt_check_results,
gv_number_of_systems.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FILTER_IRRELEVANT_TRKORRS
*&---------------------------------------------------------------------*
* It could be that some transport requests were already imported
* or don't exist. Let's not run transport profiler on them
*----------------------------------------------------------------------*
FORM filter_irrelevant_trkorrs
USING
is_system TYPE ty_system
CHANGING
ct_trkorrs TYPE trkorrs.
TRY.
DATA(cofile) = tr_order->read_cofile( ).
https://blogs.sap.com/2019/03/13/and-now-a-real-world-case-of-parallel-processing/?source=email-g-community-newsletter-Apr19&sap-outbound-id… 9/13
4/1/2019 And now, a real world case of parallel processing | SAP Blogs
CATCH zcx_bobj.
CONTINUE.
ENDTRY.
ENDLOOP.
ct_trkorrs[] = lt_trkorrs[].
ENDFORM.
Conclusions
Parallel processing is not so hard to implement. In situations where users are waiting for a longer period, and
there’s not much room for improvement in other ways, for example if we are talking about contacting several
systems via RFC, or processing many sales orders which have to execute the pricing procedure each time, etc.,
parallel processing is an e ective way of reducing the waiting times for the user, thus giving the illusion of
improved performance, even though this should *not* be used as a replacement for proper database access
strategies and proper coding.
https://blogs.sap.com/2019/03/13/and-now-a-real-world-case-of-parallel-processing/?source=email-g-community-newsletter-Apr19&sap-outbound-i… 10/13
4/1/2019 And now, a real world case of parallel processing | SAP Blogs
Alert Moderator
Assigned tags
Related Questions
5 Comments
Florian Henninger
https://blogs.sap.com/2019/03/13/and-now-a-real-world-case-of-parallel-processing/?source=email-g-community-newsletter-Apr19&sap-outbound-id… 11/13
4/1/2019 And now, a real world case of parallel processing | SAP Blogs
have more useable implemetations. The parallel processing to pay technical mistakes is making you pay a lot
money more for the landscape and I’m pretty sure there will be a time when a smart person recognize it
~Florian
PS: I am not a developer (professionally) anymore, so no, I don’t use performs nowadays.
Matthew Billingham
I have used parallel processing fairly often. One particular case was a very large and complex extractor to BW.
On a forty dialog processes system, it would use 2/3 of those available. The problem with extractors that use
parallel processing is that, due to the way they work, you can’t test them easily through RSA3.
I have a class somewhere that makes the actual technical parts quite easy.
Matthew Billingham
https://blogs.sap.com/2019/03/19/parallel-processing-made-easy/
Add Comment
Sitemap Newsletter
https://blogs.sap.com/2019/03/13/and-now-a-real-world-case-of-parallel-processing/?source=email-g-community-newsletter-Apr19&sap-outbound-i… 13/13