2008 Aug 12 11:44 AM
Hi Gurus,
Is there any BAPI or FM which will give me email id if I pass value KUNNR.
Regards,
raghu.
2008 Aug 12 11:53 AM
Hi ,
From KNA1 you will get the adress no (ADRNR).
You have pass this both combination to ADR6 table in (ADDRNUMBER and PERSNUMBER).
Regards.
Eshwar.
2008 Aug 12 11:50 AM
Hi
Write a select single query to get the email ID from ADR6 based on the ADRNR of the Customer number KUNNR.
Regards,
Dwarakanath.S
2008 Aug 12 11:51 AM
Just create a new Z Function module with...
Import parameters as
i_vbeln like vbpa-vbeln
i_parnr like vbpa-parnr
i_flag like adr6-flgdefault
tables as
t_text like ZZTEXT....
Here ZZTEXT is a structure with fields...
object (tdobject)
name (tdobname)
id (tdid)
spras (tdspras)
tdformat (tdformat)
line (tdline)
Add the below code...
From Master Data
if not I_parnr is initial.
SELECT single prsnr kunnr
into (vbpa-adrnp, knvk-kunnr)
fROM KNvk
WHERE parnr = I_parnr.
SELECT single adrnr
into vbpa-adrnr
fROM KNA1
WHERE KUNNR = knvk-kunnr.
vbpa-adrda = 'E'.
vbpa-parnr = I_PARNR.
endif.
From Sales Document
if not i_vbeln is initial.
clear vbpa.
SELECT single * FROM VBPA
WHERE vbeln = i_vbeln
and posnr = '000000'
and parvw = 'AP'.
endif.
Get Email Address
CASE VBPA-ADRDA.
WHEN 'A' OR 'B' OR 'C' OR SPACE.
"31I Data
Order Header Text - Contact Person E-Mail (CP)
PERFORM READ_TEXT TABLES T_TEXT USING 'E' 'ZEML' I_VBELN 'VBBK'.
WHEN 'E' OR 'F' OR 'D'. "47 Data
select * from adr6
where addrnumber = vbpa-adrnr
AND persnumber = vbpa-adrnp
and date_From le sy-datum
and flg_nouse eq space.
*----
Condition added to select default email id from master for DW - Z1RS
*----
if i_flag = 'X'.
if ADR6-FLGDEFAULT eq space.
continue.
endif.
endif.
*----
t_text-name = vbpa-parnr.
t_text-object = 'KNVK'.
t_text-id = 'ZEML'.
t_text-spras = 'E'.
t_text-tdformat = '*'.
t_text-line = adr6-smtp_addr.
append t_text.
endselect.
WHEN OTHERS.
ENDCASE.
ENDFUNCTION.
----
FORM READ_TEXT *
----
FORM read_text TABLES w_lines STRUCTURE zztext
USING w_langu w_id w_name w_object.
DATA: id LIKE thead-tdid,
name LIKE thead-tdname,
langu LIKE thead-tdspras,
object LIKE thead-tdobject,
lines LIKE tline OCCURS 100 WITH HEADER LINE.
Reset Value.
id = w_id.
name = w_name.
langu = w_langu.
object = w_object.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = id
language = langu
name = name
object = object
TABLES
lines = lines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
LOOP AT lines.
w_lines-name = name.
w_lines-object = object.
w_lines-id = id.
w_lines-spras = langu.
w_lines-tdformat = lines-tdformat.
w_lines-line = LINES-TDLINE.
APPEND w_lines.
ENDLOOP.
2008 Aug 12 11:53 AM
Hi ,
From KNA1 you will get the adress no (ADRNR).
You have pass this both combination to ADR6 table in (ADDRNUMBER and PERSNUMBER).
Regards.
Eshwar.
2008 Aug 12 12:25 PM
Hi All,
Thanks for the reply.Actually customer doesnot want a select query on KNA1 and then on adr6 due to performance issues.
So thats why searching for FM.
2008 Aug 12 1:10 PM
HI Raghu,
Even in the Function modules, one has to write the select query on one of this tables to get the Email ID.
I don't think you will have a function module which gets the Email ID only. There might be some other logic along with this in the FM which causes performance issues.
So i think u better go for writing a
Select single (Email ID field) into gv_emailid from ADR6 table.
With Regards,
Dwarakanath.S
2012 May 11 2:46 PM
Look into following FM's:
1. ADDR_SELECT_ADRC_SINGLE
2. ADDR_SELECT_ADRC_ARRAY