‎2008 Aug 11 12:46 PM
Hi,
i have question:
what is the problem with this select.
select * from hrp1000
if sy-subrc is initial.
write'....'
endif.
Regards
‎2008 Aug 11 12:54 PM
U have to write select statement:
Either:
select * from hrp1000
if sy-subrc is initial.
write'....'
endif.
endselect.
OR:
select single * from hrp1000
if sy-subrc is initial.
write'....'
endif.
‎2008 Aug 11 12:51 PM
HI,
Ricardo has written-
select * from hrp1000
if sy-subrc is initial.
write'....'
endif.
In this case you are selecting the records from table but not mentioning where to store that records, Thats why the problem occur.
You have to mention INTO Clause and the internal table name to store selected data.
like below-
data: itab type table of hrp1000.
select * from hrp1000 into table itab.
if sy-subrc = 0.
write'....'.
endif.
Here itab is the internal table of the type hrp1000.
Regards,
Sujit
‎2008 Aug 11 1:01 PM
Hi ,
Thanks ,
u think that into is the problem ,
what about sy-subrc it can be initial or just get 0 4 8 .?
Regards
‎2008 Aug 11 12:53 PM
Hi....
There is no target area...
Declare one target variable.
or
use open cursor statement.
The correct similer statements are...
>select * from hrp1000 into corresponding fields of table itab.
>(here iatb with some fields of hrp1000)
&
>open cursor znav for select * from hrp1000.
>(here znav type cursor)
Thanks,
Naveen Inuganti.
‎2008 Aug 11 12:54 PM
U have to write select statement:
Either:
select * from hrp1000
if sy-subrc is initial.
write'....'
endif.
endselect.
OR:
select single * from hrp1000
if sy-subrc is initial.
write'....'
endif.
‎2008 Aug 11 1:01 PM
Hi.. Chandra...
What about the target area.??
Thanks,
Naveen Inuganti.
‎2008 Aug 11 1:03 PM
hi chandra madapati ,
sorry but the select is like that:
select * from hrp1000
if sy-subrc is initial.
write'....'
endif.
endselect.Regards
‎2008 Aug 11 1:23 PM
Hi
select * from hrp1000
if sy-subrc is initial.
write'....'
endif.
endselect.
in this condition.
sy-subrc value won't be ZERO.
that means it failed to get that data.
always SY-SUBRC is equal to ZERO only when above statement is correct other wise it will give 1 or 4 or 8 values
any thing you want from this.
‎2008 Aug 11 4:07 PM
‎2008 Aug 11 1:00 PM
Hello Ricardo,
If you don't use into clause then you should write ENDSELECT
after select.
or
Use select single.
These two are allowed only if work area hrp1000 is available.
Regards,
Subbu
‎2008 Aug 11 1:01 PM
Hi,
U can do like this also.
Tables hrp1000.
select * from hrp1000.
if sy-subrc is initial.
write'....'
endif.
endselect.
Regards,
Sunil Kumar M
‎2008 Aug 11 1:02 PM
Hi
In your SQL the INTO clause is missing.
i.e, Where you want to save the fetched data which is a variable or work area or internal table?
Eg
select * from hrp1000 into wa.
if sy-subrc <> 0.
write'....'
endif.
or
select * from hrp1000 into table itab.
if sy-subrc <> 0.
write'....'
endif.
Hope it helps.
Murthy
select * from hrp1000
if sy-subrc is initial.
write'....'
endif.
‎2008 Aug 11 1:07 PM
Hi
The main problem is you need to use INTO some internal table or work area.
you write a select statment with out where condition but needs a target location to store that results.
like this
select * from HRP1001 into table itab1.
in this case the total table values will be stored at itab1.
Regards
Naresh
‎2008 Aug 11 6:56 PM