Dynamic Select in ABAP termintes

80 pts.
Tags:
ABAP
Dynamic Select in ABAP
Dynamic tables in select
Dynamic target area in select
Dear abap experts, The following sample report has a dynamic select statement which works for any table but it terminates at runtime for tables which include numeric fields of type i, p, or f. The error message is, "The data object cannot be converted to a character-type object." Is there any syntax in abap which gets around this problem? REPORT ZYJK_DYNAMIC_WA2 MESSAGE-ID ZF. parameters: ptabname type tabname default 'T001'. parameters: pcount type i default '10'. data: vcount type i. data: wa type ref to data. FIELD-SYMBOLS: <wa> TYPE ANY. create data wa type (ptabname). assign wa->* to <wa>. Select * into <wa> from (ptabname). if vcount > pcount. Exit. Endif. write: / <wa>(60). add 1 to vcount. endselect.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Try

FIELD-SYMBOLS: <fs> type any.
.
.
new-line.
while sy-subrc = 0.
assign component sy-index of structure <wa> to <fs>.
write: <fs>.
endwhile.

instead of

write: / <wa>(60).

Best wishes
VV

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following