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 Join problem

Former Member
0 Likes
1,657

Hi Experts,

I need your help on this. I really don't know what's wrong with my select statment. Please let me know what went wrong. I'm not sure if select join statement allows parameters for select-options. Below is my select statement. Thanks.

SELECT tbtcojobname tbtcplistident

INTO CORRESPONDING FIELDS OF TABLE itab

FROM tbtco JOIN TBTCP ON ( tbtcojobcount = tbtcpjobcount )

WHERE tbtco~status = 'F'

AND tbtco~jobname IN P_SEARCH

AND tbtco~enddate IN p_date

AND tbtcp~listident IN p_spool.

IF sy-subrc = 0.

APPEND itab.

CLEAR itab.

ENDIF.

Anna

9 REPLIES 9
Read only

PS_1978
Active Participant
0 Likes
1,415

Hi,

if those are the parameters, use EQ instead of IN. There is no need of APPEND ITAB statement as you are using INTO CORRESPONDING FIELDS OF TABLE ITAB.

Best Regards,

Kumar. S

Edited by: Sivapuram Phani Kumar on Apr 24, 2008 1:08 PM

Read only

Former Member
0 Likes
1,415

Thanks for your reply, but I'm using select-options for this. That's why I had to put "IN."

Read only

Former Member
0 Likes
1,415

hi try


SELECT tbtco~jobname tbtcp~listident
INTO CORRESPONDING FIELDS OF TABLE itab
FROM ( tbtco INNER JOIN TBTCP ON tbtco~jobcount = tbtcp~jobcount AND tbtcp~listident IN p_spool )
WHERE tbtco~status = 'F'
AND tbtco~jobname IN P_SEARCH
AND tbtco~enddate IN p_date.

bye

reward if useful

Read only

0 Likes
1,415

Hi Matthias,

Thanks so much for your reply but sad to say that your suggestion prompted an error that "You cannot use "IN" in "ON" conditions.

Read only

Former Member
0 Likes
1,415

Just to give you an idea: Here's what I did.

SELECT-OPTIONS: p_search FOR TBTCO-jobname,

p_date FOR TBTCO-enddate,

p_spool FOR TBTCP-listident.

DATA: BEGIN OF itab OCCURS 0,

sp_name TYPE tbtco-jobname,

br_code(1),

dumon(7),

sp_numb TYPE TSP01-rqident,

ofc(12),

END OF itab.

SELECT tbtcojobname tbtcplistident

INTO CORRESPONDING FIELDS OF TABLE itab

FROM tbtco JOIN TBTCP ON ( tbtcojobcount = tbtcpjobcount )

WHERE tbtco~status = 'F'

AND tbtco~jobname IN P_SEARCH

AND tbtco~enddate IN p_date

AND tbtcp~listident IN p_spool.

IF sy-subrc = 0.

APPEND itab.

CLEAR itab.

ENDIF.

Read only

Former Member
0 Likes
1,415

Hi,

Are you getting any error?

Regards,

Pria.

Read only

0 Likes
1,415

Hi Pria,

Actually there's no error. The sy-subrc actually returns 0, but it doesn't save the data in the internal table. Anyway to solve this problem, I did the long way. I copied one table into an itab and just did looping. I just had this idea that maybe SELECT-JOIN statements don't accept parameters selection-options.

Read only

PS_1978
Active Participant
0 Likes
1,415

Hi,

tables: tbtco, tbtcp.

Define these two tables just above the select-options... it will work...

Regards,

Kumar.

Read only

Former Member
0 Likes
1,415

Hi,

You can use select-options in u r where condition with IN operator so it should perfectly work and the error u r getting is not because of join statement so try declaring tables that u r using in u r select-options to avoid fields are not found and try ,it should work then.

reward if it is useful.

Thanks,

Ramesh.