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

Changes to existing query.

Former Member
0 Likes
1,080

Hello All,

I need to make changes to any existing query. The existing one fetches data only from a single table, but now I need to add 3 more fields in the output. These three fields are from a different table.

Can yo let me know, how can i achieve this.

Looking forward for your replies.

Thanks and Regards,

Santhosh Guptha N.

8 REPLIES 8
Read only

Former Member
0 Likes
1,000

hi,

If you find similar key fields or foreign keys in other table then you can use join, otherwise use 'FOR ALL ENTRIES' to get the records from second table based on first.

Read only

0 Likes
1,000

Hello Hari,

Thanks for your reply.

I need to make changes in a SAP QUERY(created through SQ01) and not in any of the reports.

Thanks and Regards,

Santhosh Guptha N.

Read only

0 Likes
1,000

Hi Santhosh,

For your reference.

[;

Regards,

Jithin

Read only

Former Member
0 Likes
1,000

hi,

Even in queries also you can use join, just add the new table, and select the required fields for output.

Read only

0 Likes
1,000

Hi..

Can you give me any pointers as to how do i do it?

Should i make the changes in the infoset and then make the same in the query, or can i do it directly in SQ01.

Thanks and Regards,

Santhosh Guptha N.

Read only

Former Member
0 Likes
1,000

Hi Santosh,

Please refer the below join statement where the value is selected from 2 different tables. hope it helps.


Select A~Vbeln
          A~vbtyp
          B~posnr
          B~erdat
          into table I_VBAP
          from vbak as A innner Join VBAP as B
          on  a~vbeln = b~vbeln
          where   a~vbeln IN lr_vbeln AND
                      b~posnr IN lr_posnr AND
                      b~aedat IN lr_aedat AND
                     ( a~vbtyp EQ 'A' OR
                       a~vbtyp EQ 'B' OR
                       a~vbtyp EQ 'G' ).

Regards,

Jithin

Read only

Former Member
0 Likes
1,000

hi,

You can add the second table in infoset using join option ,in query select the required field for output. Please check the key fields combination for join.

Read only

0 Likes
1,000

Hello Hari,

The join option is disabled in the query, which i am working on.

Can you please let me know, as to why is this, and how i can change the same.

Thanks and Regards,

Santhosh Guptha N