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

// Prepare parameters for reading the text table

// we join the check table "T024L" and the text table "T024X"
Set V[table] "T024L left outer join T024X on T024X~LABOR = T024L~LABOR and T024X~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] "T024L~LABOR, COALESCE( T024X~LBTXT | T024L~LABOR ) as F2"

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