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

Default value for field in CRM WEB UI

Hi all

I need to set default value for the field in crm web ui.

component AIC_CMCR_H (enhanced) , view AIC_CMCR_H/AICCMCRHeaderEF

Field BTPARTNERSET / EMP_RESP_NAME

I've tried to do like http://scn.sap.com/thread/1098584

my impl. class is ZL_AIC_CMCR_AICCMCRHEADER_IMPL

method DO_INIT_CONTEXT

code:

CALL METHOD SUPER->DO_INIT_CONTEXT
.
data : lv_entity type ref to CL_CRM_BOL_ENTITY.

lv_entity ?= me->typed_context->BTPARTNERSET->collection_wrapper->get_current( ).
IF sy-subrc = 0.

lv_entity->set_property( iv_attr_name = 'PARTNER_FCT'
iv_value = 'SDCR0002' ).
lv_entity->set_property( iv_attr_name = 'PARTNER_NO'
iv_value = '0000000141' ).
ENDIF.

---

also tried

lv_entity->set_property( iv_attr_name = 'EMP_RESP_NAME '
iv_value = 'XNAME' ).

But i always getting dump with

Entry parameter of method CL_CRM_BOL_ENTITY->SET_PROPERTY contains value

PARTNER_FCT / PARTNER_NO / EMP_RESP_NAME , which is not allowed

Regards Dan

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on May 29, 2012 at 06:28 AM

    Hi Dan,

    The object BTPartnerSet don't have attributes you have mentioned above ,it only has one field CRM_GUID.

    So to default the employee responsible you have to create a child entity for the object BTpartnerSet .

    Try using the relation 'BTPartner_PFT_0008_MAIN' ( for employee responsible) from BTpartnerSet object then you will get BTpartner as dependent object. Now you can set the values in entity of BTpartner.

    Use the following code as an example

    TRY.

    lo_partner_set = lo_header->get_related_entity( 'BTHeaderPartnerSet' ).
    CATCH cx_crm_genil_model_error.
    ENDTRY.

    IF lo_partner_set IS BOUND.
    lo_partner_empres = lo_partner_set->get_related_entity( 'BTPartner_PFT_0008_MAIN' ).
    * If there is no Empl Resp --> Create Entity
    IF lo_partner_empres IS NOT BOUND.
    IF lo_partner_set->is_changeable( ) = abap_true.
    TRY.
    lo_partner_empres = lo_partner_set->create_related_entity(
    iv_relation_name = 'BTPartner_PFT_0008_MAIN' ).
    CATCH cx_crm_genil_model_error cx_crm_genil_duplicate_rel.
    * should never happen
    ENDTRY.
    ENDIF.
    ENDIF.

    Regards,

    Nithish

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2013 at 01:17 PM

    Hi,

    I have a similar requirement to assign a default value to the Employee responsible field while creating campaigns.

    Can you please share the complete process required to be done for the same, as i have tried the above but not able to achieve the desired result.

    Your help would be much appreciated.

    Regards,

    YS

    Add a comment
    10|10000 characters needed characters exceeded

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.