Using SAP shortcuts to start transactions in other systems

If a user  works in more than one SAP system, it is often desirable to establish an easy link from a transaction in one system to a transaction in a second system,  passing key data from one to the other.

For our example, let us assume that the customer data is distributed over two SAP systems.  In one system the customer numbers are always 4 digits long and in the other system they consist of 10 digits.  The user want to work with an interface where he can simply enter a customer number, press a button, and then continue with the customer transaction in the chosen system.

There are different ways to achieve such an interface. We use a simple approach, combining GuiXT and SAP shortcuts. The implementation uses  InputAssistant and Viewer.

 

Sap Guixt shortcut01 Using SAP shortcuts to start transactions in other systems

This is the interface built with GuiXT. The user enters the customer number and presses the “Go” button. GuiXT then starts  transaction VD03 (Display customer data) in the right system, relaying the customer number. We can add this interface to any SAP screen. In our example it is placed on the main menu screen. 

It makes sense to have the interface in both systems, so that the user can start in either system. The InputScript “DisplayCustomer.txt”  therefore has to be slightly different in the two systems, or it can make use of an  “if Q[database=...]“  statement for its decision on where to call up transaction VD03.

The GuiXT script is as follows:

SAPLSMTR_NAVIGATION.E0100.txt:

// Display customer information interface
Box (0,0) (3,32) “Display customer data”
InputField (2,1) “Number” (2,10) Size=10 Name=”CustomerNumber” Techname=”RF02D-KUNNR” 
Pushbutton (1,26) “Go “   Process=”DisplayCustomer.txt” Size=”3″

// Shift SAP standard menu downwards 
pos [IMAGE_CONTAINER] (6,0)

The InptScript DisplayCustomer.txt first decides in which system the customer data can be found, based on the length of the customer number. If it is the same system, it starts transaction VD03 directly. If not, it calls up an SAP shortcut that starts VD03 in the other system. Since it is not possible to relay parameters via the shortcut, a temporary parameter file is used to transport the customer number to the second system.

Instead of looking at the length of the customer number, one can use an RFC that does the looking up of the customer in the R/3 database. If more than 2 systems are involved, you have to work with the Destination=… option in the GuiXT call statement in order to find the right system. For our example we assume there are only 2 systems, and that we can determine the right system merely by looking at the length of the customer number. 

// GuiXT InputScript DisplayCustomer.txt

// if length of customer number is > 4: use second SAP system (S4C)to display the data
Set V[CustomerNumberRightPart] “&V[CustomerNumber](5-10)”

if V[CustomerNumberRightPart]

  // Write customer number to parameter file (&%[TEMP] is the environment variable TEMP)
  Set V[TempFilename] “&%[TEMP]\GuiXTCustomerNumber.txt”
  OpenFile “&V[TempFilename]” “-Output”
  AppendFile “&V[TempFilename]” CustomerNumber
  CloseFile “&V[TempFilename]“ 

  // Start VD03 in system (S4C) via shortcut 
  View “vd03.sap”
  Leave
endif

// Start VD03 in same system
Screen saplsmtr_navigation.0100
Enter “/NVD03″

// First screen of VD03
Screen sapmf02d.7108
Set F[Customer] “&V[CustomerNumber]“

Leave

Sap Guixt shortcut02 Using SAP shortcuts to start transactions in other systems

 

The GuiXT script for VD03, initial screen, always reads the temporary parameter file and sets the customer number, if found:

// GuiXT Script SAPMF02D.E7108.txt

// Read customer number from parameter file
Set V[TempFilename] “&%[TEMP]\GuiXTCustomerNumber.txt”
OpenFile “&V[TempFilename]“ 
ReadFile “&V[TempFilename]” CustomerNumberFromFile
CloseFile “&V[TempFilename]“ 

if V[CustomerNumberFromFile]

  // delete parameter file 
  OpenFile “&V[TempFilename]” -Output
  CloseFile “&V[TempFilename]“

  Set F[Customer] “&V[CustomerNumberFromFile]“
endif

Finally, the SAP shortcut vd03.sap can be generated automatically in sapgui. Just go to the transaction and choose the pushbutton in the toolbar:

Sap Guixt shortcut04 Using SAP shortcuts to start transactions in other systems

It looks like this:

Sap Guixt shortcut03 Using SAP shortcuts to start transactions in other systems

 

 

Using SAP shortcuts to start transactions in other systems