on 05-14-2013 5:40 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Leon,
thanks for you reply.
I tried to lock and switch to change mode all entities, but does not work:
lr_coll ?= query->get_query_result( ).
IF lr_coll IS BOUND.
lr_first = lr_coll->get_first( ).
WHILE lr_first IS BOUND.
lr_entity ?= lr_first.
IF lr_entity IS BOUND.
lr_entity->switch_to_change_mode( ).
lr_entity->lock( ).
ENDIF.
me->typed_context->applicant->collection_wrapper->add( iv_entity = lr_first ).
lr_first = lr_coll->get_next( ).
ENDWHILE.
ENDIF.
The entities are not changeable.
Thanks,
Max
Hello,
Two hints:
1.
lr_entity->switch_to_change_mode( ).
switch_to_change_mode returns a true / false - please have a look.
if you put to change mode, the entity is automatically locked.
2.
me->typed_context->applicant->collection_wrapper->add( iv_entity = lr_first )., here I think you should add lr_entity rather than lr_first.
Thanks
Krish
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 ).
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 ).
User | Count |
---|---|
8 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.