Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

listbox dropdown value added as 0

Former Member
0 Likes
839

hi,

I have a few entries and a blank entry at the end of the listbox. The blank entry comes as a default. But when I choose the blank entry and save the record. Then in the display another entry with '0' is added to the listbox option to choose from.

Please advise why it is adding the '0' entry for the blank selection and how to remove it.

Thanks,

FS

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
777

Hi,

After capturing the value pass the value into temporary variable which is of char type.

Here is a sample code:

Layout code:

<htmlb:dropdownListBox id="estatus">
            <htmlb:listBoxItem key   = "select"
                               value = "Select" />        
                                 <htmlb:listBoxItem key   = "Active"
                               value = "Active" />
                                 <htmlb:listBoxItem key   = "Inactive"
                               value = "Inactive" />
                             
            <htmlb:listBoxItem key   = " "
                               value = " " />
          </htmlb:dropdownListBox>

          <htmlb:button id      = "clear"
                        tooltip = "Save the entries"
                        text    = "Save"
                        width   = "35%"
                        on Click = "OnI nputP rocessing()" />

OnInputProcessing Code:

data:
  w_event TYPE REF TO cl_htmlb_event,
  w_object TYPE REF TO object,
  w_eventid TYPE string,
  w_obj TYPE REF TO object,
 w_listbox TYPE REF TO cl_htmlb_dropdownlistbox.


CALL METHOD cl_htmlb_manager=>get_event
  EXPORTING
    request = runtime->server->request
  RECEIVING
    event   = w_event.

w_eventid = w_event->id.

CASE w_eventid.
  WHEN 'clear'.

 CALL METHOD cl_htmlb_manager=>get_data
          EXPORTING
            request = runtime->server->request
            name    = 'dropdownListBox'
            id      = 'estatus'
          RECEIVING
            data    = w_obj.
        w_listbox ?= w_obj.
        w_empvalue = w_listbox->selection.
w_value = w_empstatus.(W_value is a type of char)
endcase.

Hope this helps you,Let me know if any queries.

Regards,

Rajani

hi,

I have a few entries and a blank entry at the end of the listbox. The blank entry comes as a default. But when I choose the blank entry and save the record. Then in the display another entry with '0' is added to the listbox option to choose from.

Please advise why it is adding the '0' entry for the blank selection and how to remove it.

Thanks,

FS

5 REPLIES 5
Read only

Former Member
0 Likes
777

Make sure the field for which this list box has been created is of character type and not numeric

Read only

Former Member
0 Likes
777

Thanks for the hint. Actually it is CHAR type but still the value is getting added. Maybe check table is causing the issue. Please advise.

Read only

Former Member
0 Likes
778

Hi,

After capturing the value pass the value into temporary variable which is of char type.

Here is a sample code:

Layout code:

<htmlb:dropdownListBox id="estatus">
            <htmlb:listBoxItem key   = "select"
                               value = "Select" />        
                                 <htmlb:listBoxItem key   = "Active"
                               value = "Active" />
                                 <htmlb:listBoxItem key   = "Inactive"
                               value = "Inactive" />
                             
            <htmlb:listBoxItem key   = " "
                               value = " " />
          </htmlb:dropdownListBox>

          <htmlb:button id      = "clear"
                        tooltip = "Save the entries"
                        text    = "Save"
                        width   = "35%"
                        on Click = "OnI nputP rocessing()" />

OnInputProcessing Code:

data:
  w_event TYPE REF TO cl_htmlb_event,
  w_object TYPE REF TO object,
  w_eventid TYPE string,
  w_obj TYPE REF TO object,
 w_listbox TYPE REF TO cl_htmlb_dropdownlistbox.


CALL METHOD cl_htmlb_manager=>get_event
  EXPORTING
    request = runtime->server->request
  RECEIVING
    event   = w_event.

w_eventid = w_event->id.

CASE w_eventid.
  WHEN 'clear'.

 CALL METHOD cl_htmlb_manager=>get_data
          EXPORTING
            request = runtime->server->request
            name    = 'dropdownListBox'
            id      = 'estatus'
          RECEIVING
            data    = w_obj.
        w_listbox ?= w_obj.
        w_empvalue = w_listbox->selection.
w_value = w_empstatus.(W_value is a type of char)
endcase.

Hope this helps you,Let me know if any queries.

Regards,

Rajani

Read only

Former Member
0 Likes
777

Is domain of field is standard or custom ? Also, can you chek the value range tab of the domain.

Please let us know name of domain of the field.

Read only

Former Member
0 Likes
777

Thanks guys, Actually for my combobox I am simply reading values from the table and setting the values by

function.

CALL FUNCTION 'VRM_SET_VALUES'

Domain is a custom one and has no values in its value range.