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 Where Clause

Former Member
0 Likes
566

Hi,

Iam getting a Runtime Error when iam execuating the below select statement.iam calling IT_WHERE dynamically.

  DATA : IT_WHERE like RFC_DB_OPT OCCURS 0 WITH HEADER LINE.
SELECT SINGLE KNUMH INTO <FS4>-KNUMH FROM (GLOBAL-KOTABNR)
                          WHERE KSCHL = <FS4>-KSCHL
                               AND KAPPL = 'V '
                               AND ( DATBI GE SY-DATUM
                               AND   DATAB LE SY-DATUM )
                            <b>AND (IT_WHERE).</b>

Thanks

Vikranth Khimavath

Hi,

Iam getting a Runtime Error when iam execuating the below select statement.iam calling IT_WHERE dynamically.

  DATA : IT_WHERE like RFC_DB_OPT OCCURS 0 WITH HEADER LINE.
SELECT SINGLE KNUMH INTO <FS4>-KNUMH FROM (GLOBAL-KOTABNR)
                          WHERE KSCHL = <FS4>-KSCHL
                               AND KAPPL = 'V '
                               AND ( DATBI GE SY-DATUM
                               AND   DATAB LE SY-DATUM )
                            <b>AND (IT_WHERE).</b>

Thanks

Vikranth Khimavath

2 REPLIES 2
Read only

Former Member
0 Likes
508

Hi.

in the IT_WHERE you need to write the correct conditions, like

IT_WHERE-FIELD1 = 'DATE1 = Sy-DATUM and'.

Append IT_WHERE.

IT_WHERE-FIELD1 = 'DATE2 = Sy-DATUM'.

Append IT_WHERE.

Regards

Sudheer

Read only

Former Member
0 Likes
508

Hi Vikranth

You cannot give a individual field as the dynamic where clause. You have to append all the records into that internal table "IT_WHERE" and then pass that. I mean the first 4 lines of your Where clause. SO finally your where clause should look like Where (IT_WHERE).

~Ranganath