Skip to Content
avatar image
Former Member

Get Email address using Order number

Hello experts,

I just have a simple question.

If I have an order number, how do I get the email address attached to that order?

I know how to query the data from tables. But, I'm looking for function modules.

Please help. Thank you.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Jan 12, 2015 at 09:49 AM

    Hi Maren,

    You can you the below code to fetch the e-mail address.

    DATA: lv_guid TYPE crmt_object_guid,

           lt_adsmtp TYPE TABLE OF bapiadsmtp,

           lv_bp TYPE bapibus1006_head-bpartner,

           ls_partner TYPE crmt_partner_external_wrk.

    CALL FUNCTION 'CRM_HEADER_OBJ_ID_GET_GUID'

       EXPORTING

         iv_obj_id      = lv_order_id

       IMPORTING

         ev_guid        = lv_guid

       EXCEPTIONS

         error_occurred = 1

         OTHERS         = 2.

    CALL FUNCTION 'CRM_PARTNER_READ_OW'

       EXPORTING

         iv_ref_guid          = lv_guid

         iv_ref_kind          = 'A'

    *   IV_PARTNER_FCT       =

       IMPORTING

         es_partner_wrk       = ls_partner

       EXCEPTIONS

         error_occurred       = 1

         parameter_error      = 2

         entry_does_not_exist = 3

         OTHERS               = 4.

    lv_bp = ls_partner-ref_partner_no.

    UNPACK lv_bp TO lv_bp.

    CALL FUNCTION 'BAPI_BUPA_ADDRESS_GETDETAIL'

       EXPORTING

         businesspartner = lv_bp

       TABLES

         bapiadsmtp      = lt_adsmtp.


    You will get email in lt_adsmtp table in 'E_MAIL' field.


    Thanks,

    Ritu

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 19, 2015 at 01:26 AM

    Thanks Ritu.

    This is what I was looking for... thanks. 😊

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 10, 2015 at 01:20 PM

    Hi Maren Ezhno,

    go through this CRM_LOY_MSH_EMAIL_ADDRESS. function module pass the ID  in to the IV_MEMB_ID you will get the email and address of the particular ID.

    another function module CRM_EMAIL_READ_PARTNER_ADDRESS pass the partner or order number then you will get the ES_PARTNER_ADDRESS in that there is a email field.. you can get that field using read table.

    Thanks & Regards,

    Srinivas.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 12, 2015 at 04:41 AM

    Hi Maren,

    I believe you could have got this with some basic search in SCN.

    Get the partners from CRM CRM_ORDER_READ and then use BUPA_ADDRESS_GET_DETAIL to get the email. Here you can get the email address in ET_ADSMTP.

    @Srinivas: I don't think CRM_LOY_MSH_EMAIL_ADDRESS is suitable for this requirement as there is no membership or loyalty in picture. There is a good chance to fail the FM when there is no corresponding membership created for a BP if we use this FM.

    Thanks,

    Faisal

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Faisal,

      i have suggested that 2 function modules because he want only mail id based on order before point out kindly read what he as posted..

      Thanks & Regards,

      Srinivas.

  • avatar image
    Former Member
    Jan 12, 2015 at 05:23 AM


    Faisal,


    Thanks for your response.


    Can you tell me how we can pass the order number to CRM_ORDER_READ and get the partner details?

    Add comment
    10|10000 characters needed characters exceeded