ashish bhatt
ashish bhatt

Reputation: 3151

Listbox error "Entry is too long for the field"

After selecting a value in a dropdown listbox field, there is this error message:

Entry is too long for the field

(it's the message number 00092)

enter image description here

I created one text field TXTOPENV as Listbox with key value, set value using VRM_SET_VALUES in PBO section.

Here is the screenshot of screen painter:

screen painter listbox attributes

Screen flow logic:

PROCESS BEFORE OUTPUT.
  MODULE status_0210.

ABAP code:

DATA txtopenv TYPE c LENGTH 1.

MODULE status_0210 OUTPUT.
  SET PF-STATUS 'ST210'.
  SET TITLEBAR 'T210'.
  PERFORM GetVacancy.
ENDMODULE.

FORM GetVacancy.
  TYPES: BEGIN OF ty_vacancy,
           plans TYPE t528t-plans,
           plstx TYPE t528t-plstx,
         END OF ty_vacancy.
  DATA: wa_vacancy TYPE ty_vacancy.
  LOOP AT it_vacancyid INTO wa_vacancyid.
    SELECT plans plstx
      FROM t528t
      INTO wa_vacancy
      WHERE plans = wa_vacancyid-ty_objid.
    ENDSELECT.
    field_id = wa_vacancy-ty_plans.
    value = wa_vacancy-ty_plstx.
    APPEND value TO values.
    CLEAR wa_vacancy.
  ENDLOOP.

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id              = 'TXTOPENV'
      values          = values
    EXCEPTIONS
      id_illegal_name = 1
      OTHERS          = 2.
ENDFORM.

Upvotes: 0

Views: 2366

Answers (1)

Sandra Rossi
Sandra Rossi

Reputation: 13656

The error "Entry is too long for the field" is not specifically related to the listbox fields, but may occur with all types of screen fields, so I will first answer the general case, and then explain why you were mistaken .

The error happens when the screen field is defined with a "definition length" which is larger than the length defined for the eponym global variable in the ABAP program (eponym: the name has to be the same so that to allow the transfer of values between screen and program, back and forth), and when the input value is larger than the length of the ABAP program.

In your case, the key of the selected value in the listbox is probably larger than 1 character which is the length of the global variable.

The solution in your case is to set the variable to 8 characters:

DATA txtopenv TYPE t528t-plstx.

NB:

  • In your screenshot of the listbox field with possible values, only the texts are shown, but you can also display the key value via SAP GUI settings Interaction Design > Visualization 1 > Show keys within dropdown lists.

Upvotes: 1

Related Questions