cancel
Showing results for 
Search instead for 
Did you mean: 

New field in CRM getting refreshed every time

Former Member
0 Kudos

Hi All,

I got a requirement to add new field in CRMCMP_CCS_EML component..in view Mailbody...when I looked at the component it does not have any context nodes..all the fields are added using BSP code..So I thought of doing same for my New field&Button ..

I have placed below BSP code in MailBody.htm page..Now my new field is coming with F4 help and button is also coming and it's triggering the event when I clicked on the button..every thing works fine..

I added my new field as shown below..

<thtmlb:inputField id = "UNAME"

                      description = "Forward To  "

                      helpId  = "USER_ADDR"

                      helpOutputFields="UNAME=BNAME;"/>

<thtmlb:button id      = "Go"

                text    = "Go"

                tooltip = "<%= otr(CRM_IC_APPL/check) %>"

                enabled = "X"

                onClick = "ITEMFORWARD" />

My Issue is it's keep on getting refreshed every time when we enter hit or if you do any thing on the CRM UI screen..Could you please let me know how to resolve this Issue..

And How do I read new field value in my class...

I appreciate your help on this.

Thanks,

Sara.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sara,

Step 1. Make a attribute in implementation class of your view. For eg 'GV_HTM_VALUE'

Step 2. You have to add attribute 'value'.

<thtmlb:inputField id = "UNAME"

                      description = "Forward To  "

                      value       = "<%= controller->GV_HTM_VALUE %>"

                      helpId  = "USER_ADDR"

                      helpOutputFields="UNAME=BNAME;"/>

Step 3. Redefine 'DO_HANDLE_DATA' method of impl clss of your view. Write the below code.

CALL METHOD super->do_handle_data

       EXPORTING

         form_fields     = form_fields

         global_messages = global_messages.

     DATA: wa_form_fields TYPE ihttpnvp.

     READ TABLE form_fields INTO wa_form_fields WITH KEY name = 'uname'.

     IF sy-subrc = 0.

       me->gv_htm_value = wa_form_fields-value.

     ENDIF.


Now your value will not get lost.


Regards,

Ritu

Former Member
0 Kudos

Thanks Ritu..

It solved my Issue..

I need one more thing..

I need to populate another field value based on the value that is selected from F4..like if we select the user id on F4 i need to display corresponding name in another field..

For this if I have written select in DO_PREPARE_DATA..? But it trigger multiple times and it will not effect performance right..

Could you please let me know how I can achieve this without effecting performance..?

Thanks,

Sara.

Former Member
0 Kudos

Hi Sara,

Write the below code on DO_HANDLE_DATA method only. The below code will set the value in 'abc' field when you select the value in 'uname' field. abc is the field in context node.

DATA: wa_form_fields TYPE ihttpnvp,

            lt_form_fields TYPE tihttpnvp.

     lt_form_fields = form_fields.

     READ TABLE form_fields INTO wa_form_fields WITH KEY name = 'uname'.

     IF sy-subrc = 0.

       me->gv_htm_value = wa_form_fields-value.

       wa_form_fields-name = 'dummy_abc'.         ""dummy is context node name, abc is fieldname

       wa_form_fields-value = 'info'.

       INSERT wa_form_fields INTO TABLE lt_form_fields.

     ENDIF.

     CALL METHOD super->do_handle_data

       EXPORTING

         form_fields     = lt_form_fields

         global_messages = global_messages.

Now the setter method of 'abc' field will be triggered and the value will be set.

If you want to set the value in the field which is made from htm page then you just need to set the attibute of impl class as you did for uname,

Let me know in case of any queries.

Thanks,

Ritu

Former Member
0 Kudos

Thanks Ritu,

It worked apart from that I need to set  helpTriggerSubmit = 'X' in BSP page as well for F4 id to trigger the DO_PREPARE_DATA again..So that user don't need press enter once the value is selected from F4..

Thanks,

Sara.

Former Member
0 Kudos

Hi Sara,

The below code will trigger the DO_PREPARE_OUTPUT.

<thtmlb:inputField id          = "UNAME"

                    value       = "<%= controller->GV_HTM_VALUE %>"

                    description = "Forward To"

                    helpId  = "ZSEARCH_FAC"

                    helpOutputFields="UNAME=FACILITYID;"

                   helpTriggerSubmit = 'X'                 />

Thanks,

Ritu

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sara,

input field must have a attribute value.

THis is one example from same view

  <thtmlb:inputField id       = "fromAddress"

                             value    = "<%= gv_from  %>"

                             width    = "100%"

                             disabled = "true" />

In this case gv_form is your page attribute, and you can set this from set_models method of your controller.

You can also choose to add a public attribute in controller and access the attribute like

<%= controller->zttr %> .

Hope this helps.

Regards

Anirudha

Former Member
0 Kudos

Thanks Anirudha for the response..I need some more information..

These are the steps I have done..

1)Create page attribute GV_FORWARD_AGENT in BSP page

2) Added that attribute in the code as shown below..

<thtmlb:label    text = "Forward To  " />

   <thtmlb:inputField id = "UNAME"

                       value         = "<%= gv_forward_agent %>"

                      description = "Forward To  "

                      helpId  = "USER_ADDR"

                      helpOutputFields="UNAME=BNAME;"/>

My question is for setting value using SET_MODELS method.

Do I need to write the code in controller..class..? which method..? I have both standard and custom controller also..Which one do I need to enhance it..?

I have set_models method in View class as well..Shall I write the code over there..?

I really appreciate your help on this.

Thanks,

Sara.

Former Member
0 Kudos

Hi Sara,

I mean set models of view controller.

Regards

Anirudha