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

Iterator & column types

Hi,

I'm using a tableview and iterator for the user to enter values. The table has 2 columns of type BSTMG(QUAN,13,3) and BEINHNET(DEC,15,9).

In the tableview, these columns display values in the format 0,000/0,000000000 (with commas). When I try to retrieve these values in my do_handle_event with -

ls_quantity = request->get_form_field(

name = ls_formFld ).

I get a short dump due to type mismatch.

I thought of rendering the cell values in the method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START, however, I'm not sure how I should define the type.

I tried

WHEN 'ITEM_COST'.

IF p_edit_mode IS NOT INITIAL.

DATA: cost TYPE BEINHNET.

cost = m_row_ref->ITEM_COST.

p_replacement_bee = CL_HTMLB_INPUTFIELD=>FACTORY(

id = p_cell_id

value = cost

type = 'BCD'

cellValue = 'TRUE' ).

But I get an error "cost" is not compatible with formal parameter value.

Could someone please let me know how I should define the cell rendering for these 2 types?

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Feb 11, 2005 at 07:55 AM

    Hi Vivek,

    I had a similar problem where I used the quan type and so when my users wanted to edit the quantity they suddenly got values like this: 00000000001.000. Of course, this is not acceptable. Fortunately I always use a model with getter and setter methods. These methods are great to do any type of conversion you need.

    Enough rambling back to your problem 😊

    The parameter value of the factory method only accepts the type string. So you have to define your cost variable as type string:

    data cost type string.
     cost = m_row_ref->ITEM_COST.

    Have fun

    Thomas

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 11, 2005 at 10:15 AM

    Thanks Thomas. I changed the type to string and now values are with a dot (as per my user profile) instead of comma and I dont get the short dump.

    CASE p_column_key.

    WHEN 'QUANTITY'.

    IF p_edit_mode IS NOT INITIAL.

    DATA: qty TYPE string.

    qty = m_row_ref->QUANTITY.

    p_replacement_bee = CL_HTMLB_INPUTFIELD=>FACTORY(

    id = p_cell_id

    value = qty

    type = 'string'

    cellValue = 'TRUE' ).

    ENDIF.

    WHEN 'ITEM_COST'.

    IF p_edit_mode IS NOT INITIAL.

    DATA: cost TYPE string.

    cost = m_row_ref->ITEM_COST.

    p_replacement_bee = CL_HTMLB_INPUTFIELD=>FACTORY(

    id = p_cell_id

    value = cost

    type = 'string'

    cellValue = 'TRUE' ).

    ENDIF.

    ENDCASE.

    However, initially on loading the page I still get the default values 0,000/0,000000000 and on editing the values i get it in the format n.nnn/n.nnnnnnnnn.

    I regret not using te model but it's too late to go back to that now 😔

    Add a comment
    10|10000 characters needed characters exceeded

    • Don't get me wrong it not always the best way to use the modelbinding especially when you are using a 620 system and have to create all these boring meta-getter methods 😉

      In my opinion you only need to write a simple replace command to replace the comma with a dot. Something like this:

      DATA: qty TYPE string.
      qty = m_row_ref->QUANTITY.
      IF p_edit_mode IS INITIAL.
      REPLACE ALL OCCURRENCES OF ',' IN qty WITH '.'.
      ELSE. 
      p_replacement_bee = CL_HTMLB_INPUTFIELD=>FACTORY(
      id = p_cell_id
      value = qty
      type = 'string'
      cellValue = 'TRUE' ).
      ENDIF.

      So when not editing the comma will be replaced with a dot.

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.