cancel
Showing results for 
Search instead for 
Did you mean: 

AET Generated field values are not saved.

Former Member
0 Kudos

Hi Gurus,

I have created two AET fields on the screen (marked below) and that should store values in table CRMD_CUSTOMER_H. When I create a new service request and enter the values and save, AET field values are not saved. Again, when I edit the same service request and enter the values and save , AET field values are saved on the database.


While  debugging  I found that, relationship BTHeaderCustExt does not exist for the first time and second time onward its appearing. Due to this, data is not being saved at first time (Line no 27 : current is empty).

When tried to create realtionship using create_related_entity , it throwing exception cx_crm_genil_model_error.

Please advice me the soution for the same.

Regards,

Anand

Accepted Solutions (1)

Accepted Solutions (1)

praveen_kumar194
Active Contributor
0 Kudos

there should be a context node at your view level. Please check ON NEW FOCUS method is implemented or not.

If not, you can implement that method with below code.

    DATA: lv_collection TYPE REF TO if_bol_bo_col,

          entity        TYPE REF TO cl_crm_bol_entity.



*   get collection of dependent nodes

    entity ?= focus_bo.

    TRY.

        lv_collection = entity->get_related_entities(

               iv_relation_name = 'BTHeaderCustExt' ).



        IF lv_collection IS NOT BOUND or lv_collection->size( ) = 0.

          IF entity->is_changeable( ) = ABAP_TRUE.

            TRY.

                entity = entity->create_related_entity(

                 iv_relation_name = 'BTHeaderCustExt' ).

              CATCH cx_crm_genil_model_error cx_crm_genil_duplicate_rel.

*               should never happen

            ENDTRY.

            IF entity IS BOUND.

              CREATE OBJECT lv_collection TYPE cl_crm_bol_bo_col.

              lv_collection->add( entity ).

            ENDIF.

          ENDIF.

        ENDIF.



      CATCH cx_crm_genil_model_error.

*       should never happen

        EXIT.

      CATCH cx_sy_ref_is_initial.

    ENDTRY.

    me->set_collection( lv_collection ).

Former Member
0 Kudos

Thanks Praveen for your input.

When I right click on method 'on_new_focus', redefine option is not present. While clicking it prompts a message 'ZL_SRQM_H_BTADMINH_CN ON_NEW_FOCUS does not exist'.

I created a method 'on_new_focus' on CN class and put above code but its not triggering while debug.


I think its not generated properly (showing diamond icon).It should be of method type event handler and need to trigger automatically.

Regards,

Anand

dharmakasi
Active Contributor
0 Kudos

Hi Annad,

You have already one thread open on this topic.

You can close any one of them and continue.

Best Regards,

Dharmakasi.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi All,

There is another thread  on this topic.

AET Field Value is not being saved at first time and second time onward it's saving on the database

I am closing this thread.