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

Query Issue...

Former Member
0 Likes
525

Hello Gurus,

I want to select records from BSAK in such a way that the BELNR, BUKRS and GJAHR does not exist in custom table 'ZCUSTOM'.

Following is the way to fetch data from BSAK. But how can I fetch it from based on above condition ?

select bukrs gjahr belnr
         from bsak into corresponding fields of table g_bsak
         where budat in s_budat and
                     bukrs in s_bukrs and
                     lifnr in s_vend.

Please Help.

Regards,

Jainam.

Edited by: Jainam Shah on Feb 12, 2010 11:51 PM

Edited by: Jainam Shah on Feb 12, 2010 11:52 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
492

hi,

try to use subquery:


select bukrs gjahr belnr
         from bsak AS F
         into corresponding fields of table g_bsak
         where budat in s_budat and
                    bukrs in s_bukrs and
                     lifnr in s_vend and
                     NOT EXISTS ( SELECT SINGLE * FROM zcustom
                        WHERE bukrs = F~bukrs
                              AND belnr = F~belnr
                             AND gjahr = F~gjahr ).

regards,darek

3 REPLIES 3
Read only

Former Member
0 Likes
493

hi,

try to use subquery:


select bukrs gjahr belnr
         from bsak AS F
         into corresponding fields of table g_bsak
         where budat in s_budat and
                    bukrs in s_bukrs and
                     lifnr in s_vend and
                     NOT EXISTS ( SELECT SINGLE * FROM zcustom
                        WHERE bukrs = F~bukrs
                              AND belnr = F~belnr
                             AND gjahr = F~gjahr ).

regards,darek

Read only

0 Likes
492

I get a error message syaing that do not use single addition in subquery.

Please help.

Regards,

Jainam.

Read only

0 Likes
492

sorry, try this code


select bukrs gjahr belnr
         from bsak AS F
         into corresponding fields of table g_bsak
         where budat in s_budat and
                    bukrs in s_bukrs and
                     lifnr in s_vend and
                     NOT EXISTS ( SELECT * FROM zcustom
                        WHERE bukrs = F~bukrs
                              AND belnr = F~belnr
                             AND gjahr = F~gjahr ).

regards