Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Need to pull contact person's email address

Former Member
0 Kudos
5,644

Can someone let me know what table I can reference to pull a contact person's email address??

We would like to pull the email address for a contact person for a specific order. The contact person is a partner function('AP') on the order. Thanks!!

1 ACCEPTED SOLUTION

Former Member
0 Kudos
587

HI,

Table ADR6.

Get the Address nummber from the ADRC and get emal id from ADR6

Manish

Message was edited by: Manish Kumar

8 REPLIES 8

Former Member
0 Kudos
588

HI,

Table ADR6.

Get the Address nummber from the ADRC and get emal id from ADR6

Manish

Message was edited by: Manish Kumar

Former Member
0 Kudos
587

Please check FM

BAPICONTACT_ADDRESSDATA

If you give the Customer for which you have created the Contact Person you will get the Address of the CP with email id

former_member187709
Active Participant
0 Kudos
587

Two tables can help you in the same

1. USR21 -User record Table

2. ADR6 - Mail address table

The field is ADR6-SMTP_ADDR.

Cheers!

Disha

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
587

Here is some code, you need to hit against VBPA and get the partner number PARNR, then call this BAPI.




data: contact_data type table of bapicontact_addressdata
                              with header line.
data: parms type table of bapicontact_idrange  with header line.


*  Get VBPA record here

parms-sign   = 'I'.
parms-option = 'EQ'.
parms-low    = xvbpa-parnr.
append parms.

call function 'BAPI_BUSPARTNEREMPLOYE_GETLIST'
     tables
          idrange     = parms
          addressdata = contact_data.

read table contact_data index 1.
if sy-subrc = 0.
  write:/ contact_data-e_mail.
endif.

Regards,

Rich Heilman

Former Member
0 Kudos
587

Thanks for everyone's help.

Here's the issue.

I need to use a combination of ADDRNUMBER and PERSNUMBER to pull the email address from ADR6.

in VBPA, I only have the ADRNR(which = ADDRNUMBER) and the PARNR which does NOt = PERSNUMBER

How can I link the PARNR to the PERSNUMBER so I can retrieve the email address?

Former Member
587

Hi,

Go to the table KNVK for the number of the contact person..You will get the person number PRSNR..

Thanks,

Naren

Former Member
587

Hi

Please find the code in accordance with my earlier post.

DATA: wa_bapireturn LIKE bapireturn1.

DATA: wa_custrange LIKE bapicustomer_idrange.

DATA: i_custrange LIKE TABLE OF bapicustomer_idrange.

DATA: i_cntaddress LIKE TABLE OF bapicontact_addressdata.

wa_custrange-sign = 'I'.

wa_custrange-option = 'EQ'.

wa_custrange-low = parnr(your parnr number).

APPEND wa_custrange TO i_custrange.

CLEAR wa_custrange.

CALL FUNCTION 'BAPI_CUSTOMER_GETCONTACTLIST'

IMPORTING

return = wa_bapireturn

TABLES

customerrange = i_custrange

contactaddressdata = i_cntaddress.

i_cntaddress-E_MAIL will contain the email id of the contact person.

587

This SQL works:

select single ADR6~SMTP_ADDR

from ( VBPA

inner join KNVK

on KNVKPARNR = VBPAPARNR

inner join ADR6

on ADR6PERSNUMBER = KNVKPRSNR )

where VBPA~PARVW = 'CP'

and VBPA~VBELN = "Sales Order Number".

I gave everyone points