Purpose
Add leading zeros to a string if it is numeric, e.g. a customer number

For particular key fields SAP uses the "alpha" conversion exit; it adds leading zeros if the value is numeric, leaving the value unchanged if not.

Solution

//sample value
Set
V[kunnr] "A1240"   // or "1240"

if V[kunnr]

  // numeric? then add zeros
  Set V[x] "&V[kunnr]" regex="^\d+$"

  If Q[ok]
    Set V[kunnr](1-10) "0000000000&V[kunnr]" -alignRight
  endif

endif

Components
InputAssistant