cancel
Showing results for 
Search instead for 
Did you mean: 

How to read the Email To Address from Address independent data in service request

Former Member
0 Kudos

Hi,

I am new to Email functionality.

when we click mailsender button on service request overview page, it will display the email screen. Here for To Address field  i want to read the email address from Address independent communication.

if i check the email componenet(crmcmp_ccs_eml) it doesn't have any attributes under emailheader view. all the  buttens(To, BCC, CC..) are created in .htm page, don't know how the email address is coming into these fields.

email component: crmcmp_ccs_eml/emailheader

pls give me some inputs.

Thanks,

Venkat

Accepted Solutions (1)

Accepted Solutions (1)

former_member210661
Active Contributor
0 Kudos

Hi Venkat,

you can get the to address detail in your emailheader.htm view there if you observe page attribute there is structure CRMT_IC_EMAIL_RECIPIENT_DATA to_header  that is automatically populating the to address. try to read this and manipulate according to your requirement if you have any queries plz let me know.

Thanks & Regards,

Srinivas.

Former Member
0 Kudos

Thanks Srinivas for your reply,

i have checked the .htm page in mailheader view, yes there is to_header whcih is type CRMT_IC_EMAIL_RECIPIENT_DATA structure.

but the email id is generating/getting from CL_CMPIC_MAIL_WRAPPER_BASE=>FILL_TO_ADDRESS_ONNEW() method when i check it in debug mode.

so here inside this method i need to do modification

pls let me know how to implement this method.. this is standard class.

Thanks,

venkat

former_member210661
Active Contributor
0 Kudos

Hi venakt,

the main source of generation to mail bcc,cc is CL_CMPIC_MAIL_WRAPPER_SC class in that go to ONNEW, ONREPLY or onforward.. this are the methods which are trigger when ever you pressing any button like reply,new,forward.. so debug in to that methods you may come to know where you will get that address.. you can change the too,bcc,cc  address also observe this sc_icmail_2_maildata method too.

ex code: this method will give the too email deatils in lr_mail_data. in loop we are assigning too data..

sc_icmail_2_maildata(

           EXPORTING is_ic_mail             = currentmail

                     it_ic_mail_attachments = currentattachments

           IMPORTING er_mail_data           = lr_mail_data ).

         LOOP AT lr_mail_data->to ASSIGNING <fs_address>.

           lv_default_from = find_matching_outgoing_address( <fs_address>-address ).

           IF lv_default_from IS NOT INITIAL.

             EXIT.

           ENDIF.

         ENDLOOP.


so try to debug the methods which i have mention above class.


Regards,

Srinivas.

Former Member
0 Kudos

Hi Srinivas,

Thanks for reply, actually when i click the mailsender button on service request overview page that time CL_CMPIC_MAIL_WRAPPER_BASE=>FILL_TO_ADDRESS_ONNEW() is triggering.

if i want to modify the email id based on partner address number inside the above method or whatever you suggested class, those are standard classes which are triggering..

please let me know how to write my logic in those standard classes...

Thanks,

Venkat

former_member210661
Active Contributor
0 Kudos

Hi Venkat,

what my suggestion is you have to create implicit enhancement for that method and write the logic according to your requirement.

in menu goto edit->enhancement options->show implicit enhancement option and create enhancement write the condition according to your business role.

otherwise provide the break point in do_prepare_output of the email header view try to replicate the scenario which method is triggering first either do_prepare_output method or FILL_TO_ADDRESS_ONNEW method. i dont have access for checking because of that im giving instructions.

if do_prepare_out of the emailheader view will tirgger first time then do one thing enhance that.

write the logic like this.

declare gv_from1 in the impl class instance or static attribute .

data: gs_from TYPE ihttpnvp,

IF typed_context->mail->messagemode = 'New'. this is only trigger at first time( new mails)...

      CLEAR : me->gv_from1.

      SELECT ad_smtpadr werks bldg FROM yourtable INTO CORRESPONDING FIELDS OF TABLE lt_from WHERE userid = sy-uname.

      IF sy-subrc = 0.

        LOOP AT lt_from INTO ls_from.

          gs_from-name = ls_from-ad_smtpadr.

          gs_from-value = ls_from-ad_smtpadr.

          APPEND gs_from TO gv_from1.

          CLEAR : gs_from.

        ENDLOOP.

      ELSE.

        CALL FUNCTION 'BAPI_USER_GET_DETAIL'

          EXPORTING

            username      = sy-uname

            cache_results = 'X'

          TABLES

            return        = lt_return

            addsmtp       = lt_mail.

        IF lt_mail IS NOT INITIAL.

          READ TABLE lt_mail INTO wa_mail WITH KEY std_no = 'X'.

          gs_from-name = wa_mail-e_mail.

          gs_from-value = wa_mail-e_mail.

          TRANSLATE gs_from-name TO UPPER CASE.

          TRANSLATE gs_from-value TO UPPER CASE.

          APPEND gs_from TO gv_from1.

          CLEAR : gs_from.

        ENDIF.

      ENDIF.

    ENDIF.

use that attribute into your emailheader.htm view.

in your fromlist pass the gt_values..

ex code:

<thtmlb:dropdownListBox id                = "FromList"

                                    nameOfKeyColumn   = "NAME"

                                    nameOfValueColumn = "VALUE"

                                    selection         = "<%= gv_selection_from %>"

                                    width             = "100%"

                                    disabled          = "false"

                                    table             = "<%= CONTROLLER->GV_FROM %>" />

try to implement both you may get some idea..

Regards,

Srinivas.

former_member210661
Active Contributor
0 Kudos

Hi Venkat,

Did you resolve the issue..? if ur getting any problem please let me know.

Regards,

Srinivas.

Former Member
0 Kudos

Hi Srinivas,

when i click the MailSender button on overview page, first  ONNEW() method is triggering from the class CL_CMPIC_MAIL_WRAPPER_SC..

finally the email id is getting from method FILL_TO_ADDRESS_ONNEW() from CL_CMPIC_MAIL_WRAPPER_BASE class.

so you suggested me to implement the implicit enhancement for the above class. is there any other options instead of implicit enhancement..

suppose if i implement the enhancement in the above class is it possible to revert back the code if it is not required..

just i am asking i am new to enhancement for standard class.

Thanks,

Venkat

former_member210661
Active Contributor
0 Kudos

Hi Venkat,

what i said at first reply the class CL_CMPIC_MAIL_WRAPPER_SC will trigger when ever you click on reply,replyall,forward,new also.. but at that time what you said it is triggering another class. ok leave it.


if you enhance that method you can revert back that enhancement it is not an issue but suppose crmcmp_ccs_eml component is exists every business role then what are your changed code also will trigger all the business roles so you have to restrict that based on identifying your business role  if not then execute the standard code like.

Regards,

Srinivas.

Former Member
0 Kudos

Hi Srinivas,

actually for cl_cmpic_mail_wrapper_sc having super class CL_CMPIC_MAIL_WRAPPER_BASE..

inside this CL_CMPIC_MAIL_WRAPPER_BASE class method FILL_TO_ADDRESS_ONNEW( ) is getting the mailid of partner

ok.. i try to implement the implicit enhancement for the above method in SE80, below procedure i just followed

1. opened the classCL_CMPIC_MAIL_WRAPPER_BASE in se80, and selected the method FILL_TO_ADDRESS_ONNEW( )

2. now just click the spiral button(enhance) on toolbar, now from edit->show implicit enhancements.

3. now in the starting of the method  there is enhancement options(" " " """"""""") and belfore end of method  bottom level same lines are there..

4. i just right click on enhancement line and created the enhancement ZCL_fill_email under package.

5. now below enhancement created

         enhnacement 1 ZCL_FILL_EMAIL

*

         endenhancement.

6. Now i activated this method. and try to make it in change mode...

Here i am getting popup Access key required...

it is not allowing me to write any code inside.

pls let me know any steps which i am missing above.

Thanks,

Venkat

former_member210661
Active Contributor
0 Kudos

Hi Venkat,

what you have to do click on spiral nd place the cursor on your implementation name click on change mode. that will allow to change.

Ex:

Regards,

Srinivas.

Former Member
0 Kudos

Hi Srinivas,

Thanks now i am able to write inside enhancement.

Here i need to get the current service request/order id(which is from SRQM_INCIDENT_H/IncidentHeaderEF ), pls help me how to get that context node of this view here inside this enhancement.

.

Thanks,

Venkat

Former Member
0 Kudos

Hi Srinivas,

what i did in the event method of Mailsender button of SRQM_INCIDENT_H component overview page... i got the email id...

that i am exporting as memory ... then importing into to enhancement.

i will check that will work or not...

Thanks,

Venkat

former_member210661
Active Contributor
0 Kudos

Hi Venkat,

You will get con id in your enhancement based on that get the service order id. exporting into memory that will give redundancy issues in future so avoid that try to get service order id in to your enhancement itself.

there is a function module based on that your will get service order id.

just go through this link

if you solved your requirement

Please mark this Discussion with a Correct Answer and Helpful Answer where appropriate.  SeeHow to close a discussion and why  Even if you discovered the solution without any outside contributions, it helps others to understand what the solution turned out to be.

Regards,

Srinivas.

Former Member
0 Kudos

Hi Srinivas,

Thanks for your reply, sure i will give the marks and mark it as answered as you suggested. right now  with export it is working fine, i will check above suggested link also.

at present in SQRM_INCIDENT_H/overview component where i have partner number.  for this partner i need to get the i need to read the email from Address Independent data(BP_ADDR/IndependentEmail)

pls let me know how to access BP_ADDR component from SQRM_INCIDENT_H component.

Thanks,

Venkat

Former Member
0 Kudos

Hi Srinivas,

i can use BUPA_CENTRAL_GET_Detail function module...to read the address independent communication for partner.. but if we have more mail id's it will be difficlt to find which is assigned as independent communication email id in address independent assign block.

so if i able to access BP_ADDR in SQRM_INCIDENT_H ... then right email can get it.

Thanks,

Venkat

former_member210661
Active Contributor
0 Kudos

Hi Venkat,

Right now i don't have system access for giving right input so what my suggestion is based on partner number try to get email id using select statement. for example in but000 you will get partner nos right but already you have partner based on that you have to get address number for that partner so pass your partner in but000 you will get address number pass that address numbers into adr6 table will get all the emails for that partner.

try this this might be helpful to you.

Regards,

Srinivas.

Former Member
0 Kudos

Hi Srinivas,

I tried that, actually when we assigned the mail id at independent address communication block it may not update the ADR6 .. that is the reason with Select queries or BAPI_BUPA_CENTRAL_GETDETAIL is not helping me.

Regards,

Venkat

former_member210661
Active Contributor
0 Kudos

Hi Venkat,

you can do one thing use bp_addr component into your srqm_xx_h component i think is give long procedure to access this component and getting values. or load the bp_addr_search model and search partner related information into your component that is the best way.

example code

  1. *Get and prepare dynamic query service. 
  2. lr_qs ?= cl_crm_bol_dquery_service=>get_instance( 'BP_APPL' ). 
  3. * Set Query Parameters. 
  4. ls_param-name = 'MAX_HITS'
  5. ls_param-value = '5'
  6. APPEND ls_param TO lt_param. 
  7. lr_qs->set_query_parameters( lt_param ). 

go to this link in that there is bol search manipulate according to your requirement.



http://scn.sap.com/community/crm/webclient-ui-framework/blog/2013/11/28/sample-codes-for-bol-program...

Regards,

Srinivas.

Answers (0)