2007 Jul 05 10:35 PM
Hi All,
I am doing a FM by taking the firstname and last name and company name I have to get the BP data such as prefix, contact type, firstname, lastname, title, accounname and address with phone number, email.
I used the following code but I am unable to get the details.
Please help me in this issue
DATA : BEGIN OF it_but OCCURS 0,
prefix LIKE but000-prefix1,
contacttype LIKE but000-bpkind,
firstname LIKE but000-name_first,
lastname LIKE but000-name_last,
titl LIKE but000-title_let,
accountname LIKE but000-name_org1,
langu LIKE but000-langu_corr,
phone LIKE adrc-tel_number,
extens LIKE adrc-tel_extens,
alterphone LIKE adrc-tel_number,
alterextens LIKE adrc-tel_extens,
addr1 LIKE adrc-str_suppl1,
addr2 LIKE adrc-str_suppl1,
addr3 LIKE adrc-str_suppl3,
email LIKE adr6-smtp_addr,
city LIKE adrc-city1,
stat LIKE adrc-region,
postalcode LIKE adrc-post_code1,
countr LIKE adrc-country.
DATA : END OF it_but.
SELECT prefix1 bpkind name_first name_last title_let name_org1 langu_corr addrcomm INTO
(it_but-prefix,it_but-contacttype,it_but-firstname,it_but-lastname,
it_but-title,it_but-accountname,it_but-primarylanguage,addnum )
FROM but000 WHERE name_first = firstname AND name_last = lastname AND
name_org1 = company.
SELECT tel_number tel_extens fax_number fax_extens str_suppl1 str_suppl2 str_suppl3 city1 region
post_code1 country INTO (it_but-phone,it_but-extens,it_but-alterphone,
it_but-alterextens,it_but-addr1,it_but-addr2,
it_but-addr3,it_but-city,it_but-stat,it_but-postalcode,it_but-countr)
FROM adrc WHERE addrnumber = addnum.
Thanks in advance,
Bye,
Praveen
2007 Jul 05 10:52 PM
You will not get since you just comparing addnum.
first try to write query with BUT000 Table and keep the data into one internal table.
and get the data from ADRC Table with comparing BUT000 Internal table ( Try to use for all entries ),so that you will get exact data.
Thanks
Seshu
Hi All,
I am doing a FM by taking the firstname and last name and company name I have to get the BP data such as prefix, contact type, firstname, lastname, title, accounname and address with phone number, email.
I used the following code but I am unable to get the details.
Please help me in this issue
DATA : BEGIN OF it_but OCCURS 0,
prefix LIKE but000-prefix1,
contacttype LIKE but000-bpkind,
firstname LIKE but000-name_first,
lastname LIKE but000-name_last,
titl LIKE but000-title_let,
accountname LIKE but000-name_org1,
langu LIKE but000-langu_corr,
phone LIKE adrc-tel_number,
extens LIKE adrc-tel_extens,
alterphone LIKE adrc-tel_number,
alterextens LIKE adrc-tel_extens,
addr1 LIKE adrc-str_suppl1,
addr2 LIKE adrc-str_suppl1,
addr3 LIKE adrc-str_suppl3,
email LIKE adr6-smtp_addr,
city LIKE adrc-city1,
stat LIKE adrc-region,
postalcode LIKE adrc-post_code1,
countr LIKE adrc-country.
DATA : END OF it_but.
SELECT prefix1 bpkind name_first name_last title_let name_org1 langu_corr addrcomm INTO
(it_but-prefix,it_but-contacttype,it_but-firstname,it_but-lastname,
it_but-title,it_but-accountname,it_but-primarylanguage,addnum )
FROM but000 WHERE name_first = firstname AND name_last = lastname AND
name_org1 = company.
SELECT tel_number tel_extens fax_number fax_extens str_suppl1 str_suppl2 str_suppl3 city1 region
post_code1 country INTO (it_but-phone,it_but-extens,it_but-alterphone,
it_but-alterextens,it_but-addr1,it_but-addr2,
it_but-addr3,it_but-city,it_but-stat,it_but-postalcode,it_but-countr)
FROM adrc WHERE addrnumber = addnum.
Thanks in advance,
Bye,
Praveen
2007 Jul 05 10:52 PM
You will not get since you just comparing addnum.
first try to write query with BUT000 Table and keep the data into one internal table.
and get the data from ADRC Table with comparing BUT000 Internal table ( Try to use for all entries ),so that you will get exact data.
Thanks
Seshu
2007 Jul 05 11:40 PM
Hi
Thank you very much for your response.
I did the following code still I am unable to get entries into internal table.
FUNCTION zibp_rfc_search_complaint.
*"----
""Local Interface:
*" IMPORTING
*" VALUE(COMPANY) TYPE BU_NAMEOR1 OPTIONAL
*" VALUE(FIRSTNAME) TYPE BU_NAMEP_F OPTIONAL
*" VALUE(LASTNAME) TYPE NAME_LAST OPTIONAL
*" VALUE(PHONE) TYPE AD_TLNMBR1 OPTIONAL
*" VALUE(CITY) TYPE AD_CITY1 OPTIONAL
*" VALUE(STATE) TYPE REGIO OPTIONAL
*" VALUE(POSTALCODE) TYPE AD_PSTCD1 OPTIONAL
*" VALUE(EMAIL) TYPE AD_SMTPADR OPTIONAL
*" TABLES
*" T_CONTACT STRUCTURE ZST_COMPLAINTS_CUSTOMER OPTIONAL
*" ET_RETURN STRUCTURE BAPIRET2 OPTIONAL
*"----
DATA: BEGIN OF it_but OCCURS 0.
INCLUDE STRUCTURE but000.
DATA: END OF it_but.
DATA: BEGIN OF it_adrc OCCURS 0.
INCLUDE STRUCTURE adrc.
DATA: END OF it_adrc.
SELECT * FROM but000 INTO TABLE it_but
WHERE name_org1 LIKE company AND
name_first LIKE firstname AND
name_last LIKE lastname.
IF sy-subrc NE 0.
et_return-type = 'E'.
et_return-message = 'BP Notfound'.
APPEND et_return.
CLEAR et_return.
ELSE.
t_contact-prefix = it_but-prefix1.
t_contact-contacttype = it_but-bpkind.
t_contact-firstname = it_but-name_first.
t_contact-lastname = it_but-name_last.
t_contact-title = it_but-title_let.
t_contact-accountname = it_but-name_org1.
t_contact-primarylanguage = it_but-langu_corr.
for all entries
SELECT * FROM adrc INTO TABLE it_adrc
WHERE addrnumber = it_but-addrcomm.
IF sy-subrc EQ 0.
t_contact-phone = it_adrc-tel_number.
t_contact-extension = it_adrc-tel_extens.
t_contact-alternatephone = it_adrc-fax_number.
t_contact-alterextension = it_adrc-fax_extens.
t_contact-address1 = it_adrc-str_suppl1.
t_contact-address2 = it_adrc-str_suppl2.
t_contact-address3 = it_adrc-str_suppl3.
t_contact-city = it_adrc-city1.
t_contact-state = it_adrc-region.
t_contact-postalcode = it_adrc-post_code1.
t_contact-country = it_adrc-country.
ENDIF.
ENDIF.
ENDFUNCTION.
Please help me out in this.
Thanks,
Praveen
2007 Jul 06 12:47 AM
Hi Praveen,
have you checked in the debugging as where the code is failing. In which select query you are not getting the data.
Also check there should be entries into your DB tables.
Regards,
Atish
2007 Jul 06 1:57 AM
Last name, first name etc are text fields and case sensitive. So when you are creating a function module to do that, you have to make sure that the input is in the same way your database entries. Instead if you use the match code fields MC_NAME1 and MC_NAME2 and convert your input into upper case using TRANSLATE firstname TO UPPER CASE, you can compare them (first 35 characters only).
2007 Jul 09 1:50 PM
Hi there,
I have tried it.But I am not getting it.
Can you please help me out in this......
Thanks so much
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |