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

How to modify lines in table view?

Hi,

I have custom table view.

I populate the table with a custom query:

query = cl_crm_bol_dquery_service=>get_instance( 'ZAPPLICANT_QUERY' ).

query->add_selection_param( iv_attr_name = 'OBJECT_ID'

iv_sign = 'I'

iv_option = 'EQ'

iv_low = lv_object_id

iv_high = '' ).

lr_coll ?= query->get_query_result( ).

IF lr_coll IS BOUND.

me->typed_context->applicant->collection_wrapper->add_collection( iv_collection = lr_coll ).
ENDIF.

When i try to modify some lines of the table and press enter, only the first line is updated correctly.

The fields of the other lines is read-only and not changeable.

How do I make "changeable" all the fields of my table?

Please help me.

Thanks,

Max

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on May 28, 2013 at 10:59 AM

    Hello to all,

    thank you for your replies.

    I solved my problem with following code added in SET method of all my fields:

    DATA: lr_entity TYPE REF TO cl_crm_bol_entity.


    IF iterator IS BOUND.
    current = iterator->get_current( ).
    lr_entity ?= current.
    IF lr_entity IS BOUND AND lr_entity->is_changeable( ) = abap_false.
    lr_entity->switch_to_change_mode( ).
    ENDIF.
    ELSE.
    current = collection_wrapper->get_current( ).
    lr_entity ?= current.
    IF lr_entity IS BOUND AND lr_entity->is_changeable( ) = abap_false.
    lr_entity->switch_to_change_mode( ).
    ENDIF.
    ENDIF.

    Now I set my entity changeable and I can set value of all fields.

    Thanks,

    Massimo

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 14, 2013 at 06:31 PM

    Hi Max,

    You might me locking only the first entity of the collection. You have to acquire lock on all the entities in the collection since here each entity is a root object.

    Thanks & Best Regards,

    Leon

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Massimo,

      To make all the table field editable, go to your html field of table view and set the tag attribute allRowsEditable = 'TRUE'.

      And while iterating through each entity and lock it and in the collection wrapper you should add lr_entity not lr_first.

      me->typed_context->applicant->collection_wrapper->add( iv_entity = lr_entity ).

  • author's profile photo Former Member
    Former Member
    Posted on May 16, 2013 at 11:24 AM

    Hi Massimo,

    To make all table fields editable.....

    Open htm page of table view and change <chtmlb:configTable /> tag attribute to

    allRowsEditable = "TRUE"

    To control editability redefine get_i method of the Atrributes in a Table View

    DATA:
    lv_curr TYPE sytabix,
    lv_last TYPE sytabix.


    rv_disabled = abap_true.
    lv_last = iterator->size( ).
    lv_curr = iterator->get_current_index( ).

    IF lv_last = lv_curr.
    rv_disabled = abap_false.

    ENDIF.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 19, 2013 at 12:53 PM

    Hi Massimo,

    Try in this way this may work for your scenario.

    First Redefine the SET_VIEW_GROUP_CONTEXT method and Initialize the variable VIEW_GROUP_CONTEXT.

    In your EDIT Code get the index of the row selected.

    lv_idx = me->typed_context->(your context node )->selected_index.

    Now get the entity basing on the index.

    lr_entity ?= me->typed_context->(your context node)->collection_wrapper->find( iv_index = lv_idx ).

    Now Check the Lock and make the View editable.

    If lr-entity->lock( ) = abap_true.

    View_group_context->set_view_editable( me ).

    endif.

    Thanks and Regards,

    DP.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 20, 2013 at 08:11 AM

    Hi Massimo,

    You can achieve this as follows,

    Add following line in .htm page of your view inside the configuration tag

    allRowsEditable = "TRUE"

    Now goto GET_I_XYZ and add this code there


    rv_disabled = abap_true.

    In case you want to set it based on some condition you can do that as well.

    Before doing all this LOCK your entity

    Regards,

    Pratheek

    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.