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

  // Prepare parameters for reading the text table

  // we join the check table "T006" and the text table "T006A"
  Set V[table] "T006 left outer join T006A on T006A~MSEHI = T006~MSEHI and T006A~SPRAS = '&V[_language]'"
  Set V[condition] "T006~DIMID = 'MASS' and T006~MSEHI in ('G','KG') "

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

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