03-14-2007 10:40 PM
Hello All,
I get this error:
"Program ZTEST
Field "HRP1000-OBJID" unknown."
when I run this query:
REPORT ZTEST.
data: end_date type sy-datum,
pos(40) type C,
user(12) type C.
select single stext from hrp1000 into pos
where hrp1000-objid = hrp9007-objid
and plvar eq '01'
and istat eq '1'
and begda le sy-datum
and endda ge sy-datum
and reqnr eq '297006'
and status eq '99'.
write pos.
Can anyone tell me whats the syntax in complex queries.
Regards.
Srinivas
03-14-2007 10:46 PM
First you need to select from that table before you can use it in another SELECT statement.
REPORT ZTEST.
data: end_date type sy-datum,
pos(40) type C,
user(12) type C.
data: wa_hrp9007 type hrp9007
select Single * from hrp2007 into wa_hrp9007
where ......... "<- Here you need to put the WHERE clause.
check sy-subrc = 0.
select single stext from hrp1000 into pos
where hrp1000-objid = wa_hrp9007-objid " Now you can use it here
and plvar eq '01'
and istat eq '1'
and begda le sy-datum
and endda ge sy-datum
and reqnr eq '297006'
and status eq '99'.
write pos.
Regards,
RIch Heilman
03-14-2007 10:46 PM
First you need to select from that table before you can use it in another SELECT statement.
REPORT ZTEST.
data: end_date type sy-datum,
pos(40) type C,
user(12) type C.
data: wa_hrp9007 type hrp9007
select Single * from hrp2007 into wa_hrp9007
where ......... "<- Here you need to put the WHERE clause.
check sy-subrc = 0.
select single stext from hrp1000 into pos
where hrp1000-objid = wa_hrp9007-objid " Now you can use it here
and plvar eq '01'
and istat eq '1'
and begda le sy-datum
and endda ge sy-datum
and reqnr eq '297006'
and status eq '99'.
write pos.
Regards,
RIch Heilman
03-14-2007 10:49 PM
Could you also tell the reason Rich.
And both the where cluses need to match I guess ?
Thanks and regards.
Srinivas
03-14-2007 10:46 PM
REPORT ZTEST.
data: end_date type sy-datum,
pos(40) type C,
user(12) type C,
p_objid type hrp1000-objid value '1234'
select single stext from hrp1000 into pos
where objid = p_objid
and plvar eq '01'
and istat eq '1'
and begda le sy-datum
and endda ge sy-datum
and reqnr eq '297006'
and status eq '99'.
write pos.
Just change the value of p_objid with the value you want.
Hope this helps,
'Sudhi
03-14-2007 11:00 PM
Hi,
It is a complex query,
I need to pull the stext from hrp1000 table, using "reqnr"(which is a field in hrp9007). So I will be first pulling the record first from hrp9007 based on reqnr and then pulling the stext from hrp1000 using objid from already pulled row(using reqnr).
Thanks all for your replies.
Can anyone give an idea how to write the query.
Regards
Srinivas
03-14-2007 10:47 PM
Hi,
The field hrp9007-objid is not declared in the program..
Declare the field and check the syntax again..
Thanks,
Naren
03-14-2007 11:36 PM