Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem getting data in Report

Former Member
0 Likes
1,196

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

10 REPLIES 10
Read only

Former Member
0 Likes
1,135

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.

Read only

0 Likes
1,135

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?

Read only

0 Likes
1,135

Just curious... in debug, does your ADRC internal table have 2 entries? Are both phone/fax numbers empty?

Read only

0 Likes
1,135

No it has only one entry and yeah both tel_number and fax_number are empty when i debug.

Regards,

D

Read only

0 Likes
1,135

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

Read only

0 Likes
1,135

Dev,

You will find the phone/fax numbers in table ADR2. Use ADDRNUMBER from ADRC.

Read only

0 Likes
1,135

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.

Read only

0 Likes
1,135

Watch the DATE_FROM and the fact that multiple phone/fax numbers CAN exist.... see counter field ADR2-consnumber

Read only

0 Likes
1,135

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.

Read only

0 Likes
1,135

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