on 03-25-2015 11:45 AM
Hi Gurus,
I have created couple of AET fields and pulled on service request (SR) overview page. The object type is selected as CUSTOMER_H. when I create new SR, provide values on AET fields and save - transaction is saved but the AET field values are not saved.
When I edit the same transaction again and fill the AET field value and save- transaction is saved with AET field values .
While debugging in setter method I found that the relationship 'BTHeaderCustExt' doesnot exist for the first time and second time onwards its showing the relationship. Due to which 'Current' is empty in line no 28 and hence not able to save values.
\
Has any one faced similar issue earlier and what's the way to resolved the issue?
Thanks,
Anand
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anandh,
The on_new_focus method will help you fetch the buffer using the parent node, For business transaction document BTAdminH would be the root node and the BTCustomerH is dependent on BTAdminh.
By adding code in ctxt class system will set the correct buffer data while creating instance for BTCustomerH context node class.
In you case since there is no on_new_focus method system is not creating instance for the customer h first time.
Why are you adding in BTAdminH context node class, you have added the field from customer_h context node right..
You have to add on_new_focus method for customer_h context node class. The code i have provided in my earlier post will help to retrieve customer_h data.
Apart from creating on_new_focus method in customer_h context node class, you have add below in view context class( ends with ctxt) create_btcustomerh context node.
* initial setting for depandant model node
coll_wrapper =
BTADMINH->get_collection_wrapper( ).
TRY.
entity ?= coll_wrapper->get_current( ).
CATCH cx_sy_move_cast_error.
ENDTRY.
IF entity IS BOUND.
BTCustomerH->on_new_focus(
focus_bo = entity ).
ENDIF.
Best Regards,
Dharmakasi.
Thanks Dharmakashi and Faisal.
My issue is resolved
Previously I had added created attibutes in Context node BTAdminH and did the binding using relationship BTHeaderCustExt.Though fields were appearing on the webUI screen,I was facing the issue with saving the field values.
Now, I have created new Context node BTCustomerH as a dependent node of BTAdminH. After creation of Context node, all the methods are generated successfully. Nothing to change/enhance.
Regards,
Anand
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Dharmakashi and Faisal 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).
Regards,
Anand
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anand,
I had faced the same problem while creating an AET field for accounts in address part. The problem was, I created the field with object HEADER as there was none for address. If I keep the field in address part, I had the same issue as yours. But if I move it to the account header part, it would work fine.
So in your case, you can either create the relationship in on_new_focus as suggested by Dharmakasi or move the field to a different part and see.
Thanks,
Faisal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anand,
Can you check ON_NEW_FOCUS method has any code in your details view. Please add below code and try adding below code in on_new_focus method in context node class
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 ).
Best Regards,
Dharmakasi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.