Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

dynamic SELECT

Former Member
0 Likes
413

Hello experts,

I have a dynamic SELECT with different fields in the WHERE-clause. But in some tables on which the SELECT operates, the field mentioned in the WHERE-clause is not part of it and a DUMP is the result.

So is there a way to check, if all fields of the WHERE-clause are part of the table, before execute the SELECT-statement?

thx

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
386

Sure, you can come up with some logic and check the field names using the table DD03L. This table will give you the field names for the database table.

Regards,

Rich HEilman

2 REPLIES 2
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
387

Sure, you can come up with some logic and check the field names using the table DD03L. This table will give you the field names for the database table.

Regards,

Rich HEilman

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
386

Or you could use the RTTS services to retreive the names of the fields of a table.



report zrich_0001 .

type-pools: abap.

data : idetails type abap_compdescr_tab,
       xdetails type abap_compdescr.

data : ref_descr type ref to cl_abap_structdescr.

selection-screen begin of block b1 with frame title text .
parameters: p_table(30) type c.
selection-screen end of block b1.


* Get the structure of the table.
ref_descr ?= cl_abap_typedescr=>describe_by_name( p_table ).
idetails[] = ref_descr->components[].

loop at idetails into xdetails.
  write:/ xdetails-name.
endloop.

Regards,

Rich Heilman