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

select and endselect with append statment

former_member770121
Participant
0 Likes
2,364

first select query ..............

second select query ................

append wa to it.

endselect.

endselect.

bascially first iteration get write data and appned but in second iteration it complete fetch the data of second select query and appned and then after it go to first select query then fetch data from data base table and then append it show output of 4 lines but i want the output of just 2 lines

mean fetch data from first and second select query at same time and append same iteration then second iteration fetch data from both select queries then append at same time please suggest any solution for ALV

first select query ..............

second select query ................

append wa to it.

endselect.

endselect.

bascially first iteration get write data and appned but in second iteration it complete fetch the data of second select query and appned and then after it go to first select query then fetch data from data base table and then append it show output of 4 lines but i want the output of just 2 lines

mean fetch data from first and second select query at same time and append same iteration then second iteration fetch data from both select queries then append at same time please suggest any solution for ALV

10 REPLIES 10
Read only

FredericGirod
Active Contributor
0 Likes
2,193

Are you trying to rebuild the INNER JOIN ?

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,193

Your problem is not about ALV (the final goal), it's about how to fill the internal table from database tables.

I don't understand your question, please share the code you have tried.

Moreover please edit your question, select your code and press the button [CODE], which makes the code appear colored/indented, it will be easier for people to look at it. Thank you!

Read only

former_member770121
Participant
0 Likes
2,193

there is no field we can apply join so join is not possible

Read only

former_member770121
Participant
0 Likes
2,193

code is:::

select field from table into wa where......

select field2 from table2 into wa where......

append wa to it.

endselect.

endselect.

first it complete iteration of nearest select query and then it move to second select query

output shoould be:::

1 2 3

4 5 ( 2 and 4) from first select query data and (3 and 5 )is output of second select query

but it display output is 4 lines. there we cannot apply join please suggest any solution

Read only

0 Likes
2,193

Please use CODE button to format your text.

See how I do it:

select field from table into wa where......
  select field2 from table2 into wa where......
    append wa to it.
  endselect.
endselect.

Input from "table":

2
4

Input from "table2":

3
5

Actual output:

3
5
3
5

output shoould be:::

2   4
3   5

I guess you want to transpose, right?

Read only

0 Likes
2,193

I also put the same code as u write but this logic is not wright???

Read only

0 Likes
2,193

You didn't understand. I have just rewritten your own code, I'm just asking you to pay attention to formatting of your question and comments. You missed the important thing of what I said. Never mind.

Read only

0 Likes
2,193

output of first internal table is::

1 2 3

4 5

in second internal table we also get two values like :

1 6

7

HOW I CAN APPEND THE VALUE OF SECOND INTERNAL TABLE IN FIRST INTERNAL TABLE WITH EXISTING DATA + WITH CURRENT LINE

MY DESIRED OUTPUT IS :::::

1 2 3 6

4 5 7

IN ALV

PLWASE SUGGEST SOLUTION NOW

How can move data from one internal table to another internal table with existing data.

Read only

ThorstenHoefer
Active Contributor
0 Likes
2,193

Hi,

instead of

select ...
append wa to lt_table
endselect

try to use

 select *
from ..
appending table lt_table.
Read only

former_member770121
Participant
0 Likes
2,193

it is not working