cancel
Showing results for 
Search instead for 
Did you mean: 

Field value vanishes from UI on changing its value

Former Member
0 Kudos

Hi Experts

I am trying to change a custom field in the SERVICE_H structure. The issue that i am facing is, the value is updated to the database but on the UI, the value does not appear i.e. the value for the field vanishes from the UI.

I have used the following code to change the field. Please let me know hwy this is not working whereas in a ideal situation, it is supposed to work properly.

     DATA: lr_transaction TYPE REF TO if_bol_transaction_context,

           lr_core TYPE REF TO cl_crm_bol_core,

           lr_root_ent TYPE REF TO cl_crm_bol_entity,

           lr_header_ent TYPE REF TO cl_crm_bol_entity,

           lr_service_ent TYPE REF TO cl_crm_bol_entity.

* Get the guid

     lr_comp ?= me->comp_controller.

     IF lr_comp IS BOUND.

       lr_adminh ?= lr_comp->typed_context->btadminh->collection_wrapper->get_current( ).

       IF  lr_adminh IS BOUND.

         lv_guid = lr_adminh->get_property_as_string( 'GUID' ).

       ENDIF.

     ENDIF.

     lr_core = cl_crm_bol_core=>get_instance( ).

     IF lr_core IS BOUND.

       lr_root_ent = lr_core->get_root_entity( iv_object_name = 'BTOrder' iv_object_guid = lv_guid ).

       IF lr_root_ent IS BOUND.

         lr_header_ent = lr_root_ent->get_related_entity( 'BTOrderHeader' ).

         IF lr_header_ent IS BOUND.

           lr_service_ent = lr_header_ent->get_related_entity( 'BTHeaderServiceExt' ).

           IF lr_service_ent IS BOUND.

             lr_service_ent->lock( ).

             IF lr_service_ent IS BOUND.

               lr_service_ent->if_bol_bo_property_access~set_property( iv_attr_name = 'ZZTICKSOUR' iv_value = 'E-Mail' ).

             ENDIF.

           ENDIF.

         ENDIF.

       ENDIF.

     ENDIF.

     lr_core->modify( ).

    

     lr_transaction = lr_root_ent->get_transaction( ).

     IF lr_transaction IS BOUND.

       IF lr_transaction->save( ) = abap_true.

         lr_transaction->commit( ).

       ELSE.

         lr_transaction->rollback( ).

       ENDIF.

     ENDIF.

By using this code, the transaction is getting committed and the value for the field ZZTICKSOUR is getting saved in the database but the value vanishes from the UI. On the UI, this field is empty.

I have written this code in the event EH_ON_SAVE which is triggered on saving the ticket and after my code i have called SUPER.

Please help me solve this problem.

Thanks and regards

Preeti Viswanath

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Preeti,

Please check the super method code whether they are performing any checks before saving the data . If if any check fails there might be the code to rollback .

I would suggest not to use transaction->commit statement in your code as the standard code will perform it ( may be after checking badi's and all).

If save is performed without errors , then place a breakpoint in GET_XXX method and check the value which is being retrieved from the relations. I assume you are using the same relations to fetch the value.

Regards,

Nithish

Former Member
0 Kudos

Hi Nithish

This kind of behaviour is happening only when I am modifying the custom fields. For the standard fields, my code is working fine.

Do you have any idea why this might be happening to the custom fields that we have added through AET.

As far as rollback is concerned, as per my analysis, rollback is not happening as the value is saved in the database. In scenario related to rollback, the value should not be saved to the database.

But here, the value is saved to the database and not appearing on the UI.

Your suggestions on this.

Regards

Preeti Viswanath

Former Member
0 Kudos

HI Preeti,

As you re using explicit commit before the super method , the changes would already been saved to database. So even in case there is an en error in super method , that doesn't reflect the roll back as you have already saved your data . That's the reason I suggested you to remove the commit and roll back statements in your code.Either way that is the good practice to commit the changes of the whole transaction once all the checks are done.

Coming to your issue have you checked the GET_ZZTICKSOUR method after save is clicked and where is this field shown in configuration. Is this directly shown under context node related to SERVICE_H or you have added the field in some table through the relation to other parent context node ?

Regards,

Nithish

Former Member
0 Kudos

Hello Nitish ,

  I had the same problem , and i had made use of BY_PASSING_BUFFER Concept .. so is this helpfull in this case ?

Thanks and Regards,

Nikhil Kulkarni