‎2006 Dec 06 6:18 PM
Hi,
I have the following code in my report.
data: it_adrc type table of adrc.
data: wa_adrc type adrc.
perform get_address tables it_adrc
using add_partner.
loop at it_adrc into wa_adrc.
wa_output-country = wa_adrc-country.
wa_output-state = wa_adrc-region.
wa_output-name_co = wa_adrc-name_co.
wa_output-str_suppl1 = wa_adrc-str_suppl1.
wa_output-su_adr1 = wa_adrc-street.
wa_output-su_adr2 = wa_adrc-str_suppl3.
wa_output-su_street5 = wa_adrc-location.
wa_output-su_city = wa_adrc-city1.
wa_output-su_zip = wa_adrc-post_code1.
wa_output-su_ph = wa_adrc-tel_number.
wa_output-su_fax = wa_adrc-fax_number.
endloop.
form get_address tables it_adrc
using add_partner.
data: addrnum type but020-addrnumber.
select * into corresponding fields of table it_adrc
from ( adrc
inner join but020
on but020addrnumber = adrcaddrnumber )
where but020~partner = add_partner.
endform. " GET_ADDRESS
The problem is i am getting all the data for all the fields except for tel_number and fax_number.
When I debug i see that the values are not coming to wa_adrc though the tel_number and fax_number have values and it doesnt give any error. I dont understand why? Can someone please help me.
Regards,
D
‎2006 Dec 06 6:30 PM
In table ADRC - do you have multiple entries for the same address? Note that ADRC has a composite key with 2 additional fields.
I would think that you are getting an ADRC record with an earlier DATE_FROM on it... that has a blank phone and FAX number.
‎2006 Dec 06 7:03 PM
Yes John, when I go to BP tcode, I see the persons addr valid_from and valid_to dates are 02/17/2006 and 12/31/9999 respectively where as when i go to ADRC table i see that date_from is 01/01/0001 and date_to is 12/21/9999 but i see that there are values for tel_number and fax_number for this date(01/01/001).
hope i am clear.
I guess this is causing the problem but how can I overcome this? do you have any solution for this?
‎2006 Dec 06 7:13 PM
Just curious... in debug, does your ADRC internal table have 2 entries? Are both phone/fax numbers empty?
‎2006 Dec 06 7:16 PM
No it has only one entry and yeah both tel_number and fax_number are empty when i debug.
Regards,
D
‎2006 Dec 06 7:24 PM
Hi Dev
One suggestions, certain SAP transactions will store multiple addresses. For example IW31/32/33 PM work order has more than 2 address.
<b>I see the persons addr valid_from and valid_to dates are 02/17/2006 and 12/31/9999</b>
<b>where as when i go to ADRC table i see that date_from is 01/01/0001 and date_to is 12/21/9999</b>
From the above info address which has the tel_number and fax_number might be different. Try to search for the address using the tel_number and fax_number values you expect in ADRC. That might give you some clarity.
Regards
Kathirvel
‎2006 Dec 06 7:48 PM
Dev,
You will find the phone/fax numbers in table ADR2. Use ADDRNUMBER from ADRC.
‎2006 Dec 06 7:51 PM
Dev,
Use something like this:
select * into corresponding fields of table it_adrc
from ( adrc
inner join but020
on but020addrnumber = adrcaddrnumber )
inner join adr2
on adr2addrnumber = adrcaddrnumber
where but020~partner = par.
‎2006 Dec 06 7:52 PM
Watch the DATE_FROM and the fact that multiple phone/fax numbers CAN exist.... see counter field ADR2-consnumber
‎2006 Dec 06 8:03 PM
Note that FAX is in table adr3.
select * into corresponding fields of table it_adrc
from ( adrc
inner join but020
on but020addrnumber = adrcaddrnumber )
inner join adr2
on adr2addrnumber = adrcaddrnumber
inner join adr3
on adr3addrnumber = adrcaddrnumber
where but020~partner = par.
‎2006 Dec 06 8:33 PM
Hey John,
it works...yes i am able to get the tel_number( i didnt try the fax yet) but now i see what you were trying to say by that multiple entries.
now i have multiple entries for some records and the later entry is overwriting the first entry. what should i do now? Any help?
Regards,
D