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

Runtime error at select statement in RFC_READ TABLE FM

Former Member
0 Likes
664

Dear All,

I have copied the standard FM RFC_READ_TABLE to incorporate the customer needs. Below is the select query which I have written in this FM.

SELECT (po_search_text-column_text) INTO <wa> FROM ekko
      INNER JOIN ekpo ON ekko~ebeln = ekpo~ebeln
      INNER JOIN eket ON ekpo~ebeln = eket~ebeln AND ekpo~ebelp = eket~ebelp
      INNER JOIN lfa1 ON ekko~lifnr = lfa1~lifnr
      INNER JOIN lfm1 ON ekko~lifnr = lfm1~lifnr AND ekko~ekorg = lfm1~ekorg
      INNER JOIN lfb1 ON ekko~lifnr = lfb1~lifnr AND ekko~bukrs = lfb1~bukrs
      INNER JOIN t024 ON ekko~ekgrp = t024~ekgrp
      INNER JOIN zatscsng_status ON eket~ebeln = zatscsng_status~po_number
      AND   eket~ebelp = zatscsng_status~po_line
      AND   eket~etenr = zatscsng_status~po_sched_line
      INNER JOIN adrc ON zatscsng_status~delivery_addr = adrc~addrnumber
      WHERE (po_search_text-cond_text)
      ORDER BY (po_search_text-sort_text).

Here, posearch_text-column_text_ will have the fields to be selected at runtime and posearch_text-cond_text_ is the where condition. It is running fine in this case.

But when I try to select Item Category ( EKPO-PSTYP), if data is present for this category, it is returning the values but if data is not there for the particular item category in the where clause, it is giving a RUNTIME ERROR at the select statement.

Here is the ERROR ANALYSIS:

-


An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SEMANTICS', was

not caught in

procedure "ZATSCSNG_RFC_READ_TABLE" "(FUNCTION)", nor was it propagated by a

RAISING clause.

Since the caller of the procedure could not have anticipated that the

exception would occur, the current program is terminated.

The reason for the exception is:

The current ABAP program has tried to execute an Open SQL statement

which contains a WHERE, ON or HAVING condition with a dynamic part.

The part of the WHERE, ON or HAVING condition specified at runtime in

a field or an internal table, contains the invalid value "<L_LINE>-PSTYP".

-


Edited by: Rob Burbank on Mar 17, 2010 5:09 PM

2 REPLIES 2
Read only

ThomasZloch
Active Contributor
0 Likes
493

Now that's what I call a join statement...

You probably have a bug in how you build po_search_text-cond_text, the content must be a syntactically correct where clause. It seems that in your example there is just "<L_LINE>-PSTYP" without a condition, so try omitting it altogether.

Debug the content of po_search_text-cond_text before it hits the select statement.

Thomas

Read only

0 Likes
493

Thomas,

Thanks for your inputs.

Actually the select statement was already there and PSTYP was also present in the WHERE clause.

Now I am trying to select field PSTYP along with the other fields . And when I do this, it gives me a dump when data is not found.