Skip to Content
author's profile photo Former Member
Former Member

Entity is not getting created

Hi Friends,

I have created one custom View with 3 context node....

in the do prepare output i have wriiten the below code... Kindly go through the below code and pls help me out..

METHOD do_prepare_output.

CALL METHOD super->do_prepare_output

EXPORTING

iv_first_time = abap_true.

DATA : lcl_btadminh TYPE REF TO cl_crm_bol_entity, "cl_crm_bol_entity,

lcl_btcustomerh TYPE REF TO cl_crm_bol_entity,

lcl_btopporth TYPE REF TO cl_crm_bol_entity,

lv_sta_date TYPE sy-datum,

lv_end_date TYPE sy-datum.

lcl_btadminh ?= gv_collection->get_current( ). (gv_collection is the global attribute which i have created in impl class...of custom view and used in window inbound plug to get btadminh collection from different view)

* TRY.

CALL METHOD lcl_btadminh->get_related_entity

EXPORTING

iv_relation_name = 'BTHeaderCustExt'

* iv_mode = NORMAL

RECEIVING

rv_result = lcl_btcustomerh.

* CATCH cx_crm_genil_model_error .

* ENDTRY.

CALL METHOD lcl_btcustomerh->get_property_as_value

EXPORTING

iv_attr_name = 'ZZCONTRACT_START'

IMPORTING

ev_result = lv_sta_date.

CALL METHOD lcl_btcustomerh->get_property_as_value

EXPORTING

iv_attr_name = 'ZZCONTRACT_END'

IMPORTING

ev_result = lv_end_date.

*********** Reading Contract end date if amendment opportunities are already existed in th current sales agreement********************

DATA : lcl_dquery_oppt TYPE REF TO cl_crm_bol_dquery_service,

lcl_result_oppt TYPE REF TO if_bol_bo_col,

lcl_btqropp TYPE REF TO cl_crm_bol_entity,

lcl_btorder TYPE REF TO cl_crm_bol_entity,

lcl_btadminh_opp TYPE REF TO cl_crm_bol_entity,

lcl_btcustomerh_opp TYPE REF TO cl_crm_bol_entity,

lcl_btcustomerh_res TYPE REF TO cl_crm_bol_entity,

lv_license_id TYPE string,

lv_end TYPE sy-datum,

lv_end_final TYPE sy-datum.

lcl_dquery_oppt = cl_crm_bol_dquery_service=>get_instance( iv_query_name = 'BTQOpp' ).

IF lcl_dquery_oppt IS BOUND.

CALL METHOD lcl_dquery_oppt->add_selection_param

EXPORTING

iv_attr_name = 'ZZAFLD000074'

iv_sign = 'I'

iv_option = 'EQ'

iv_low = lv_license_id

* iv_high =

.

CALL METHOD lcl_dquery_oppt->add_selection_param

EXPORTING

iv_attr_name = 'PROCESS_TYPE'

iv_sign = 'I'

iv_option = 'EQ'

iv_low = 'ZADM'

* iv_high =

.

lcl_result_oppt = lcl_dquery_oppt->get_query_result( ).

CLEAR lv_end_final.

IF lcl_result_oppt IS BOUND.

lcl_btqropp ?= lcl_result_oppt->get_first( ).

WHILE lcl_btqropp IS BOUND.

* TRY.

CALL METHOD lcl_btqropp->get_related_entity

EXPORTING

iv_relation_name = 'BTADVSOpp'

* iv_mode = NORMAL

RECEIVING

rv_result = lcl_btorder.

* CATCH cx_crm_genil_model_error .

* ENDTRY.

* TRY.

CALL METHOD lcl_btorder->get_related_entity

EXPORTING

iv_relation_name = 'BTOrderHeader'

* iv_mode = NORMAL

RECEIVING

rv_result = lcl_btadminh_opp.

* CATCH cx_crm_genil_model_error .

* ENDTRY.

CALL METHOD lcl_btadminh_opp->get_related_entity

EXPORTING

iv_relation_name = 'BTHeaderCustExt'

* iv_mode = NORMAL

RECEIVING

rv_result = lcl_btcustomerh_opp.

* CATCH cx_crm_genil_model_error .

* ENDTRY.

CALL METHOD lcl_btcustomerh->get_property_as_value

EXPORTING

iv_attr_name = 'ZZCONTRACT_END'

IMPORTING

ev_result = lv_end.

IF lv_end_final < lv_end.

lv_end_final = lv_end.

CLEAR lv_end.

ENDIF.

lcl_btqropp ?= lcl_result_oppt->get_next( ).

ENDWHILE.

lcl_btcustomerh_res ?= me->typed_context->btcustomerh->collection_wrapper->get_current( ). (exactly here I am facing the problem Here lcl_btcustomerh_res is not initializing with current entity.... and Error is displaying on web ui....

check lcl_btcustomerh_res is bound.

CALL METHOD lcl_btcustomerh_res->set_property

EXPORTING

iv_attr_name = 'ZZCONTRACT_START'

iv_value = sy-datum.

CALL METHOD lcl_btcustomerh_res->set_property

EXPORTING

iv_attr_name = 'ZZCONTRACT_END'

iv_value = lv_end_final.


ELSE.

lcl_btcustomerh_res ?= me->typed_context->btcustomerh->collection_wrapper->get_current( ).

CALL METHOD lcl_btcustomerh_res->set_property

EXPORTING

iv_attr_name = 'ZZCONTRACT_START'

iv_value = sy-datum.

CALL METHOD lcl_btcustomerh_res->set_property

EXPORTING

iv_attr_name = 'ZZCONTRACT_END'

iv_value = lv_end_date.

ENDIF.

ENDIF.

ENDMETHOD.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on May 14, 2013 at 09:16 AM

    Hi Sandya,

    You should check if the collection wrapper is filled, whether it does have data or not.

    Thanks & Best Regards,

    Leon

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 25, 2013 at 05:49 PM

    Hi sandhya,

    Did you set any dependency between your context node i.e BTCustomerh and its higher level node??

    If you set the dependency and if your higher level node is filled with data then BtCustomerh will be filled basing on the higher level node data.

    If you didnt set any dependency and then you need to fill your BTCustomerh context node manually using the set_collection method.

    Then u can access the data of that context node in DO_PREPARE_OUTPUT as your collection_wrappper will have data.

    lcl_btcustomerh_res ?= me->typed_context->btcustomerh->collection_wrapper->get_current( ).

    Thanks and regards,

    DP.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi..

      I have set the dependency while creating the View.... But that higher level node means btadminh is not bounding....that is the reason BtcustomerH is not filling..

      Now i have solved my problem by writing the below code in CREATE_BTcustomerH( ) of Context class....

      DATA : lre_core TYPE REF TO cl_crm_bol_core,

      lre_factory TYPE REF TO cl_crm_bol_entity_factory,

      ls_param TYPE crmt_name_value_pair,

      lt_param TYPE crmt_name_value_pair_tab,

      lre_btorder TYPE REF TO cl_crm_bol_entity.

      lre_core ?= cl_crm_bol_core=>get_instance( ).

      CALL METHOD lre_core->get_entity_factory

      EXPORTING

      iv_entity_name = 'BTOrder'

      RECEIVING

      rv_result = lre_factory.

      ls_param-name = 'PROCESS_TYPE'.

      ls_param-value = 'ZAME'.

      APPEND ls_param TO lt_param.

      ls_param-name = 'OBJECT_TYPE'.

      ls_param-value = 'BUS2000111'.

      APPEND ls_param TO lt_param.

      CALL METHOD lre_factory->create

      EXPORTING

      iv_params = lt_param

      RECEIVING

      rv_result = lre_btorder.

      CALL METHOD lre_btorder->get_related_entity

      EXPORTING

      iv_relation_name = 'BTOrderHeader'

      * IV_MODE = NORMAL

      RECEIVING

      rv_result = entity.

      * 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.

      Sandya

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.