Get_related_entities

Hi Experts,
I am trying to set the partnerno attribute in the role assignment block to some default value when pressing on create account.
I have written the coding in 'DO_PREPARE_OUTPUT' method.
I am getting typecasting errors.I have tried the following
data : lr_part type ref to zl_bp_head_accountdetails_cn00,
        entity type ref to cl_crm_bol_entity,
a type ref to if_bol_bo_property_access.
lr_part ?= typed_context->header.
a = lr_part->collection_wrapper->get_current( ).
Now after this I want to use the method u201D get_related_entity( IV_RELATION_NAME = 'BuilRolesRel').u201D
Now my a is of type if_bol_bo_property_access.Now how do I access get_related_entity with u201Cau201D because get_related_entity is a method in the class cl_Crm_bol_entity.
After getting this related entity I want 2 set the attribute partnerrole.
Please help.
Regards
Shilpi

Hi Shilpi,
set a breakpoint in method CL_BP_HEAD_ACCOUNTDETAILS_IMPL->PROCESS_DATA().
Here the root element is created in the call to create_root in the context node class.
The whole logic is called on every roundtrip, but I suppose the model node is only created once all necessary data for root creation has been entered.
A simple solution (not a good an perfect one) would be redefining the EH_SUBMITONENTER() method.
There something like the following code:
super->eh_onsubmitonenter().
lr_current = typed_context->header->collection_wrapper->get_current()
data: lr_entity type ref to cl_crm_bol_entity.
try.
lr_entity ?= lr_current.
catch cx_sy_move_cast_error.
*still no model node.
return.
*wait for next roundtrip
endtry.
*check if first time in here
check gv_first = abap_false.
lr_current = lr_entity->get_related_entity( iv_relation_name = 'myrelation' ).
lr_current->set_property( iv_attr_name = 'x' iv_value = lv_myvar ).
gv_first = abap_true.
This is just a suggestion I typed into the browser. I just made it up and did not try the coding!
There is probably a better place to put all this stuff. For example the place where the configuration is switched from one assignmentblock to the whole overviewpage.
cheers Carsten

Similar Messages

  • Get_related_entities retrieves nothing

    Hi everyone !! I have one issue about the "get_related entities",
    lv_collection = entity->get_related_entities(
                 iv_relation_name = 'BuilAddressPhoneRel' ). . . . me->set_collection( lv_collection )
    inside of the "on_new_focus" method of a model node.
    The thing is that some BP´s doesn´t have any phone data related and the get_related_entities returns nothing, the collection is just "Initial", the collection_wrapper will not have nothing to wrap ...
    The problem is that the user through an inputfield will edit phone data, the "SETTER" method of this field uses an "initial" collection_wrapper when there is not any initial phone data giving me some troubles to save the new value because the initial state of the collection_wrapper...
    I try to create an empty with a "entity_factory" of this node with no results.
    Any suggestion ?

    Hi,
    If get related entites returns an empty collection then use create_related_entity to create the relation
    (code)
      get collection of dependent nodes
            lv_collection = entity->get_related_entities(
                   iv_relation_name = lv_rel_name ).
            IF lv_collection IS NOT BOUND OR lv_collection->size( ) = 0.
              IF entity->is_changeable( ) = abap_true.
                    entity = entity->create_related_entity(
                     iv_relation_name = lv_rel_name ).
              ENDIF.
           ENDIF.
    (code)
    Regards,
    Arun

  • Issue with Creation of new entity and adding it to collection

    Hi Experts,
    LR_ENTITY_ACCT(Account details) is the parent node and that is populated using the query builder.
    From there, I am trying to get realtion of notes section 'BuilNotesRel'). If it is not present, I am creating a new entity of that relation through parent node, setting attributes and saving it. I have written the following code. While debugging, I can see the new entity created under parent LR_ENTITY_ACCT and set property is also working. But afer execution, if I check in genil_bol_browser transaction, there is no new entity created under BuilNotesRel. Please help.
    data:  LR_ENTITY_ACCT          TYPE REF TO CL_CRM_BOL_ENTITY,
               LR_COL_NOTES            TYPE REF TO IF_BOL_BO_COL,
                  LR_ENTITY_NOTES         TYPE REF TO CL_CRM_BOL_ENTITY.
            IF LR_ENTITY_ACCT IS BOUND.
              LR_COL_NOTES ?= LR_ENTITY_ACCT->GET_RELATED_ENTITIES( IV_RELATION_NAME = 'BuilNotesRel' ).
    IF  LR_COL_NOTES->SIZE( ) = 0.
        LR_ENTITY_ACCT->create_related_entity( iv_relation_name = 'BuilNotesRel').
        LR_CORE_3 = CL_CRM_BOL_CORE=>GET_INSTANCE( ).
                LR_CORE_3->MODIFY( ).
            LR_COL_NOTES ?= LR_ENTITY_ACCT->GET_RELATED_ENTITIES( IV_RELATION_NAME = 'BuilNotesRel' ).
              LR_ENTITY_NOTES ?= LR_COL_NOTES->GET_FIRST( ).
                  LR_ENTITY_NOTES->SET_PROPERTY( IV_ATTR_NAME = 'TEXT_ID'
                                               IV_VALUE     =  'ZCOM').
                LR_ENTITY_NOTES->SET_PROPERTY( IV_ATTR_NAME = 'TDLINE'
                                               IV_VALUE     =  LS_ACCOUNT_DETAILS-NOTES ).
    LR_CORE_3 = CL_CRM_BOL_CORE=>GET_INSTANCE( ).
                LR_CORE_3->MODIFY( ).
    endif.
    endif.
    Thanks,
    Ramya

    Hi Sumit,
    I have used a structure for notes which is of TYPE crmt_bupa_il_notes.
    ls_notes                TYPE crmt_bupa_il_notes.
    Then I create the entity, get properties, set the properties and do a core modify.
    LR_ENTITY_NOTES = LR_ENTITY_ACCT->create_related_entity( 'BuilNotesRel' ).
         LR_ENTITY_NOTES->get_properties( IMPORTING es_attributes = ls_notes ).
        ls_notes-task = 'M'.
        ls_notes-text_id = 'ZCOM'.
        ls_notes-langu = 'EN'.
        ls_notes-languiso = 'EN'.
        ls_notes-tdformat = '*'.
        ls_notes-tdline = LS_ACCOUNT_DETAILS-NOTES.
          LR_ENTITY_NOTES->set_properties( EXPORTING is_attributes = ls_notes ).
          LR_CORE_3 = CL_CRM_BOL_CORE=>GET_INSTANCE( ).
                LR_CORE_3->MODIFY( ).
    Thanks,
    Ramya

  • Can not update an assignment block with on_new_focus

    Hello Experts,
    I have the following problem. I created a new component which is similar to the component BP_BPBT to create activities for Business Agreements. In the overview page of the business agreement in WebUI, I have now the assigment blocks "Plannend activities" and "Interaction History".
    When I create a new activity in the assigment block "planned activities" with the new button and save the activity with the buttons "SAVE" or "SAVE AND BACK". The new created actity is shown, depending on the "Active Status" , in one of the assignment blocks "Plannend activities" and "Interaction History". When I create an another activity in the same way, the new actiity is not shown in the assignment blocks. But when I reload the page again, I can see the new created activity.
    During debugging, I see, that the first creating activity is in the collection in the method ON_NEW_FOCUS. When I create an another activity, the collection is not updated. Here is my coding:
    * get collection of dependent nodes
      TRY.
          entity ?= focus_bo.  "BuAg Entity 
        CATCH cx_sy_move_cast_error.
          RETURN.
      ENDTRY.
      TRY.
      lr_entity = entity->get_related_entity( iv_relation_name = 'BuAgBuPaRel' ).
         lv_collection = lr_entity->get_related_entities(
             iv_relation_name = 'BuilInteractionHistoryRel'
    *  D022159: Performance optimization
             iv_mode          = lv_mode ).
    Can anyone explain me, why the activities (after the first one) are not in my collection.
    Can anyone help me to fix this problem?
    Kind Regards,
    John H.

    Hi,
    Please check if you have added your entity to collection after you save the entry. It looks like your value is saved in DB but its not reflected on UI because you are not refreshing your collection.
    I would suggest that you write a code after you save and commit to refresh your collection of the context node.
    Regards,
    Bhushan

  • How to change employee responsible for open campaigns.

    Hi,
    I want to find out open campaigns and marketing attributes based on partner function i.e., employee responsible and these open documents I need assign to another employee responsible. Which function module I need to read the details and which fm is to change employee responsible.  Please guide me which fm i need to use how I can change to another employee responsible partner function.
    divya

    Hi Divya,
    If you are comfortable with the bol queries, you can execute the bol query services to get relevant data..
    here is the sample code to get marketing attributes for a bp.. here you can read additonal attribute "partner function" to filter the data as per your req.
    Marketing Attributes
      DATA : lr_mktattr_coll TYPE REF TO if_bol_entity_col,
             lt_mktattr TYPE TABLE OF crmt_mktbp_attribute,
             ls_mktattr TYPE crmt_mktbp_attribute.
      IF lr_buil_entity IS BOUND.
        TRY.
            CALL METHOD lr_buil_entity->get_related_entities
              EXPORTING
                iv_relation_name = 'BuilMktAttributeRel'
              RECEIVING
                rv_result        = lr_mktattr_coll.
          CATCH cx_crm_genil_model_error .
        ENDTRY.
        CLEAR lr_entity.
        IF lr_mktattr_coll IS BOUND AND lr_mktattr_coll->size( ) GT 0.
          lr_entity ?= lr_mktattr_coll->get_first( ).
          WHILE lr_entity IS BOUND.
            CALL METHOD lr_entity->get_properties
              IMPORTING
                es_attributes = ls_mktattr.
            IF ls_mktattr IS NOT INITIAL.
              APPEND ls_mktattr  TO lt_mktattr .
            ENDIF.
            lr_entity ?= lr_mktattr_coll->get_next( ).
          ENDWHILE.
        ENDIF.
      ENDIF.

  • Fact Sheet generation - CL_CRM_GENIL_CONTAINER_OBJECT issue

    Hi Guys,
    We are utilizing functionality of an Activity Management to schedule appointments using Activity Scheduling and Standalone appointment creation as well. We did use automatic Fact Sheet attachments to the appointments.
    We introduced an ad hoc generation of PDF Fact sheet attachments into the appointments. We are testing our custom solution but we experienced one issue caused by SAP standard code.
    Let me summarize our settings first
    1.We turn off automatic FS generation in IMG CRM->Transactions->Settings for activities->Attach Fact Sheet to activities
    (Role)G:ZZ:CRM1:SLS_USER; (Trans.Type)Z100; (Short Descriptio)Visit; (Language)EN; (AttchAutom)blank; (AttachMan) flag
    2.We do use custom smartform ZCRM_FACTSHEET that is a copy of CRM_ACC_ACCOUNT_OVERVIEW_PRN
    3. We created new class ZCL_UIU_PRN_ACCOUNT as a copy of CL_UIU_PRN_ACCOUNT
    4. in View CRMV_PRN_CONTROL we have maintained following entries (Role)G:ZZ:CRM1:SLS_USER; (External Object Name)BuilHeader; (Form name) ZCRM_FACTSHEET; (Class/Interface)ZCL_UIU_PRN_ACCOUNT; (View) blank
    5. in cluster CRMVC_BUIL_PRT we have maintaned following Related objects ro (Role)G:ZZ:CRM1:SLS_USER and (Ext. Object Name) BuilHeader
    (External Object Name)BuilActivity-(Field name)ACTIVITIES; BuilAddress - ADDRESS_OVERVIEW; BuilContactPerson - CONTACTS; BuilInteractionHistory - HISTORY; BuilRelationship - RELATION_TYPES; BuilSalesArrangement - SALES_AREAS
    Our custom program ZFCRM_CREATE_FACT_SHEET is basically selecting relevant appointments; Reading information about main partner using FM CRM_PARTNER_READ_OW and calling FM CRM_UIU_BP_PRINT_BACKGROUND. All export parameter are properly filled in.
    This FM is basically calling our Z class ZCL_UIU_PRN_ACCOUNT based on above customizing. For simplification reasons imagine that ZCL_UIU_PRN_ACCOUNT is exact copy of standard SAP class CL_UIU_PRN_ACCOUNT where  CL_UIU_PRN_ACCOUNT is its superclass
    The issue is with the method COLLECT_DATA and section of the code
    lr_collection = lr_buil_entity->get_related_entities(
    iv_relation_name = <ls_model>-relation_name ).
    that returns data for internal tables lt_activities(open activities) and lt_history(closed activities). If we have scenario when we have 3 open and 8 closed activities:
    a. When I generate the Fact Sheet from an Account directly in Web UI CL_CRM_BOL_CORE->get_related_entities is returning 3 records for lt_activities(open activities) and 8 lt_history(closed activities).
    b. When I called it from our Z program the CL_CRM_BOL_CORE->get_related_entities is returning 11 records for lt_activities(open activities) and 11 lt_history(closed activities). It means mixed bag. And this is the issue.
    I did analyze the standard SAP code and the section containing below
    code is responsible for the mismatch
    try to read children
    if IV_RELATION_NAME is initial.
    if IV_OWNED_ONLY = ABAP_TRUE.
    LV_OBJ_LIST = IV_ENTITY->CONTAINER_PROXY-
    >IF_GENIL_CONTAINER_OBJECT~GET_OWNED_CHILDREN( IV_AS_COPY = TRUE ).
    else.
    LV_OBJ_LIST = IV_ENTITY->CONTAINER_PROXY-
    >IF_GENIL_CONTAINER_OBJECT~GET_CHILDREN( IV_AS_COPY = TRUE ).
    endif.
    elseif LV_MODE ne CL_CRM_BOL_ENTITY=>BYPASSING_BUFFER.
    get relation state
    >>this code>> LV_OBJ_LIST = IV_ENTITY->CONTAINER_PROXY-
    >IF_GENIL_CONTAINER_OBJECT~GET_RELATION( IV_RELATION_NAME =
    IV_RELATION_NAME
    IV_AS_COPY = TRUE ).
    read table IV_ENTITY->MY_MANAGER_ENTRY->RELATIONS with table key
    RELATION_NAME = IV_RELATION_NAME
    assigning
    <REL_STATE>.
    endif.
    CL_CRM_GENIL_CONTAINER_OBJLISTCP->CONSTRUCTOR
    data: LS_RELATION type GTYPE_RELATION,
    LV_PARENT type ref to CL_CRM_GENIL_CONTAINER_OBJECT,
    LV_ENTRY type ref to IF_GENIL_CONTAINER_OBJECT,
    LV_CHILD_PROXY type ref to CL_CRM_GENIL_CONTAINER_OBJECT.
    field-symbols: <REL> type CRMT_GENIL_CONT_RELAT
    >>this code>> read table IV_PARENT_DATA_REF->RELATIONS assigning <REL> with table key RELATION_NAME = IS_FILTER-RELATION_NAME.
    Table IV_PARENT_DATA_REF->RELATIONS is not filled for scenario b. at all. It is filled for scenario a. For our scenario b. it is missing relationships and that's the reason why we got mixed activities in BuilActivityRel and BuilHistoryRel..
    Did you come across similar bug or do you know which note could potentially resolve this issue?
    Thank you in advance.
    -Milan

    You might have to put breakpoint in function module CRM_UIU_BP_PRINT_BACKGROUND
    Check the values in parameter - IT_BOL_RELATION
    Also check values returned from querying table crmc_prn_contr2 (its at line 76 in our system).
    Thanks,
    Alwyn

  • How to read the value of a field belonging to a different context node in GET_I method during runtime

    I want the read the value of a field,'LCSTATUS' belonging to context node 'BTADMINH' in the GET_I method of the field, 'ZZFLD000008' belonging to context node,'ZBTACTIVITYH'.
    In the context node class of context node 'ZBTACTIVITYH',I have created an instance attribute,GR_OWNER type ref to context class.
    I get the following error in the line - lv_act_status = Lr_entity->if_bol_bo_property_access~GET_PROPERTY_AS_STRING( 'LCSTATUS' ).
    'An exception (CX_CRM_CIC_PARAMETER_ERROR) occurred Message no. TPDA430'
    I have used the below code.
    method GET_I_ZZFLD000008.
         DATA: current TYPE REF TO if_bol_bo_property_access,
               lv_act_status TYPE string.
         DATA:lr_entity TYPE REF TO cl_crm_bol_entity,
               lr_current TYPE REF TO if_bol_bo_property_access,
              lr_parent TYPE REF TO cl_crm_bol_entity.
         rv_disabled = 'TRUE'.
         if iterator is bound.
           current = iterator->get_current( ).
         else.
           current = collection_wrapper->get_current( ).
         endif.
    CHECK gr_owner IS BOUND.
    lr_entity ?= gr_owner->btadminh->collection_wrapper->get_current( ).
    CHECK  lr_entity  IS BOUND.
    lv_act_status = Lr_entity->if_bol_bo_property_access~GET_PROPERTY_AS_STRING( 'LCSTATUS' ). "error states that lcstatus can't be used here.
       TRY.
             IF current->is_property_readonly(
                           'ZZFLD000008' ) = abap_false. "#EC NOTEXT
               rv_disabled = 'FALSE'.
             ENDIF.
         CATCH cx_sy_ref_is_initial cx_sy_move_cast_error
               cx_crm_genil_model_error.
           RETURN.
       ENDTRY.
    endmethod.

    Hi,
    LCSTATUS is not an attribute of the BTADMINH structure. It is read using the relation to the status object
    BTADMINH-> BTHeaderStatusSet-> BTStatusHCurrent-> ACT_STATUS.
    Try reading the ACT_STATUS of object BTStatus as given below.
            data: coll   type ref to if_bol_entity_col.
           data: entity type ref to cl_crm_bol_entity,
                         lv_act_status TYPE string.
           entity ?= current.                                                               "BTADMINH entity.
           coll = entity->get_related_entities(
                    iv_relation_name = 'BTHeaderStatusSet' ).    "#EC NOTEXT
           current = coll->get_current( ).
            entity ?= current.
           coll = entity->get_related_entities(
                    iv_relation_name = 'BTStatusHCurrent' ).     "#EC NOTEXT
           current = coll->get_current( ).
            try.
           lv_act_status = current->if_bol_bo_property_access~GET_PROPERTY_AS_STRING(  'ACT_STATUS' ).
             catch cx_crm_cic_parameter_error.
           endtry.
    Regards JP

  • Not able to get changed values in the SAVE EVENT in ServHPartnerDet view

    Hi Experts,
    I am new CRM WEB IC, i have requirement like need to access four IBASE fields from BupaIbaseDetail and need to display those fiedls in ServHPartnerDet view. I am able display the fields and its values in the target view. But when user press change button and changes those four fields and press save button not able get the changed values in to the SAVE EVENT.Anyone please help me in this.
    IBHEADER , IBASEADDRESS  are the CONTEXT NODE CREATED in target view. I have binded IBHEADER to CuCoIbase custom controller and getting four fields data from IBASEADDRESS. below is the code for CREATE_CONTEXT_NODES.
    METHOD create_ibaseaddress.
      DATA:
        model        TYPE REF TO if_bsp_model,
        coll_wrapper TYPE REF TO cl_bsp_wd_collection_wrapper,
        entity       TYPE REF TO cl_crm_bol_entity,              "#EC *
        entity_col   TYPE REF TO if_bol_entity_col.             "#EC *
      model = owner->create_model(
          class_name     = 'ZL_CRM_IC_SERVHPDET_CN00'
          model_id       = 'IBaseAddress' ).                    "#EC NOTEXT
      ibaseaddress ?= model.
      CLEAR model.
      coll_wrapper =
        ibheader->get_collection_wrapper( ).
    TRY.
          entity ?= coll_wrapper->get_current( ).
        CATCH cx_sy_move_cast_error.
      ENDTRY.
      IF entity IS BOUND.
        TRY.
            entity_col = entity->get_related_entities(
                            iv_relation_name = 'FirstLevelComponent' ).
          CATCH cx_crm_genil_model_error.
        ENDTRY.
        TRY.
            entity ?= entity_col->get_current( ).
          CATCH cx_sy_move_cast_error.
        ENDTRY.
        CLEAR entity_col.
        IF entity IS BOUND.
          TRY.
              entity_col = entity->get_related_entities(
                              iv_relation_name = 'ComponentAddress' ).
              ibaseaddress->set_collection( entity_col ).
            CATCH cx_crm_genil_model_error.
          ENDTRY.
        ENDIF.
      ENDIF.
    ENDMETHOD.

    Code i have written in the CREATE_CONTEXT_NODE method for my custom context nodes( IBHEADER,IBASEADDRESS).
    this  CREATE_IBHEADER some data related to IBASE header then from this reading the IBASEADDRESS contextnode fields for displaying in the ServHPartnerDet. It is working fine but After changing the four fields values in the ServHPartnerDet view and trying to save, then context is not reading the new values it gives the old values only.
      TRY.
          lr_coll_wr = ztyped_context->ibaseaddress->get_collection_wrapper( ).
          IF lr_coll_wr IS BOUND.
            lr_entity ?= lr_coll_wr->get_current( ).
          ENDIF.
        CATCH cx_crm_genil_model_error.
      ENDTRY.
      CALL METHOD lr_entity->if_bol_bo_property_access~get_property_as_value
        EXPORTING
          iv_attr_name = 'BUILDING'
        IMPORTING
          ev_result    = lw_building.
    the building has got result of old value no the new value.
    method CREATE_IBHEADER.
        DATA:
          model        TYPE REF TO if_bsp_model,
          coll_wrapper TYPE REF TO cl_bsp_wd_collection_wrapper,
          entity       TYPE REF TO cl_crm_bol_entity,    "#EC *
          entity_col   TYPE REF TO if_bol_entity_col.    "#EC *
        model = owner->create_model(
            class_name     = 'ZL_CRM_IC_SERVHPDET_CN01'
            model_id       = 'IBHEADER' ). "#EC NOTEXT
        IBHEADER ?= model.
        CLEAR model.
    bind to custom controller
      DATA:
          cuco TYPE REF TO cl_crm_ic_cucoibase_impl,
          cnode TYPE REF TO cl_bsp_wd_context_node.
      cuco ?= owner->get_custom_controller(
            'CuCoIbase' ).                                      "#EC NOTEXT
      cnode ?=
        cuco->typed_context->ibaseheader.
      coll_wrapper = cnode->get_collection_wrapper( ).
      ibheader->set_collection_wrapper( coll_wrapper ).
    endmethod.

  • Reading the data from one component view into another component view

    Hi All,
    I have requirement to read the data from one component into another component while creating the service order. Here are the details.
    Main View for Service order: BT116H_SRVO in that we have two assignment blocks like Organizational data(BTORGSET) and amount allocation(BTAMNTALL).This two blocks are two different component which are associated with main component(BT116H_SRVO).
    I need to read the sales org data from component/View(BTORGSET/Orgsetdata) into Component/View(BTAMNTALL(HdrBillPlanDet) method DO_VALIDATE_INPUT.
    I searched in SDN but all the posts are related to the data exchange between two views in same component. But My scenario is different as explained above.
    Refer the attachments for the component link..
    Please let me know how we can achieve this one..
    Thanks,
    Sapsar.

    Finally I was able to fix my code...My Mistakes were need to read the parent node above three levels and need to use the relation entity name while reading the data..
    Below is the correction code
    IF iv_index IS NOT INITIAL.
         lr_iterator ?= collection_wrapper->get_iterator( ).
         lr_current ?= lr_iterator->get_by_index( iv_index ).
         lr_entity ?= lr_iterator->get_by_index( iv_index ).
       ELSE.
         lr_current = collection_wrapper->get_current( ).
       ENDIF.
    *loop back to root entity
             WHILE lr_entity->get_name( ) NE 'BTAdminH'.
               lr_entity = lr_entity->get_parent( ).
             ENDWHILE.
    *Get the related entity
             IF lr_entity IS BOUND.
               lr_collection ?= lr_entity->get_related_entities( iv_relation_name = 'BTHeaderOrgmanSet' ) .
               IF lr_collection IS BOUND.
                 lr_orgset_m = lr_collection->get_current( ).
    *            lr_orgset = lr_orgset_m->get_related_entity( iv_relation_name = 'BTOrgSet' ).
                 lr_orgset = lr_orgset_m->get_property_as_string( 'SALES_ORG' ).
               ENDIF.
             ENDIF.
    Thanks,
    Sapsar.

  • How to read context node/attribute data of diff UI component of same screen

    Hi,
    I am new to CRM and as well as BSP, Now the requirement is, at the time of Lead creation, when the end user enters customer code and sales area i need to fetch and display the customer group 1 value( VIP,KAM etc) based on the customer's sales area, ( these are sales area specific values).
    but the problem is Customer code is in diff UI component and sales area data is in diff UI component .
    1) customer code attribute is in UI component BT108H_LEA, View BT108H_LEA\Detail, Context node is BTPARTNERPROSPECT.
    2) sales area fields are in the UI component BTORGSET, View BTORGSET\OrgSetData, Context node is BTORGSET.
    3) I have created new field(customer type to display the customer group 1 value "VIP") in UI component BT108H_LEA, View BT108H_LEA\Detail, Context node is BTLEADH.    
    To display the value in the context node BTLEADH, i need to know the sales area data which is entered in BTORGSET.
    Kindly let me know how to read the data which is in diff UI component of the same Lead creation screen.
    i written following code in context node BTLEADH, atttribute New Zfield, in get method, but not able solve, please guide me.
      DATA: LR_ENT TYPE REF TO CL_CRM_BOL_ENTITY,
                 LR_COL TYPE REF TO IF_BOL_ENTITY_COL.
      LR_ENT ?= ME->TYPED_CONTEXT->BuilHeader->COLLECTION_WRAPPER->GET_CURRENT( ).
      LR_COL = LR_ENT->GET_RELATED_ENTITIES( IV_RELATION_NAME = 'BuilSalesArrangementRel' ).
      LR_ENT ?= LR_COL->GET_FIRST( ).
      IF LR_ENT IS BOUND.
        LR_ENT->GET_PROPERTY_AS_VALUE( EXPORTING IV_ATTR_NAME = 'DIVISION'  IMPORTING EV_RESULT =  LV_DIVISION  ).
      ENDIF.
    I'll appreciate if you can provide me some documents to refer.
    awaiting for your responses.
    Thanks
    Bhanu

    Hi Gangadhar,
    I think i have not clearly explained my requirement, let me put it once again. My requirement is, I have to read two UI component data, validate and display some value in one new zfield which is in one of the UI components.
    I need to display customer's sales area specific data like customer group 1 value in that new zfield. for that i need Customer code and as well as sales area data from the screen.
    1) customer code attribute is in UI component BT108H_LEA, View BT108H_LEA\Detail, Context node is BTPARTNERPROSPECT.
    2) sales area fields are in the UI component BTORGSET, View BTORGSET\OrgSetData, Context node is BTORGSET.
    3) I have created new field(customer type to display the customer group 1 value "VIP") in UI component BT108H_LEA, View BT108H_LEA\Detail, Context node is BTLEADH.
    As per my understanding, in the context node BTLEADH, GET_METHOD of atttribute New Zfield, i have to read customer code from UI component BT108H_LEA, View BT108H_LEA\Detail, Context node is BTPARTNERPROSPECT and Sales area data from UI component BTORGSET, View BTORGSET\OrgSetData, Context node is BTORGSET based on the values, validate and display the data.
    But as per your recent reply you are asking me to write the code in get_property_attribute---division. so i didnt understand.
    Kindly clarify if i am wrong.
    awaiting for your response.
    Thanks
    BHanu

  • Error when trying to create complaint via IC WebClient (CRM 5.2)calling URL

    Hi,
    I'm trying to create a complaint using the following URL: http://<host>:<port>/sap/bc/bsp/sap/crm_ui_frame/default.htm?crm-object-type=BT120_CPL&crm-object-action=D, but get always the following error:
    Error when processing your request
    What has happened?
    The URL http://<host>:<port>/sap/bc/bsp/sap/crm_ui_frame/BSPWDApplication.do was not called due to an error.
    Note
    The following error text was processed in the system CMZ : The current application triggered a termination with a short dump.
    The error occurred on the application server sapcmzu_CMZ_86 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
          Method: IF_BOL_BO_COL~ADD of program CL_CRM_BOL_BO_COL=============CP
          Method: IF_BOL_BO_COL~ADD of program CL_BSP_WD_COLLECTION_WRAPPER==CP
          Method: IP_FOLLOWUP of program CL_BT120H_C_MAINWINDOW_IMPL===CP
          Method: PROCESS_NAV_QUEUE of program CL_BSP_WD_VIEW_MANAGER========CP
          Method: DO_REQUEST of program CL_BSP_WD_VIEW_MANAGER========CP
          Method: DO_REQUEST of program CL_BSP_CTRL_ADAPTER===========CP
          Method: ON_REQUEST of program CL_BSP_RUNTIME================CP
          Method: IF_HTTP_EXTENSION~HANDLE_REQUEST of program CL_HTTP_EXT_BSP===============CP
          Method: EXECUTE_REQUEST_FROM_MEMORY of program CL_HTTP_SERVER================CP
          Function: HTTP_DISPATCH_REQUEST of program SAPLHTTP_RUNTIME
    In ST22 I find the following text:
    Diagnosis
         An attempt was made to add an unattached object (NULL reference) to
         a business object collection or entity collection of the Business
         Object Layer (BOL) by using method IF_BOL_BO_COL~ADD. This is a
         method application error.
    But on the other side the change method works well:
    http://<host>:<port>/sap/bc/bsp/sap/crm_ui_frame/default.htm?crm-object-type=BT120_CPL&crm-object-action=B&crm-object-keyname=GUID&crm-object-value=DC445922DEB133F1939A00145EF80CCC
    Is there anybody with experience regarding this issue? Perhaps the parameters are wrong?
    Kind Regards,
    Christian

    Hi Sudipta,
    many thanks for your answer. But sadly it still does not work. I have created a new GUID using function module 'GUID_CREATE' and have appended it to the url:
    http://<host>:<port>/sap/bc/bsp/sap/crm_ui_frame/default.htm?crm-object-type=BT120_CPL&crm-object-action=D&crm-object-keyname=GUID&crm-object-value=47CD5B2204B619B9E10000000A8031BA
    Now I'm getting the following exception:
    Error occurred during navigation
    An exception has occurred Exception Class  CX_BOL_EXCEPTION - Access Previously Deleted Entity 
    Method:  CL_CRM_BOL_CORE=>GET_RELATED_ENTITIES 
    Source Text Row:  18
    Is there still something wrong with the url?
    By the way: is there any documentation regarding this topic? I did only find a blog, nothing else.
    Kind Regards,
    Christian

  • How to read row index when clicking on F4 search multiple rows

    Hi Experts,
    I would like to read index of selected row in assignation block. Please help.
    My requirement is to restrict product search base on product category available in same row of table row.
    When I select f4 search on product ID, It shows me all products available in system, however user wants product search should be based on product catagory.
    I have added following code in get_v_orderprod. Problem is when user click on f4 button on product for first time CONTROL doesnot go to get_v_orderprod method in BT111H_OPPT component btadmini contextnode firsttime pop up comes with open search of all product available in system.
    DATA:  lr_admini            TYPE REF TO cl_crm_bol_entity,
             lr_iterator         TYPE REF TO if_bol_bo_col_iterator,
             lv_ordered_prod     TYPE REF TO crmt_ordered_prod_db,
             lr_collection       TYPE REF TO if_bol_bo_col,
             current             TYPE REF TO if_bol_bo_property_access,
             dref                TYPE REF TO data,
             lv_pr_catagory      TYPE string.
      FIELD-SYMBOLS: <l_data> TYPE data.
    * if iterator is bound.
    *      current = iterator->get_current( ).
    *    else.
    *      current = collection_wrapper->get_current( ).
    *    endif.
      lr_iterator = me->collection_wrapper->get_iterator( ).
    if lr_iterator is bound.
          current = lr_iterator->get_current( ).
        else.
          current = collection_wrapper->get_current( ).
    endif.
    lr_admini ?= current.
    *   lr_admini ?= lr_iterator->get_by_index( iv_index = iv_index ).
      IF lr_admini IS BOUND.
        lr_collection = lr_admini->get_related_entities(
                     iv_relation_name = 'BTItemProductExt' ).
    *   lr_collection = current->get_related_entities(
    *                 iv_relation_name = 'BTItemProductExt' ).
        current = lr_collection->get_current( ).
    *   if lr_collection is bound.
    *      current  = lr_collection->get_current( ).
    *    else.
    *      current = me->collection_wrapper->get_current( ).
    *    endif.
        IF current IS BOUND.
          TRY.
              dref = current->get_property( 'PROD_HIERARCHY' ).
              ASSIGN dref->* TO <l_data>.
              CHECK <l_data> IS ASSIGNED.
              lv_pr_catagory = <l_data>.
            CATCH cx_sy_ref_is_initial.
              RETURN.
          ENDTRY.
          CLEAR: lv_pr_catagory.
        ENDIF.
      ENDIF.
    Is there anyway out to achieve this ?
    Thanks
    Neha

    Hi Venkat,
    <li>You are the right person to solve the problem .
    <li>What you have to get it solved is place Break-point on REUSE_ALV_GRID_DISPLAY function module and break-point inside USER_COMMAND event where u press SCREEN button which takes you to table control and another break point where DELETE function you are doing. Definitely it works out.
    Thanks
    Venkat.O

  • CRM 7. How to make mandatory the BP Roles on CRM Web User Interface.

    Dear CRM Gurus,
      The requirement in our project is to have as mandatory at least one BP Role (except the default role of BP). Is there any way to implement or configure the CRM system to display an error message when a user tries to save a BP from WEB UI without having maintained the BP Role ?
    Thanks in advanced, John

    Hi Jhon,
    Before raising the error message as Garcia suggested check the collection of bp_roles.. if no roles maintain then raise the message.
    you can raise the message in eh_onsave event of BP_HEAD/BPHEADOverview.
    Sample code to check the collection of bp roles..
    DATA: lv_collection TYPE REF TO if_bol_bo_col,
                lr_bp                TYPE REF TO cl_crm_bol_entity.
      lr_bp ?= me->typed_context->builheader->collection_wrapper->get_current( ).
      CHECK lr_bp IS BOUND.
    TRY.
          lv_collection = lr_bp->get_related_entities(
                 iv_relation_name = 'BuilRolesRel' ).
    *     delete difftype-dependent roles (not maintainable/ displayed
    *     in standard)
          cl_crm_uiu_bp_roles_service=>filter_difftype_dependent(
            CHANGING cr_collection = lv_collection ).
    *     delete lifecycle stages (which are roles as well) from coll
    *     of "normal" roles
          cl_bp_accountlifecycle_service=>filter_roles_exclusive_stage(
            CHANGING cr_collection = lv_collection ).
        CATCH cx_crm_genil_model_error.
    *       should never happen
          EXIT.
        CATCH cx_sy_ref_is_initial.
      ENDTRY.
    check lv_collection->size( ) le 0.
          raise error message.
    Hope this helps.
    Cheers,
    Sumit Mittal

  • AET Generated field values are not saved.

    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

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

  • How to add new fields to Web UI

    Hi Experts,
    I want to add a new field on the Web UI. The requirement is very simple. I need to add a field which is shown on the available fields.
    The Get and Set methods are all already implemented in the context node and they are displayed with a small yellow triangle.
    When I re-launch the WebUI, I'm able to see only the field was input disabled.
    I'm facing the same problem for wht ever field i drop from the "Field Availabe list".
    Please let me know if there are anyother stuff i need to perform while adding a new field?
    And also experts let me know the steps need to be followed while modifying the Web UI.
    Many Thanks
    James....

    Thanks Arden for your quick respone.
    I checked the property on the field. Display mode for the field was unchecked only, but still the field looks disabled.
    When I debug the Get_I_category method(the field i'm trying to add was category from BTadminH), I found the class variable current was initial, which makes the program to dispay the field as disabled.
    rv_disabled = 'TRUE'.
        if iterator is bound.
          current = iterator->get_current( ).
        else.
          current = collection_wrapper->get_current( ).
        endif.
      TRY.
      DATA: coll   TYPE REF TO if_bol_entity_col.
      DATA: entity TYPE REF TO cl_crm_bol_entity.
          entity ?= current.
          coll = entity->get_related_entities(
                   iv_relation_name = 'BTHeaderActivityExt' ). "#EC NOTEXT
          _*current = coll->get_current( ).*_
          IF current IS NOT BOUND.
            RETURN.
          ENDIF.
            IF current->is_property_readonly(
                          'CATEGORY' ) = abap_false. "#EC NOTEXT
              rv_disabled = 'FALSE'.
            ENDIF.
        CATCH cx_sy_ref_is_initial cx_sy_move_cast_error
              cx_crm_genil_model_error.
          RETURN.
      ENDTRY.
    Arden, do u have any idea why the get_related_entities was not producing the values?
    Many Thanks!

Maybe you are looking for

  • How to get total number of days

    Hi All, how to get total number of days , for example if month eq 05 then need to get total number of days until MAY 31. and how to get total number of days in a month. Thank You,, Sriii..

  • Ios 7 problem

    i downloaded ios7 beta without having a UDID and now my iphone 5 says this device is not registered as a part of iphone developer program. i am a user but accidentally turned my ID to developer . what should i do?

  • Enable parser view command on ACS 5.X

    Hi all, Would like to check out is it possible  binding Cisco secure ACS 5.x to support router/switch ios feature view -  superview and parser command Busines objective is assigning administrative roles, with different role based CLI access, using AC

  • Office 365: some basic questions

    Hi, I've read somewhere that Office 365 will offer unlimited storage via OneDrive. If that's true, I'd like to sign up for an paying account. I had a trial running some time ago for my private domain but didn't continue the trial. What I'd like to ha

  • Sync random songs on non-shuffle player

    Hello, sorry if this question has been asked before but I can't seem to find it in search. Is there a way to sync random songs like what is done with an iPod shuffle, but on a different device? I would like my smart phone to serve as sort of an iPod