2007 Jun 21 12:53 PM
Hi,
I´m searching for the relation between the table KNB1 and the ADR6 to find the email of a customer, but I´m having serious problems.
Can someone help me, please????
Thanks!!
2007 Jun 21 1:45 PM
Here is the code for you Email id from KNB1 and ADR6 .....
REPORT ZAASD line-size 100.
tables : KNA1 , knb1 , adr6 .
data : begin of IT_DATA occurs 0 .
include structure KNB1 .
DATA :end of iT_DATA .
*
data : begin of IT_DATA2 occurs 0,
kunnr LIKE kna1-kunnr ,
adrnr LIKE KNA1-adrnr,
addrnumber LIKE adr6-addrnumber ,
SMTP_ADDR like adr6-SMTP_ADDR ,
end of iT_DATA2 .
select-options :s_kunnr for knb1-kunnr..
*
SELECT * FROM KNB1 INTO TABLE IT_DATA
WHERE KUNNR IN s_kunnr.
*
IF sy-subrc EQ 0.
SELECT KNA1~KUNNR kna1~adrnr adr6~addrnumber adr6~SMTP_ADDR INTO TABLE IT_DATA2
FROM KNA1 LEFT OUTER JOIN adr6 ON kna1~adrnr EQ adr6~addrnumber
FOR ALL ENTRIES IN IT_DATA
WHERE KNA1~KUNNR EQ IT_DATA-KUNNR .
ENDIF.
LOOP AT IT_DATA2 .
WRITE : / IT_DATA2-KUNNR , IT_DATA2-ADRNR ,IT_DATA2-SMTP_ADDR .
ENDLOOP.
reward points if it is usefull....
Girish
Girish
Hi,
I´m searching for the relation between the table KNB1 and the ADR6 to find the email of a customer, but I´m having serious problems.
Can someone help me, please????
Thanks!!
2007 Jun 21 12:56 PM
Hello,
<b>KNB1-PERNR and ADR6-PERNR
KNB1-ADRNR and ADR6-ADRNR</b>
VAsanth
2007 Jun 21 12:56 PM
try KNA1/KNB1 and get ADRNR of customer to get data from ADR6.
Regards
peram
2007 Jun 21 12:58 PM
2007 Jun 21 1:01 PM
In the table ADR6 I find the field persnumber, in the table KNB1 the field PERNR, and they are differents
2007 Jun 21 1:03 PM
using customer number from KNb1, goto KNA1 and get ADRNR for that customer, then goto ADR6 using ADRNR and find out the mail id
2007 Jun 21 1:05 PM
Hello,
DO like this.
data: lv_email like adr6-SMTP_ADDR.
Select single SMTP_ADDR from adr6 into lv_email where PERSNUMBER = knb1-pernr.
write: lv_email.
Vasanth
2007 Jun 21 1:06 PM
Thanks, but the persnumber and the pernr have differents values.
2007 Jun 21 1:01 PM
You have to link via KNA1 (field ADRNR), then link KNA1 to KNB1
2007 Jun 21 1:02 PM
2007 Jun 21 1:15 PM
This will be true if your customer is set up in more than one company code.
What data do you need from KNB1?
2007 Jun 21 1:45 PM
Here is the code for you Email id from KNB1 and ADR6 .....
REPORT ZAASD line-size 100.
tables : KNA1 , knb1 , adr6 .
data : begin of IT_DATA occurs 0 .
include structure KNB1 .
DATA :end of iT_DATA .
*
data : begin of IT_DATA2 occurs 0,
kunnr LIKE kna1-kunnr ,
adrnr LIKE KNA1-adrnr,
addrnumber LIKE adr6-addrnumber ,
SMTP_ADDR like adr6-SMTP_ADDR ,
end of iT_DATA2 .
select-options :s_kunnr for knb1-kunnr..
*
SELECT * FROM KNB1 INTO TABLE IT_DATA
WHERE KUNNR IN s_kunnr.
*
IF sy-subrc EQ 0.
SELECT KNA1~KUNNR kna1~adrnr adr6~addrnumber adr6~SMTP_ADDR INTO TABLE IT_DATA2
FROM KNA1 LEFT OUTER JOIN adr6 ON kna1~adrnr EQ adr6~addrnumber
FOR ALL ENTRIES IN IT_DATA
WHERE KNA1~KUNNR EQ IT_DATA-KUNNR .
ENDIF.
LOOP AT IT_DATA2 .
WRITE : / IT_DATA2-KUNNR , IT_DATA2-ADRNR ,IT_DATA2-SMTP_ADDR .
ENDLOOP.
reward points if it is usefull....
Girish
Girish
2007 Jun 21 3:24 PM
2007 Jun 21 3:23 PM
2007 Jun 21 3:25 PM
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |