Skip to Content
0
Former Member
Oct 15, 2007 at 06:47 AM

MVC: Get Userinput from Tableview

13 Views

Hi there

Maybe somebody can help me out here... I'm really stuck ๐Ÿ˜‰

Trying to get into MVC and made a sample application (stateful), where a table view shows Table SFLIGHT, where the user can select a record and change some fields.

Now, the problem I have is, to figure out, what changes the user made in the line.

Here's the View:

<htmlb:tableView id = "tbl1"

visibleRowCount = "10"

selectionMode = "LINEEDIT"

table = "//vmodel/T_SFLIGHT"

iterator = "<%= ziterator %>"

keyColumn = "CARRID" />

Here's the part in the controller where I want to get the userinput:

METHOD do_handle_event.

*CALL METHOD SUPER->DO_HANDLE_EVENT

  • EXPORTING

  • EVENT =

  • HTMLB_EVENT =

  • HTMLB_EVENT_EX =

  • GLOBAL_MESSAGES =

  • RECEIVING

  • GLOBAL_EVENT =

  • .

  • BREAK-POINT.

    IF htmlb_event_ex->event_name = htmlb_events=>tableview AND

    htmlb_event_ex->event_type = htmlb_events=>tableview_rowselection.

    CASE htmlb_event->server_event.

    WHEN 'evnt_RowSelection'.

    DATA: l_r_tv TYPE REF TO cl_htmlb_tableview,

    l_r_tv_data TYPE REF TO cl_htmlb_event_tableview,

    l_r_event TYPE REF TO cl_htmlb_event,

    l_r_input TYPE REF TO cl_htmlb_inputfield,

    l_v_selrow TYPE selectedrows,

    l_v_value TYPE string.

    DATA: itab TYPE sflight_tab1,

    itab2 TYPE selectedrows.

    l_r_tv_data ?= htmlb_event_ex. "works fine

    l_r_tv ?= cl_htmlb_manager=>get_data(

    request = runtime->server->request

    name = 'tableView'

    id = 'tbl1' ).

    IF l_r_tv IS NOT INITIAL. "it's not initial, but seems to be empty

    l_r_tv_data = l_r_tv->data. " nothing comes back here

    CALL METHOD l_r_tv_data->get_rows_selected

    RECEIVING

    selected_rows = itab2.

    ENDIF.

    ENDCASE.

    ENDIF.

    ENDMETHOD.

    Just can't get any data back here...

    I tried to the following:

    l_r_tv_data->get_simple_data(

    exporting

    row_idx = 1

    col_name = 'FLDATE'

    changing

    data = l_v_value

    ).

    • CATCH CX_SY_CONVERSION_ERROR .

    Debugging the method:

    • Compute column index? ==> <input type="hidden" name="tv1_AllColumnNames" value="ICON/CARRID/CONNID/FLDATE/PRICE/CURRENCY/PLANETYPE/SEATS/">

    READ TABLE me->AllColumnNames TRANSPORTING NO FIELDS WITH KEY table_line = col_name.

    c = sy-tabix.

    • Read works fine ***

    DATA: ff_name TYPE STRING,

    ff_value TYPE STRING.

    CONCATENATE me->id `_` r `_` c INTO ff_name.

    CONDENSE ff_name NO-GAPS.

    • What I get here is a WRONG ff_name. Method assembles 'right_tbl1_1 4' but the actual field name in the page ist 'momaint_sflight[1].fldate' ****

    ff_value = me->request->get_form_field( name = ff_name ).

    • changing the value of ff_name to 'momain_t_sflight[1].fldate' before calling the method get_form_field, returns the proper input of the user.

    Ok, at least I've got the value now. But reading all the singel values and assembling something like momain_t_sflight[n].abcd for every field/entry

    is rather annoying.

    There must be a working method/way to get the whole record of userinput back or at least field by field....

    Any help apprecaited ๐Ÿ˜Š

    Thanks

    Gerald