Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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.

Tags:
Former Member
Former Member replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question