09-04-2008 10:18 AM
wresult is the internal table which i have uploaded from local file,
wresult has some records in it.
i have to compare the records in it with the standard table say draw.
but it doesnt work.....
LOOP AT wresult .
SELECT single * FROM draw
WHERE dokar EQ wresult-dokar
and doknr EQ wresult-doknr
and dokvr EQ wresult-dokvr.
IF sy-subrc EQ 0.
write: / 'Success'.
endif.
endloop.
09-04-2008 10:31 AM
Hi,
Check for the below two conditions.
1)The fields in the internal table should of same type that you are using for fetching the data from the table draw by using select query.
2)Whether the data is present in the table draw for the records in the internal table
write the code as follows and check again
LOOP AT wresult .
SELECT single * FROM draw
WHERE dokar EQ wresult-dokar
and doknr EQ wresult-doknr
and dokvr EQ wresult-dokvr.
IF sy-subrc EQ 0.
write: / 'Success'.
else.
write:/ 'Failure'.
endif.
endloop.
09-04-2008 10:21 AM
Database table DRAW can have multiple records for entered conditions. Please check.
Regards,
Aparna Gaikwad
09-04-2008 10:23 AM
09-04-2008 10:22 AM
Hi,
Go with for all entries. So your select query would be as follows :
Data :
t_draw like standard table of DRAW.
SELECT * FROM draw
into t_draw
for all entries in wresult
WHERE dokar EQ wresult-dokar
and doknr EQ wresult-doknr
and dokvr EQ wresult-dokvr.
Regards,
Swapna.
09-04-2008 10:22 AM
Hi,
What Error message are you getting?
Place an into addition to the Select Query.
Check the Internal table if it has fileds which you are comparing.
Regards
Sumit Agarwal
09-04-2008 10:22 AM
Hi,
Can you please throw some light on how you declared the internal table? is it with header line?
Regards,
Surinder
09-04-2008 10:28 AM
Hi,
Remove one or more conditions to check which condition is getting failed..
Regards
Mudit
09-04-2008 10:31 AM
Hi,
Check for the below two conditions.
1)The fields in the internal table should of same type that you are using for fetching the data from the table draw by using select query.
2)Whether the data is present in the table draw for the records in the internal table
write the code as follows and check again
LOOP AT wresult .
SELECT single * FROM draw
WHERE dokar EQ wresult-dokar
and doknr EQ wresult-doknr
and dokvr EQ wresult-dokvr.
IF sy-subrc EQ 0.
write: / 'Success'.
else.
write:/ 'Failure'.
endif.
endloop.
09-04-2008 10:32 AM
Hi,
Use another internal table and use for all entries.
TABLES:
draw.
DATA:
ITAB like table of draw.
SELECT *
FROM draw
INTO itab
for all entries in wresult
WHERE dokar EQ wresult-dokar
and doknr EQ wresult-doknr
and dokvr EQ wresult-dokvr.
With luck,
Pritam.
09-04-2008 10:37 AM
To use the default workarea you need to use the below statement.
Tables : Draw.
09-04-2008 10:37 AM
Hi,
First, You should not use select statement in a loop because of performance issues, you can do like that,
select * DRAW into it_draw from DREW
for all entries in wresult
WHERE dokar EQ wresult-dokar
AND doknr EQ wresult-doknr
AND dokvr EQ wresult-dokvr.
loop at wresult into wa_result,
read table it_drew into wa_drew with key dokar EQ wa_drew-dokar
AND doknr EQ wresult-doknr
AND dokvr EQ wresult-dokvr.
IF sy-subrc EQ 0.
write: / 'Success'.
endif.
endloop.