Purpose Bundle multiple requests into one (BAPI_EQUI_GETDETAIL)
The Open Call Interface supports the bundling of multiple
requests into one. This makes sense if you need to execute numerous
independent requests each of which does not take much time compared
to the RFC communication time. For example, if the RFC overhead
is 5ms and the actual call time is 3ms, 1000 calls will need 8
seconds in the non-bundled case and 3 seconds when you bundle the
calls. If a user is connected via internet, a single RFC
communication may very well be 30 ms, resulting in 30 seconds for
non-bundled calls and 3 seconds with bundling.
Example The user enters a planner group (plant
maintenance). We display
all equipment items assigned to the given planner group, showing detailed
information for each item.
The BAPI we want to use
is "BAPI_EQUI_GETDETAIL". It is called up for a single equipment
item but
cannot handle a list of equipment items; we need one call for each
equipment item in the list and want to bundle them into a single remote call.
// create structure and table for display
CreateStructure V[equipmentinfo] _
descript acquisval currency start_from costcenter
CreateTable V[equipments] equnr include=V[equipmentinfo]
// create structures and tables for BAPI calls
CreateTable V[plannergroupselection] sign option low
CreateTable V[equipmentlist] equipment
// planner group selection
Set V[plannergroupselection.sign.1] "I" // include value
Set V[plannergroupselection.option.1] "EQ" // equal
Set V[plannergroupselection.low.1] "&V[ingrp]" // planner group
// read all equipment items for given planner group
Call "BAPI_EQUI_GETLIST" _
export.PLANGROUP_RA="plannergroupselection" _
import.EQUIPMENT_LIST="equipmentlist"
// read details for each item
Set V[k] 0
label next_equipment
if V[k<&V[equipmentlist.rowcount]]
Set V[k] &V[k] + 1
// fill table for display
Set V[equipments.equnr.&V[k]] "&V[equipmentlist.equipment.&V[k]]"
Set V[equnr] "&V[equipments.equnr.&V[k]]"
// bundle all detail request calls
Call "BAPI_EQUI_GETDETAIL" -bundle _
export.EQUIPMENT="equnr" _
import.DATA_GENERAL_EXP="equipmentinfo"
goto next_equipment
endif
// now we execute all requests
Call bundledRequests
// read results of the bundled calls
Set V[k] 0
label next_request
Set V[k] &V[k] + 1
Call importFromBundle=&V[k]
if Q[ok]
UpdateRow V[equipmentinfo] table="V[equipments]" index=&V[k]
goto next_request
endif
// delete all results
Call deleteBundledRequests
// done
Return