Application Development 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: 

Problem in getting table entries in address tables

former_member342013
Contributor
0 Kudos
584

Hi All ,

I have attached my program ..

My Requirement is as below .....

I need individual entry for ADR2 ADR3 and ADR6 Tables

EG : If i have 2 entries in table ADR2 and 3 entries in ADR3 table and 5 entries in ADR6 table .. I need all these entries in my final out put file .....

Now im getting only one entry in my final output file .....

Tried using Left Oter join and did not work out ....

Please provide me the logic to get the data .

Regards

Smitha

1 ACCEPTED SOLUTION

Former Member
0 Kudos
175

hi,

u can use joins to combine three tables values in single one.whether u tried using joins???

Regards,

gopi

10 REPLIES 10

Former Member
0 Kudos
175

U can also use SQVI to get the same link all table that it and you will get all entries ....

Former Member
0 Kudos
176

hi,

u can use joins to combine three tables values in single one.whether u tried using joins???

Regards,

gopi

0 Kudos
175

Hi Gopi ,

Yep i tries using Left outer join but im not getting values properly ...

if t_but020[] is not initial.

select  a~ADDRNUMBER

        a~COUNTRY

        a~TEL_NUMBER

        a~TEL_EXTENS

        a~TELNR_LONG

        a~TELNR_CALL

*       c~ADDRNUMBER1

        c~SMTP_ADDR

from ADr2 as A

LEFT Outer Join ADR6 AS C ON a~addrnumber = c~addrnumber

and a~CONSNUMBER = c~CONSNUMBER

into corresponding fields of table itab

for all entries in t_but020

where a~addrnumber = t_but020-addrnumber.

im getting all the entries for ADR2 but not for ADR6 .

EG : in ADR2 i have 2 entries 001 and 002 which is populating in itab .

        but in ADR6 i have 3 entries

        001, 002 and 003 but in this case only 2 values (001 and 002) are populating in itab but 003 is not populating... how to do this ?

Regards

Smitha

0 Kudos
175

hi smitha,

you just check with innerjoin and full outer join. just check the values. if u left outer joins A left outer join will give all rows in A, plus any common rows i c.if there is no value means it just show null value. if you use inner joins means oly common fields avaiable in both table ll be display. that time u can find. my server is not switched off. for that time u just check. after i switch on i ll check and tell.

regards,

gopi

0 Kudos
175

Hi Smitha,

  You can opt this by any of the following 2 methods:

1.) Either try to achieve this by using for all entries. You have to write select query for all 3 tables but you can control the data flow after each selection.

2.) If you want to go with join only then try to put all the Key fields in your internal table ITAB.

Basically Joins will perform well if you have all the key fields in where clause.

Thanks,

Prakash

0 Kudos
175

Hi Smitha

Can you please comment this statement and check and a~CONSNUMBER = c~CONSNUMBER

Nabheet

0 Kudos
175

Hi Smitha,

please write your code logic as shown below, please change is according to your data.

select  a~ADDRNUMBER

        a~COUNTRY

        a~TEL_NUMBER

        a~TEL_EXTENS

        a~TELNR_LONG

        a~TELNR_CALL

*       c~ADDRNUMBER1

        c~SMTP_ADDR

      INTO TABLE itab

      for all entries in t_but020

      FROM ADr2 as A INNER JOIN ADR6 AS C ON a~addrnumber EQ c~addrnumber

                                                                                          and a~CONSNUMBER EQ c~CONSNUMBER

                                                                      where a~addrnumber = t_but020-addrnumber.

Former Member
0 Kudos
175

Hi,

If you are using left outer join i think the table with max rows(ADR6 Table) should be fetched first and based on that you can fetch the data from ADR3 and ADR2.

Try this. I think this will help.

Regards

0 Kudos
175

Hi Amaranatha ,

Thanks for the reply ......

Thought of this way .... but .. how will i know which table has maximum numbers ?

Always ADR6 will not have maximum numbers ....

Please suggest how to do this ?

0 Kudos
175

Hi,

You can read the number of rows in the 3 internal table using

Describe table <table name> lines <vlines>.


After this compare the three variables.

Find the descending order of the three variables and pass the values to a sub routine.

In the sub routine make the where clause of the select statement a dynamic one, based on the values passed to the sub routine.


This is one of a way. You can try this.


Regards.