Quantcast
Channel: SCN : Discussion List - SAP CRM: Sales
Viewing all articles
Browse latest Browse all 1559

Entity is not getting created

$
0
0

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.


Viewing all articles
Browse latest Browse all 1559

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>