cancel
Showing results for 
Search instead for 
Did you mean: 

Fetching and Printing Email Address of Customer

Former Member
0 Kudos

I thought I wrote the write code to fetch the email address of a customer from table adr6 once I know the ADDRNUMBER of the customer from the billing document. In the entry I want to print, there is no PERSNUMBER defined. Here is the code I have right now:

CLEAR GS_HD_ADR.

  • get customer adress number

READ TABLE IS_BIL_INVOICE-HD_ADR INTO GS_HD_ADR

WITH KEY BIL_NUMBER = IS_BIL_INVOICE-HD_GEN-BIL_NUMBER.

ADRNR = GS_HD_ADR-ADDR_NO.

select single smtp_addr into email_adr from adr6

where addrnumber eq adrnr.

Nothing is being set in email_adr. Any ideas why this is happening?

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Do I have to declare table ADR6 as an input parameter for my smartform in the form interface or global definitions or is it a global table that I can reference within any block of program lines?

Former Member
0 Kudos

Hi,

Get the Address number and person number from

VBPA based on the partner function for the customer.

Using address number you can get the email id from table ADR6 if its maintained,

else

using person number you can get the email id from

pa0105 table.

Regards.

Former Member
0 Kudos

Hi,

1.Once check by modifying the select as:

select single smtp_addr into email_adr from adr6

where addrnumber eq GS_HD_ADR-ADDR_NO.

2.Put a break-point and check the code.

I think it will work.

Regards,

Shiva Kumar(Reward if helpful).

Former Member
0 Kudos

So after setting a breakpoint, the email address is being set to email_adr but when I print it nothing is being printed. Here's what I do with the variable email_adr and see if you can see anything I'm doing wrong.

- email_adr is set in global variables with type like AD_SMTPADR

- Initialized as an output parameter in the global definitions -> initialization tab

- It is set with the ABAP code:

"CLEAR GS_HD_ADR.

READ TABLE IS_BIL_INVOICE-HD_ADR INTO GS_HD_ADR

WITH KEY BIL_NUMBER = IS_BIL_INVOICE-HD_GEN-BIL_NUMBER.

select single smtp_addr into email_adr from adr6

where addrnumber eq GS_HD_ADR-ADDR_NO.

ADRNR = GS_HD_ADR-ADDR_NO."

- It is defined as an output variable for the program line element under the address window

I am trying to print the email address by making a text element and printing it by saying "&email_adr&"

Edited by: mark lee on Apr 18, 2008 10:19 PM

Former Member
0 Kudos

Get the customer address number (ADRNR) from table KNA1.

And then hit the table ADRC by passing this ADRNR value to the field ADDRNUMBER in ADRC table and you can get the email address of the customer.

Thanks,

Srinivas

Former Member
0 Kudos

Neither table KNA1 or ADRC has an email address parameter. Do you see why it wouldn't work with my current table of ADR6?