Unmodified SAP screen, transaction VA03

   Transaction with field "Total Items"

This example shows how to use Return in combination with Process to display the total number of items in an order on the order display screen (VA03). The script is automatically called when the screen is loaded.

GuiXT
Process items_total = count_items_db "&F[RV45A-TXT_VBELN]"
InputField (11,40) "Total Items" (11,58) size=8 name="items_total" _
    -numerical -alignRight -readOnly

count_items_db.txt

Parameter pOrd

if V[pOrd=]
  Message "E: No order number given!" -statusline
  Return
endif

// add leading zeros, length 10
Set V[ord](1-10) "0000000000&V[pOrd]" -alignRight

CreateTable V[amount] amount

// create SQL parameters
Set V[table] "VBAP"
Set V[fields] "SUM( KWMENG )"
Set V[condition] "VBELN = '&V[ord]'"
Set V[groupby] "VBELN"

// execute database Select
Call "/guixt/dbselect" _
  export.table="table" _
  export.fields="fields" _
  export.condition="condition" _
  export.groupby="groupby" _
  import.values="amount"

Return "&V[amount.amount.1]"