It is rather useful to be able to call a business object method in another system much like you can call an RFC in another system. How do we do that? Here's how...
Firstly, use transaction BD97 to link the Logical system and the RFC together.
OPTION 1: Instance independent call to specified method.
In the receiving system (my example is SCM) perform the following steps:
Transaction: SWO1
Enter your Z object type. e.g. ZEH_DISP
Add method. eg. EHList (Attributes: Dialog, Synchronous, Instance-Independent)
Code: eg. call transaction '/SAPTRX/EH_LIST'.
In the sending system (my example is ECC) perform the following code:
data: w_handle type swo_objhnd.
it_container type table of swcont.
call function 'SWO_CREATE'
exporting
objtype = 'ZEH_DISP'
logical_system = 'SCM'
importing
object = w_handle
exceptions
no_remote_objects = 1
others = 2.
if sy-subrc <> 0.
message i001(z1) with 'No object created!'.
endif.
call function 'SWO_INVOKE'
exporting
object = w_handle
verb = 'EHList'
tables
container = it_container.
OPTION 2: Instance dependent call to specified method.
In the receiving system (my example is SCM) perform the following steps:
Transaction: SWO1
Enter your Z object type. e.g. ZEH_DISP
Add method. eg. DisplayEH (Attributes: Dialog, Synchronous)
Code: eg.
DATA : w_guid TYPE /saptrx/eh_hdr-eh_guid.
SELECT SINGLE eh_guid
FROM /saptrx/eh_hdr
INTO w_guid
WHERE ao_id = object-key.
CALL FUNCTION '/SAPTRX/EH_DETAILS'
EXPORTING
i_guid = w_guid.
In the sending system (my example is ECC) perform the following code:
data: w_handle type swo_objhnd.
it_container type table of swcont.
call function 'SWO_CREATE'
exporting
objtype = 'ZEH_DISP'
objkey = '0350000001000010'
logical_system = 'SCM'
importing
object = w_handle
exceptions
no_remote_objects = 1
others = 2.
if sy-subrc <> 0.
message i001(z1) with 'No object created!'.
endif.
call function 'SWO_INVOKE'
exporting
object = w_handle
verb = 'DisplayEH'
tables
container = it_container.
OPTION 3: Instance dependent call to default method.
SWO1
Enter your Z object type. e.g. ZEH_DISP
Add method. eg. DisplayEH (Attributes: Dialog, Synchronous)
Code: eg.
DATA : w_guid TYPE /saptrx/eh_hdr-eh_guid.
SELECT SINGLE eh_guid
FROM /saptrx/eh_hdr
INTO w_guid
WHERE ao_id = object-key.
CALL FUNCTION '/SAPTRX/EH_DETAILS'
EXPORTING
i_guid = w_guid.
In the sending system (my example is ECC) perform the following code:
data: w_handle type swo_objhnd.
it_container type table of swcont.
call function 'SWO_CREATE'
exporting
objtype = 'ZEH_DISP'
objkey = '0350000001000010'
logical_system = 'SCM'
importing
object = w_handle
exceptions
no_remote_objects = 1
others = 2.
if sy-subrc <> 0.
message i001(z1) with 'No object created!'.
endif.
call function 'SWO_INVOKE'
exporting
object = w_handle
* verb = 'DisplayEH'
tables
container = it_container.
Comments