Skip to Content
author's profile photo Former Member
Former Member

LINEEDIT in table view

Hi,

I need to display a table view with 6 non editable columns and 4 editable columns in which user can enter data. I am using selection mode as LINEEDIT and created a class for the Iterator which implements the interface IF_HTMLB_TABLEVIEW_ITERATOR. In that custom class implemented the method method IF_HTMLB_TABLEVIEW_ITERATORGET_COLUMN_DEFINITIONS with related table view columns and method IF_HTMLB_TABLEVIEW_ITERATORRENDER_ROW_START with the following code.

method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_ROW_START.

m_row_ref ?= p_row_data_ref.

endmethod.

While implementing the method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START, I am using the following code

CASE p_column_key.

WHEN 'MATNR'.

IF p_edit_mode IS NOT INITIAL.

DATA: if_first1 TYPE REF TO CL_HTMLB_INPUTFIELD.

if_first1 = CL_HTMLB_INPUTFIELD=>FACTORY( id = p_cell_id

type = 'STRING').

if_first1->VALUE = m_row_ref->MATNR.

ENDIF.

ENDCASE.

And I am getting the following Error.

"M_ROW_REF->MATNR" is not a character constant.

I created the a class attribute M_ROW_REF with the table type which I am using in the table view.

Any Help?

Add a comment
10|10000 characters needed characters exceeded

Related questions

6 Answers

  • Posted on Nov 28, 2005 at 01:57 PM

    Check how you have declared you attribute M_ROW_REF

    It should be a <b>Type Ref To</b>.

    Example:

    M_ROW_REF Instance Attribute Private Type Ref To SFLIGHT

    Otherwise I don't really see a problem with the coding itself.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 29, 2005 at 03:56 AM

    Hi Thomas,

    I am using Type Ref To only. Still I am getting problem. I want to display an internal table say itab which will be returned by a Function Module. The type of itab returned by FM is a structure. I created a table type for that structure and created attribute M_ROW_REF Type Ref To that Ztabletype. Is that causing any problem? If it is so, guide me how to handle that. Thanks.....

    Add a comment
    10|10000 characters needed characters exceeded

    • Don't do TYPE REF TO ZTABLETYPE, do TYPE REF TO Structure that represents one line of the table type.

      You are setting the reference as each row is processed. In essecence, this is your workarea as you loop through the table.

      Notice in my example above, I am declaring my data_ref as SFLIGHT (the flat structure) not T_SFLIGHT (a table type actually used for the internal table).

  • author's profile photo Former Member
    Former Member
    Posted on Nov 29, 2005 at 06:47 AM

    hi,

    Prior to this: if_first1->VALUE = m_row_ref->MATNR

    just declarea and assign:

    data: abc type string.

    abc = m_row_ref->MATNR.

    and now use : if_first1->VALUE = abc.

    i have also this same problem what i understood(might be correct) is m_row_ref->MATNR returns a data object.

    Also declare,

    M_ROW_REF Type Ref To <structure of itab>.

    since in table type we dont have a header line so we donot have colume name.

    and we need header line to refer to them.

    regards,

    Hemendra

    Add a comment
    10|10000 characters needed characters exceeded

    • >data: abc type string.

      abc = m_row_ref->MATNR.

      and now use : if_first1->VALUE = abc.

      You shouldn't have to reassign the value to a new variable. I have examples that work directly against the m_row_ref. The problem here appears to be the TYPE REF TO pointing to the table type and not the structure.

  • author's profile photo Former Member
    Former Member
    Posted on Nov 29, 2005 at 12:54 PM

    Hi Hemendra & Thomas,

    Thanks for help. It's working fine now. But in those editable cells of the table it's displaying &nbsp;.

    But I can clear that and enter data. Is there anyway to clear that in all editable cells? And also I want to copy the data entered by the user into some other internal table. Say the table itab1 I am displaying with 8 columns out of which 4 are editable. I want to capture the 5 columns data 1 non editable column and 4 editable columns data into another table itab2. Can I do this directly by looping at itab1 and copying the corresponding fields into itab2?

    Add a comment
    10|10000 characters needed characters exceeded

    • >Can I do this directly by looping at itab1 and copying the corresponding fields into itab2?

      Sure once you get your input data back into Itab1. You either need to restore this manually from the form fields or use model binding for your tableView. I prefer model binding.

      If you bind to the data table during the definition of the tableView:

          <htmlb:tableView id            = "matdocs_output"
                           selectionMode = "NONE"
                           footerVisible = "false"
                           headerVisible = "TRUE"
                           headerText    = "<OTR>Please Choose Items to Print</OTR>"
                           iterator      = "<%= matdoc_iterator %>"
                           table         = "//model/matdoc_output" />

      Then in your iterator you can create the input field from the binding string itself. You can actually avoid even creating the data reference to the row.

       data: input1 type ref to cl_htmlb_inputfield.
            create object input1.
            input1->id     = p_cell_id.
            input1->_value = p_cell_binding.
            p_replacement_bee = input1.

      Since this uses data binding the input from the inputField will automatically be restored back into the proper place in the internal table for you.

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2005 at 07:04 AM

    Hi Thomas,

    I am trying to Retrieve the editable values of itab1 manually using request->get_form_field. But I am not able to get those values. I am not familiar with binding. Can please explain how to do that manually?

    And also I am displaying one column in a table view with the ICONS. The code explained by Brian using Iterator class is working fine, but it displays same ICON in all rows. My requirement is to display different ICONS in different rows of same column. DO I need to write any code in method RENDER_ROW_START in Iterator class?

    Thanks for help..

    Add a comment
    10|10000 characters needed characters exceeded

    • for using request->get_form_field you need to use the right id of the column.

      the id strucutre of the tableview column will be

      <tablviewid>_<row no.>_<column no>

      for example if your table view id is TV1 and you want to read the 3rdrow 2nd columen the form field id will be

      TV1_3_2

      Hope this helps.

      Regards

      Raja

  • author's profile photo Former Member
    Former Member
    Posted on Dec 06, 2005 at 11:33 AM

    Hi Raja,

    The Logic <tablviewid>_<row no.>_<column no> will work only if the number of rows is fixed. But if no. of rows is unknown how to retrieve the values from the table view ?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.