Application Development 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: 

Dynamic Select Statement

Former Member
0 Kudos

Dear All,

i got a problem with dynamic select statement.i.e i written a select statement in that i included a where condition.the code for the where condition is as fallows.

DATA : STR_LINE TYPE EDPLINE,

STR_WHERE TYPE TABLE OF EDPLINE.

AND in STR_LINE i appended the condition values like as fallows

" industry = 'telecom' and apparea = 'r/3' and ....."

like above i've total 8 values. So Based on my requirement i may give all the 8 values or some of them.

my problem is iam able to get the where condition upto 72 char only ,cause edpline holds only 72 chars.So after i got the values into str_line iam appending that value into STR_WHERE,but when i used STR_WHERE condition in select statement it gives a dump error like in correct format of where condition.

And i tried STR_LINE type as STRING and also STR_WHERE as String and at that time also iam getting same kind of error.

MY WHERE CONDITION HOLDS APPROX., OF 200 CHAR OF LENGTH pls remeber this .

can u people pls give the solution for this,

Thanks in advance to u all,

Ajay Kumar K,

9908979994.

1 ACCEPTED SOLUTION
4 REPLIES 4

Former Member
0 Kudos

Hi,

I believe the error is not related to the length of the string...if you have an internal table for which the each row of length 72...that should be good enough...

It is related to building the where clause....put a break-point before the SQL...and then check what exactly is the value in the internal table ...you might be missing..some operators like AND...

Thanks

Naren

Former Member
0 Kudos

You need to put the conditions in ( ) as follows:



TABLES: zlmlead.
DATA : STR_LINE TYPE EDPLINE,
       STR_WHERE TYPE TABLE OF EDPLINE.


START-OF-SELECTION.


  STR_LINE = 'leadid eq 1'. append STR_LINE to str_where.

  SELECT SINGLE * FROM zlmlead
    WHERE (str_where).  "<== note where you need to change

  BREAK-POINT.

former_member217544
Active Contributor
0 Kudos

Hi,

Actually it is a bit confusing. Can you provide us with your select statement and what you are trying to do actually.I think we can solve the problem.

Regards,

Swarna Munukoti.