2008 Apr 24 8:34 AM
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
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
2008 Apr 24 8:38 AM
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
2008 Apr 24 9:21 AM
Thanks for your reply, but I'm using select-options for this. That's why I had to put "IN."
2008 Apr 24 8:43 AM
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
2008 Apr 24 9:28 AM
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.
2008 Apr 24 9:26 AM
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.
2008 Apr 24 11:05 AM
2008 Apr 25 8:25 AM
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.
2008 Apr 24 11:08 AM
Hi,
tables: tbtco, tbtcp.
Define these two tables just above the select-options... it will work...
Regards,
Kumar.
2008 Apr 24 9:07 PM
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.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |