With InputAssistant you can create your own table control and integrate it into any SAP screen. It allows you to display additional data or to implement your own data entry table.

As an example we display plant specific purchasing data in the material display transaction MM03:


MM03 display material:
A new pushbutton "Display plant specific purchasing data" allows us to display additional plant specific data.

 


The table displays the amount on stock and additional purchasing information.

 

In our table control we may create any number of input and output columns, checkboxes and pushbuttons.

The table is defined with the key words Table and Column. Each table cell corresponds to a GuiXT variable: if "tabx" is the name of the table and "plant" a column name, the variable V[tabx.cell.plant.5] denotes the cell in row 5 of column "plant". In a similar manner there are standard variables for various table attributes such as the total number of rows, first visible row, or column width. See Table for details

// GuiXT Script
// Display plant specific purchasing data in transaction MM03

if
Q[Transaction=MM03]
 
Set V[matnr] "&F[RMMG1-MATNR]"
-upperCase

  // plant table to be displayed?
 
if V[matnr] and V[display_plants=X]

   
// material number changed since last plant table display? then read data again
   
if not V[matnr=&V[plants_matnr]]
     
Enter process="mm03plants\plants_read.txt"
     
Stop Script
 
  endif

    Table (3,1) (12,100) name="plants" _  
     
title="Plant specific purchasing data for material  &V[matnr] &V[mattext]" _
     
rows="&V[plants_count]" fixedColumns=
1

    Column "Plant" name="werks" size=6 -pushButton process="mm03plants\plants_select.txt"
 
  Column "On stock" name="avamount" size=8 -readOnly -alignRight
    Column
"Minimum" name="minbe" size=8 -readOnly -alignRight
    Column
"Maximum" name="mabst" size=8 -readOnly -alignRight
    Column
"Unit" name="meins" size=8 -readOnly
 
  Column "Automatic P." name="kautb" size=10 -readOnly -checkBox
 
  Column "Deliv.Days" name="plifz" size=10 -readOnly
 
  Column "PurchGroup" name="ekgrp" size=10 -readOnly
 
  Column "Origin" name="herkl" size=8 -readOnly
 
  Column "ProfitCenter" name="prctr" size=16
-readonly

    Pushbutton (3,101) "X" process="mm03plants\plants_off.txt" size=(1,2)

    // refresh data on Enter
   
On Enter process="mm03plants\plants_read.txt"

  else

    Pushbutton (3,0) "Display plant specific purchasing data" process="mm03plants\plants_read.txt"

  endif
endif

 

The additional data shown in the table are read using the following function modules:

  • BAPI_MATERIAL_GET_DETAIL
  • BAPI_MATERIAL_GET_ALL
  • BAPI_MATERIAL_AVAILABILITY
  • /GUIXT/EXT2INT
  • /GUIXT/DBSELECT

The first three are standard SAP modules.  /GUIXT/DBSELECT is documented here. /GUIXT/EXT2INT is used to convert from external into internal format. In is contained in the same package as /GUIXT/DBSELECT.

/ InputScript "plants_read.txt"
// material number
Set V[matnr] "&F[RMMG1-MATNR]" -upperCase

// convert to internal format
Call "/GUIXT/ext2int" in.extvalue="&V[matnr]" in.domname="MATNR" out.intvalue="matnr_int"

// save material number in additional field
Set
V[plants_matnr] "&F[RMMG1-MATNR]" -uppercase

// Read material data
Call
"BAPI_MATERIAL_GET_DETAIL" in.MATERIAL="&V[matnr_int]" out.MATERIAL_GENERAL_DATA="matdata"

// Text and unit
Set
V[mattext] "&V[matdata](BAPIMATDOA-MATL_DESC)"
Set
V[matunit] "&V[matdata](BAPIMATDOA-BASE_UOM)"

// read SAP database plant table MARC
Call
"/GUIXT/dbselect" in.table="MARC" _
 
in.condition="MATNR = @MATNR" _
 
in.fields="WERKS" _
 
in.domname1="MATNR" _
 
in.domvalue1="&V[matnr]" _
 
table.values="data"

// reset table
Set
V[plants.*] ""

// number of plants read
Set
V[plants_count] 0

Set V[i] 1

label next_plant
CopyText
fromText="data" toString="datarow" line=&V[i]

if Q[ok]
 
Set V[plant] "&V[datarow]"
   Set V[plants.cell.werks.&V[i]] "&V[plant]"

  // read additional plant data
 
Call "BAPI_MATERIAL_GET_ALL" in.MATERIAL="&V[matnr_int]" in.PLANT="&V[plant]" _
   
out.PLANTDATA=
"plantdata"

  Set V[plants.cell.ekgrp.&V[i]] "&V[plantdata](BAPI_MARC_GA-PUR_GROUP)"
 
Set V[plants.cell.prctr.&V[i]] "&V[plantdata](BAPI_MARC_GA-PROFIT_CTR)"
 
Set V[plants.cell.kautb.&V[i]] "&V[plantdata](BAPI_MARC_GA-AUTO_P_ORD)"
 
Set V[plants.cell.meins.&V[i]] "&V[matunit]"
 
Set V[plants.cell.plifz.&V[i]] "&V[plantdata](BAPI_MARC_GA-PLND_DELRY)" -unpack

  // Minimum
 
Set V[minbe] "&V[plantdata](BAPI_MARC_GA-REORDER_PT)" -unpack
 
Set V[minbe] &V[minbe] / 1000

  if V[minbe=0]
   
Set V[minbe] ""
 
endif

  Set V[plants.cell.minbe.&V[i]] &V[minbe]

  // Maximum
 
Set V[mabst] "&V[plantdata](BAPI_MARC_GA-MAX_STOCK)" -unpack
 
Set V[mabst] &V[mabst] / 1000

  if V[mabst=0]
   
Set V[mabst] ""
    endif

  Set V[plants.cell.mabst.&V[i]] &V[mabst]

  // country
 
Set V[plants.cell.herkl.&V[i]] "&V[plantdata](BAPI_MARC_GA-COUNTRYORI)"

  // available amount in this plant
 
Call "BAPI_MATERIAL_AVAILABILITY" in.MATERIAL="&V[matnr_int]" in.PLANT="&V[plant]" 
     in.
UNIT="&V[matunit]" out.AV_QTY_PLT="avamount"

  Set V[plants.cell.avamount.&V[i]] &V[avamount] / 1000

  // total number of plants for this material
 
Set V[plants_count] &V[i]

  // next data row
 
Set V[i] &V[i] + 1

  goto next_plant

endif

if V[plants_count>0]
 
Set V[display_plants] "X"
else
 
Message "E: No plant data available" -statusline
endif

Return

In order to hide the table we use the following InputScript:

// InputScript "plants_off.txt"

Set V[display_plants] ""
Set
V[plant_matnr] ""
Return

 

In our example the user may click on one of the "plant" buttons in order to display the MM03 purchasing information for the plant selected. For example, a click on  displays the following MM03 screen:

Transaction MM03, display purchasing data for the plant selected

This is implemented in the Inputscript "plants_select.txt" invoked by the pushbutton:

 Column "Werk" name="werks" size=6 -pushButton process="mm03plants\plants_select.txt"

 In order to obtain the plant selected we use the system variable V[_tabrowabs]:

// InputScript "plants_select.txt"
// Display data for selected plant in MM03
Enter "/5"

// delete current view selection
Screen
SAPLMGMM.0070
  Enter "/19"

// Select first material view
Screen
SAPLMGMM.0070
 
Set cell[Table,0,1] "X"
 
Enter

// to tab Purchasing
Screen
SAPLMGMM.4004
 
Enter "=SP09"

// Set plant in organizational popup
Screen
SAPLMGMM.0081
 
 Set F[RMMG1-WERKS] "&V[plants.cell.werks.&V[_tabrowabs]]"
 
Enter

 

You can download the corresponding scripts here: mm03plants_e.zip