on 10-30-2012 2:14 PM
Hi,
I am trying to change the attribute value by calling the method set_property_as_string().
here i am passing the value...
when i am clicking deletion button button on table list this property need to be updated with some status. Here i am facing the problem when first time i am clicking the button it is not updating the status...again when i am going back to that list record is available...if i click the button again this time updating the status...
below statement i have written in OCA event method.
lr_entity->set_property_as_string(
iv_attr_name = 'ZZSTATUS' iv_value = 'A' ).
my entity having the record, but field not getting updated after executing of the above statement.
anybody can help me on this.
Thanks,
Neelam
Hi Neelam,
Did you put the entity into change mode before setting the property ?
You can do it by using lr_entity->switch_to_change_mode( ).
You can also check with this statement if it is really in change mode and then proceed with setting the value.if lr_entity->is_changeable( ) = abap_true.
Regards
Vinod
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vinod,
Thanks for you reply, i tried your statement, still it is not updaing the status.
below code i have written.
lr_customer_h_ent->switch_to_change_mode( ).
if lr_customer_h_ent->is_changeable( ) = abap_true.
lr_customer_h_ent->set_property_as_string( iv_attr_name = 'ZZ_status' iv_value = 'A' ).
endif.
here when i am executing the above statement is_changeable() .....is returning value abap_true = 'X' in debugging mode.
but still it is not updating the value.
when i open the same record second time and try to execute the code...second time it is updating the status.
i don't know where it is wrong.
pls provide some help.
Regards,
Neelam
Hi Neelam,
You will use publish_current method of the entity if still it is not working
then use modify method() of cl_crm_bol_core.
here is some piece of code which can help you for understanding.
--------------------------
DATA:
lr_btadminh TYPE REF TO cl_crm_bol_entity,
lr_btsubjectset TYPE REF TO cl_crm_bol_entity,
lr_btsubject TYPE REF TO cl_crm_bol_entity,
lr_core TYPE REF TO cl_crm_bol_core.
* get current BTSubject
lr_btsubject ?= me->typed_context->btsubject->collection_wrapper->get_current( ).
IF lr_btsubject IS BOUND.
* delete old BTSubject
* get parent (BTSubjectSet)
lr_btsubjectset ?= lr_btsubject->get_parent( ).
* delete it
lr_btsubject->delete( ).
me->typed_context->btsubject->collection_wrapper->remove( lr_btsubject ).
lr_core ?= cl_crm_bol_core=>get_instance( ).
lr_core->modify( ).
* create new BTSubject and append it
lr_btsubject ?= lr_btsubjectset->create_related_entity( 'BTSubjectAll' )."#EC NOTEXT
me->typed_context->btsubject->collection_wrapper->add( iv_entity = lr_btsubject iv_set_focus = abap_true ).
ENDIF.
* get BTAdminH
lr_btadminh ?= me->typed_context->btadminh->collection_wrapper->get_current( ).
CHECK lr_btadminh IS BOUND.
* read dependant objects again
me->typed_context->btbosset->on_new_focus( lr_btadminh ).
-----------------------------------
Hope it will help you .
BR
Durga Prasad
Hi Durga prasad,
thanks for reply,
actually when i am calling set_property_as_string() method to set the new value for status field ....it is not setting the status....
in debug mode after execution of the statement if i check the status, same old status only showing.
but when i open the same record again 2nd time it is updating the status from same method...
i don't know where i am wrong.
help me on this.
Regards,
Neelam
Hi Neelam,
Please check the value ZZSTATUS of the status in getter method it should be alphabet like 'U' 'S' as you are updating it with 'A'. if not please check you status key values
Otherwise check this yes this is data refresh issue you updated the status but it is not reflecting in the entity since you need to publish_current() method with will refresh the current data from buffer to the entity and is still you will face the same issue then use modify() method this will refresh the root entity some time it might be the issue.
But above all please
Please check with those method and let me know if you need more help.
BR
// Durga Prasad
Hi Durgaprasad,
thanks for reply,
here i am updating the field from Child relation entity level. so i can't see the get method for this attribute.
below is my code:
lr_current->get_properties( IMPORTING es_attributes = ls_inthist ).
lr_inthist = lr_core->get_root_entity( iv_object_name = 'BTOrder'
iv_object_guid = ls_inthist-guid ).
lr_customer_h_coll ?= lr_inthist->get_related_entities_by_bpath( iv_bpath_statement = './BTOrderHeader/BTHeaderCustExt/*' ).
lr_customer_h_ent ?= lr_customer_h_coll->get_current( ).
if lr_customer_h_ent is bound.
lr_customer_h_ent->set_property_as_string( iv_attr_name = 'ZZ_status' iv_value = 'A' ).
here above statement not changing the attribute value.
But when i coming back from overview page to result list page and again go to overview page and try to set the attribute when clicking on oca button this time with same record if i try to set it...the same above method is updating the status. i don't know why this behaviour...every record i am able to change the status only 2nd time,
Pls help me on this.
Thanks,
Neelam
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
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.