Custom valuelist using enum on form

According to creating a valuelist with custom values, I have defined an enum. If I put it directly on the form it does not work, if I put it to the scope (globals) it works.

Why this does work:

i18n:TC_Rechnung_i18n|%%scopes.scope_chartering.DOCUMENT_TYPE.TC_INVOICE%%
i18n:TC_Gutschrift_i18n|%%scopes.scope_chartering.DOCUMENT_TYPE.TC_CREDIT_NOTE%%
i18n:Offhire_Rechnung_i18n|%%scopes.scope_chartering.DOCUMENT_TYPE.OFFHIRE_INVOICE%%
i18n:Offhire_Gutschrift_i18n|%%scopes.scope_chartering.DOCUMENT_TYPE.OFFHIRE_CREDIT_NOTE%%

and the following does not:

i18n:TC_Rechnung_i18n|%%DOCUMENT_TYPE.TC_INVOICE%%
i18n:TC_Gutschrift_i18n|%%DOCUMENT_TYPE.TC_CREDIT_NOTE%%
i18n:Offhire_Rechnung_i18n|%%DOCUMENT_TYPE.OFFHIRE_INVOICE%%
i18n:Offhire_Gutschrift_i18n|%%DOCUMENT_TYPE.OFFHIRE_CREDIT_NOTE%%

The second approach gives this error message:

Setting dataprovider with name 'btyp', type 'INTEGER' with value of wrong type '%%DOCUMENT_TYPE.TC_CREDIT_NOTE%%'
 > java.lang.IllegalArgumentException: Setting dataprovider with name 'btyp', type 'INTEGER' with value of wrong type '%%DOCUMENT_TYPE.TC_CREDIT_NOTE%%'

no it must be an enum from a scope (globals scope)
so only your first thing works
What does you second thing mean? Where is that DOCUMENT_TYPE ? is that a form variable?
That never works because a valuelist has nothing todo with a form. Its in the data layer not the ui layer. It has no idea on which form (it can be used on more then one) it is being used.

jcompagner:
no it must be an enum from a scope (globals scope)
so only your first thing works
What does you second thing mean? Where is that DOCUMENT_TYPE ? is that a form variable?

Yes it’s a form variable.

jcompagner:
That never works because a valuelist has nothing todo with a form. … It has no idea on which form (it can be used on more then one) it is being used.

But why has a valuelist no scope /(modul) global scope? If I need a valuelist only on a form, it makes sense to have it not in the gloabal scope. As a workaround, it’s possible to create programmatically a valuelist on a form?

jcompagner:
Its in the data layer not the ui layer.

What does that mean? I create the valuelist at design time, but the values relates to the data layer?

tables, valuelists, relations (and that foundset/entites on that) all that stuff is data layer they dont have access to ui (so forms)
forms have access to the datalayer, not the other way around.

A valuelist has no idea of a form. The only glue between them are he (global) scopes.

In the solution explore tree you can also see that valuelist are at the top level, if you wanted to have a valuelist that is really only there for a form it should have shown up only under that node in a valuelist node of that form node.
But we don’t have that.
Relations are the same, you also can’t use form variables in relations because relations are also not aware of forms.