﻿// create dropdownlist lgnum
// Create a GuiXT table variable for the dropdownlist
CreateTable V[ddltab_mm01_lgnum] key text

// Prepare parameters for reading the text table

// we join the check table "T300" and the text table "T300T"
Set V[table] "T300 left outer join T300T on T300T~LGNUM = T300~LGNUM and T300T~SPRAS = '&V[_language]'"

// we use an outer join together with the "coalesce" function
// in order to replace non-existing texts with the key value
Set V[fields] "T300~LGNUM, COALESCE( T300T~LNUMT | T300~LGNUM ) as F2"

// Read table via RFC call
Call /guixt/dbselect -bundle _
  export.table="table" _
  export.fields="fields" _
  import.values="ddltab_mm01_lgnum"
