Purpose Start a transaction in a different SAP system
If a
special function is available in an SAP system other than the
one where the users
normally are working, it makes sense to provide a quick link to a
transaction of the other SAP system (called "remote" system in the
following).
A similar situation
occurs if some business objects (e.g. older service orders) are no
longer available in the current but in a remote SAP system. In
this situation a possible solution is to read the data via a Remote Function Call and
display the data with GuiXT. Or you directly call up the
corresponding display transaction in the remote system, providing the
object key. This is the approach that we are going to describe here.
Solution
We use the SAP function module "RFC_CALL_TRANSACTION_USING" to call
up a transaction in the remote system. The object keys are passed
via a "batch Input" file.
We can use "RFC_CALL_TRANSACTION_USING" in the same SAP
session. In this case, the underlying screen, i.e. the transaction where
we start, remains locked until the user closes the transacion of the
remote SAP system ("modal dialog"). Or we call "RFC_CALL_TRANSACTION_USING" in a
new SAP GUI session, started with a /O.... command. In this case the
underlying screen will not become locked and the user can work independently
in both screens ("amodal dialog"). We will illustrate both possibilities in the following
example.
Example
We assume that some customer orders are available in a remote
SAP system. For this example we let the user enter the order
number in VA03; a button created with GuiXT then allows him to open up
VA03 in the remote SAP system, using the given order number.
GuiXT script:
GuiXT
// display customer order in our remote SAP ERP system
Pushbutton (2,73) _
"@QE@Display in remote SAP ERP" size=(1,30) _
process="va03_rfc.txt"
Clicking the "remote display" button the user immediately opens up
VA03 in the remote SAP system:
In this example we started in client 100 of the S/4HANA system S4H
and then display the order in client 800 of the SAP ERP system ABA. The
S4H screen remains locked until the user closes the ABA screen.
For the RFC call we can either work with a pre-defined RFC user in the
ABA system or we employ the same user as in S4H. In the latter case the
user's password needs to be the same in both systems, which might be an
argument in favour of a generic RFC user for the remote display.
The InputScript prepares "batch input" data for passing the order
number and skipping the first VA03 screen:
GuiXT
// Define SAP structure BCDDATA
// Alternative: use notation
// V[bdcline](BCDDATA-PROGRAM) etc.
Set V[partprogram] "(1-40)"
Set V[partdynpro] "(41-44)"
Set V[partdynpbegin] "(45-45)"
Set V[partfnam] "(46-177)"
Set V[partfval] "(178-209)"
// Batch Input data
Clear text[bdcdata]
// fill BatchInput data
Clear V[bdcline]
Set V[bdcline]&V[partprogram] "SAPMV45A"
Set V[bdcline]&V[partdynpro] "0102"
Set V[bdcline]&V[partdynpbegin] "X"
CopyText fromString="bdcline" toText="bdcdata" -appendLine
Clear V[bdcline]
Set V[bdcline]&V[partfnam] "VBAK-VBELN"
Set V[bdcline]&V[partfval] "&F[Order]"
CopyText fromString="bdcline" toText="bdcdata" -appendLine
Clear V[bdcline]
Set V[bdcline]&V[partfnam] "BDC_OKCODE"
Set V[bdcline]&V[partfval] "/0"
CopyText fromString="bdcline" toText="bdcdata" -appendLine
Call "RFC_CALL_TRANSACTION_USING" -dialog _
connection="ASHOST=/H/synactives10.com/H/XXX CLIENT=800 SYSNR=00" _
in.TCODE="VA03" _
in.MODE="E" _
table.BT_DATA="bdcdata"
Return
The alternative, a non-blocking call, does not differ much in the
implementation:
GuiXT script:
GuiXT
// display customer order in our remote SAP ERP system
Pushbutton (2,73) _
"@QE@Display in remote SAP ERP" "/o0" size=(1,30) _
process="va03_rfc.txt"
using OrderNumber = "[Order]"
InputScript:
GuiXT
Parameter OrderNumber
Screen SAPLSMTR_NAVIGATION.0100
// SAP structure BCDDATA
// Alternative: use notation
// V[bdcline](BCDDATA-PROGRAM) etc.
Set V[partprogram] "(1-40)"
Set V[partdynpro] "(41-44)"
Set V[partdynpbegin] "(45-45)"
Set V[partfnam] "(46-177)"
Set V[partfval] "(178-209)"
// Batch Input data
Clear text[bdcdata]
// fill BatchInput data
Clear V[bdcline]
Set V[bdcline]&V[partprogram] "SAPMV45A"
Set V[bdcline]&V[partdynpro] "0102"
Set V[bdcline]&V[partdynpbegin] "X"
CopyText fromString="bdcline" toText="bdcdata" -appendLine
Clear V[bdcline]
Set V[bdcline]&V[partfnam] "VBAK-VBELN"
Set V[bdcline]&V[partfval] "&U[OrderNumber]"
CopyText fromString="bdcline" toText="bdcdata" -appendLine
Clear V[bdcline]
Set V[bdcline]&V[partfnam] "BDC_OKCODE"
Set V[bdcline]&V[partfval] "/0"
CopyText fromString="bdcline" toText="bdcdata" -appendLine
Call "RFC_CALL_TRANSACTION_USING" -dialog _
connection="ASHOST=/H/synactives10.com/H/XXX CLIENT=800 SYSNR=00" _
in.TCODE="VA03" _
in.MODE="E" _
table.BT_DATA="bdcdata"
// end this mode after the call
Enter /i