In addition to the interface for custom class libraries, the guinet.dll also contains ready-made helper functions that can be called directly via CallVB — without having to create your own DLL first. A practical example is guinet.GridControl.GetSelectedRows: this function reads the selected rows of a SAP grid control and returns the desired column values as text.

As an example we add a "Display material" pushbutton to the transaction MM60 (Material List). The user selects a material in the table; clicking the pushbutton opens the transaction MM03 (Display Material) for the selected material:

First, the GuiXT script adds the new pushbutton to the toolbar of transaction MM60:

GuiXT
if Q[Transaction=MM60]
  Pushbutton (toolbar) "Display material" process="material_display.txt"
endif

To find out the technical field names of the table columns — such as MATNR for the material number — there are two ways:

  • SAP standard: Select the column, press F1, then click the hammer icon (Technical Information) — the technical field name is displayed there.

  • Script Editor Pro: Right-click in the code to open the context menu and choose GridView — all available column names and sample values of the current table are shown directly.

A detailed description of both methods can be found in the related tip.

The InputScript material_display.txt calls guinet.GridControl.GetSelectedRows directly via CallVB. The parameter colids:="MATNR" specifies which column to read. The result is stored internally under the name _grid_selected_values and then transferred to the variable gridval using CopyText:

GuiXT
CallVB guinet.GridControl.GetSelectedRows colids:="MATNR" delimiter:=" "
CopyText fromText="_grid_selected_values" toString="gridval"

if V[gridval=]
  Message "W: Please select a row" -statusline
  return
endif

Screen saplslvc_fullscreen.0500

  Enter "/OMM03" process="mm03_display_single.txt"
    using MATNR = "&V[gridval]"

If no row is selected, gridval is empty and the script displays a warning message in the status bar. Otherwise, transaction MM03 is opened in a new mode and the called InputScript mm03_display_single.txt fills the entry screen automatically:

GuiXT
Parameter MATNR

// initial screen of MM03
Screen saplmgmm.0060
  Set F[RMMG1-MATNR] "&V[MATNR]"
  Enter /5

// select a view
Screen saplmgmm.0070
  Set cell[Table,0,1] "X"
  Enter

The material number from the table is passed as the parameter MATNR to the script, entered in the input field of the MM03 entry screen, and the first view is selected automatically.

Download Grid Control scripts (ZIP)