Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Syntax for Nested Select Statement

Gday Guys,

I am having some dramas with this select statement. For the records in cust_info, when agencynum ne 0, I want to get the corresponding name field from stravelag into cust_info-name and write it. (along with all the other data in that row of cust_info)

I keep getting errors in the final select statement. Any ideas would be much appreciated.

Thanks

Stuart

at line-selection.

check not scustom-id is initial.

select fldate bookid carrid connid class agencynum from sbook

into cust_info

where customid = scustom-id

order by fldate.

if cust_info-agencynum = 0.

write:/ 'Agency Unknown',

40 cust_info-fldate,

55 cust_info-bookid,

70 cust_info-carrid,

85 cust_info-connid,

100 cust_info-class.

elseif cust_info-agencynum > 0.

select single name from stravelag

into cust_info

where agencynum = cust_info-agencynum.

write:/ cust_info-name.

endselect.

endif.

endselect.

write:/ sy-dbcnt.

Tags:

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question