Parallel processing is an additional performance option when
bundling RFCs.
When you add the option "-parallelProcessing" Call
bundledRequests -parallelProcessing the
function calls contained in the bundle are executed in parallel
instead of in series. More precisely: Depending on the number x of
the maximum number of alternative modes defined in SAP, the
processing is carried out in up to x-1 processes. The standard in
the SAP system is x=6, the maximum number x=16. The sequence of
processing is not defined in this case.
The runtime overhead
of parallelizing the calls is around 5-10 milliseconds for each call
(or for each subpackage of calls, see below). This means that it
makes no sense to parallelize 4 calls each of which takes 1
milisecond only: you end up with say 40 milliseconds for the whole
processing instead of 10 milliseconds (basic RFC communication
time included). But if you expect
that each of the 4 calls takes 5 seconds, parallel processing
can result in around 5 seconds whereas serial processing will take 20
seconds.
The exact figures depend on various environment
parameters so that it is a good strategy to compare the run times
with and without parallel processing, using realistic data,
and then
to decide whether or not to use the pallelizing option.
If you
have a large number of calls, for example 500 calls, the Open
Call interface automatically divides the whole bundle into several
packages which are then processed in parallel. This is done in order to
reduce the parallelization overhead while still processing most
calls in parallel.
You may set a particular package size with Call
bundledRequests -parallelProcessing packageSize=n
With n=1 each call is processed separately, and with n higher
than the total number of calls the processing is done serially.
Normally it will not be necessary to specify a package size
explicitely.
The bundling and parallel processing does not
require any adaptation of the function modules that you call up. You
may use and mix up BAPIs, your own funtion modules, /GUIXT/DBSELECT
or any other function module.
Example We implement a cockpit type application in
"SAP Fiori" style:
The user may click on one of the tiles in order to start the
corresponding application. For example we call up transaction IW30 (List of
notifications) and enter the selection citeria corresponding to the
selected tile via an InputScript:
If we expect that the determination of some of the tile figures can
take a couple of seconds, it makes sense to execute the "tile
value" calls in parallel. The technique is shown in the following
InputScript "refresh_cockpit.txt".
In this demo example we determine the tile figures via the
function /GUIXT/DBSELECT, but in your own application you may use any
function modules (BAPIs or your own ones) and have them processed in
parallel.
We here also include the GuiXT script and the images needed in the example so that you can use
them as a starting point for you own Fiori
style cockpit application. All files are contained in this zip file.
Image files
GuiXT Script
GuiXT
// create tile data
if not V[PM_cockpit_refresh]
Enter process="refresh_cockpit.txt"
Stop script
endif
Offset (1,1)
Box (0,0) (11,90) "PM Cockpit"
// tile 1
Offset (2,2)
ReadRow V[tile] table=V[pmtiles] key="outstanding"
include "generate_pmtile.txt"
// tile 2
Offset (2,24)
ReadRow V[tile] table=V[pmtiles] key="inwork"
include "generate_pmtile.txt"
// tile 3
Offset (2,46)
ReadRow V[tile] table=V[pmtiles] key="urgent"
include "generate_pmtile.txt"
// tile 4
Offset (2,68)
ReadRow V[tile] table=V[pmtiles] key="unassigned"
include "generate_pmtile.txt"
// "Refresh" button
Offset (10,2)
Pushbutton (0,2) "Refresh" process="refresh_cockpit.txt" size=(2,12)
// "Refreh" time
Text (1,17) "Last refresh: &V[PM_cockpit_refresh]"
InputScript
"generate_pmtile.txt"
GuiXT
// we assume that the data for the tile display
// is contained in the structured variable V[tile]:
//
// "image" is the image file for the tile, white backgound
// "value" is the number to be shown on the tile
// "valuecolor" is the color in which the number is shown
// "link" is the action to be executed when the user clicks the tile
Image (0,1) (7,21) "&V[tile.image]" -plain -noStretch _
input="&V[tile.link]"
// calculate offset for right-aligned value output
Set V[offset] "&V[tile.value]" -charCount
Set V[offset] &V[offset] * 19
Set V[offset] 104 - &V[offset]
// display value
Image (3,5) (5,21) "white.res" -plain _
textstring="&V[tile.value]" textHeight=48 textWeight=8 _
textFont="Calibri" textColor="&V[tile.valuecolor]" _
textArea=(&V[offset],0) _
input="&V[tile.link]"
InputScript
"refresh_cockpit.txt" GuiXT
// Set refresh time
Set V[PM_cockpit_refresh] "&V[today_h:m]h"
// create structure and table for tile display
CreateStructure V[tile] id image link value valuecolor
CreateTable V[pmtiles] include="V[tile]"
// Determine value for tile 1
Set V[tablename] "QMEL"
Set V[condition] "qmart like 'M%' and qmdab = '00000000' "
Call "/GUIXT/DBSELECT" -bundle _
export.table="tablename" _
export.condition="condition" _
import.reccount="pmcount"
// Determine value for tile 2
Set V[tablename] "QMEL"
Set V[condition] "qmart like 'M%' and qmdab = '00000000' and aufnr ne '' "
Call "/GUIXT/DBSELECT" -bundle _
export.table="tablename" _
export.condition="condition" _
import.reccount="pmcount"
// Determine value for tile 3
Set V[tablename] "QMEL"
Set V[condition] "qmart like 'M%' and qmdab = '00000000' and priok in ('1','2') "
Call "/GUIXT/DBSELECT" -bundle _
export.table="tablename" _
export.condition="condition" _
import.reccount="pmcount"
// Determine value for tile 4
Set V[tablename] "AUFK join JEST on jest~objnr = aufk~objnr"
Set V[condition] _
"aufk~auart like 'PM%' and jest~stat = 'I0002' and jest~inact ne 'X' "
CreateTable V[values] wa
Call "/GUIXT/DBSELECT" -bundle _
export.table="tablename" _
export.condition="condition" _
import.reccount="pmcount"
// process all requests
Call bundledRequests -parallelProcessing
// import data and build up tiles
// Tile 1
Call importFromBundle=1
Set V[tile.id] "outstanding"
Set V[tile.image] "pmtile.outstanding.png"
Set V[tile.link] "OK:IW30,process=outstanding_notifications.txt"
Set V[tile.value] "&V[pmcount]"
Set V[tile.valuecolor] "RGB(0,50,200)"
AppendRow V[tile] table=V[pmtiles]
// Tile 2
Call importFromBundle=2
Set V[tile.id] "inwork"
Set V[tile.image] "pmtile.inwork.png"
Set V[tile.link] "OK:IW30,process=active_notifications.txt"
Set V[tile.value] "&V[pmcount]"
Set V[tile.valuecolor] "RGB(0,128,0)"
AppendRow V[tile] table=V[pmtiles]
// Tile 3
Call importFromBundle=3
Set V[tile.id] "urgent"
Set V[tile.image] "pmtile.urgent.png"
Set V[tile.link] "OK:IW30,process=urgent_notifications.txt"
Set V[tile.value] "&V[pmcount]"
Set V[tile.valuecolor] "RGB(255,128,64)"
AppendRow V[tile] table=V[pmtiles]
// Tile 4
Call importFromBundle=4
Set V[tile.id] "unassigned"
Set V[tile.image] "pmtile.unassigned.png"
Set V[tile.link] "OK:IW38,process=unassigned_workorders.txt"
Set V[tile.value] "&V[pmcount]"
Set V[tile.valuecolor] "RGB(100,100,100)"
AppendRow V[tile] table=V[pmtiles]
// no application action on this screen
Enter "?"