Skip to Content
0
Jul 02, 2007 at 03:17 PM

sapsql_like_pattern_too_long - dump?

478 Views

Hi,

I am getting this short dump. This dump not coming every time this report execute.

I am getting this dump once in a while.

ABAP/4 Open SQL statement with WHERE ... LIKE and pattern too long.

-


Error analysis

-


An exception occurred. This exception is dealt with in more detail below

. The exception, which is assigned to the class 'CX_SY_DYNAMIC_OSQL_SEMANTICS',

was neither

caught nor passed along using a RAISING clause, in the procedure

"F_SELECT_UNIQUE_DOCNO" "(FORM)"

.

Since the caller of the procedure could not have expected this exception

to occur, the running program was terminated.

The reason for the exception is:

The current ABAP/4 program attempted to execute an ABAP/4 Open SQL

statement in which the WHERE condition contains an LIKE operator.

The format for a LIKE operator should be (with the exception of

closing blanks) no more than twice as long as the

database field to which the condition applies.

In this particular case, the pattern contains

"%40R22.5%"

more than the maximum permitted 8 (= 2 * 4) valid characters.

-


Source code extract

-


003550 dynamic_where: s_awerk text-082 'werks'. " text-082 - YARSAUTHPLNTS

-


> get_unique yarsauthplnts.

003570

003580 endform. " F_select_unique_docno

003590 *

003600 &----


003610 * Form f_select_records *

003620 &----


003630 * For selecting records *

003640 &----


This is my source code

form f_select_unique_docno.
 
  dynamic_where: s_docds  text-063 'docdes'.
  get_unique: yarshdrt.
 
  dynamic_where: s_custo text-077 'customerno',
                 s_custp text-077 'custpartno'.
  get_unique yarscust.
 
  dynamic_where: s_prdcd text-080 'prodcode',
                 s_ptype text-080 'ptype'.
  get_unique yarsprdcode.
 
  dynamic_where: s_hwerk text-081 'werks',
                 s_affin text-081 'affind'.
  get_unique yarsplnt.
 
  dynamic_where: s_awerk text-082 'werks'.
  get_unique yarsauthplnts.
 
endform.                                 " F_select_unique_docno



*&---------------------------------------------------------------------*
* macro declaration                                                    *
*&---------------------------------------------------------------------*
define dynamic_where.
  if not &1[] is initial.
    clear l_ds_range. refresh frange_t.
    move &2 to l_ds_range-tablename.
    frange-fieldname = &3.
    loop at &1.
      selopt_t-sign   = &1-sign.
      selopt_t-option = &1-option.
      selopt_t-low    = &1-low.
      selopt_t-high   = &1-high.
      append selopt_t.
    endloop.
    frange-selopt_t[] = selopt_t[].
    append frange to frange_t.
    l_ds_range-frange_t = frange_t.
    append l_ds_range to l_ds_trange.
  endif.
end-of-definition.
 
define get_unique.
  if not l_ds_trange is initial.
    refresh: i_where. clear: i_where.
    call function 'FREE_SELECTIONS_RANGE_2_WHERE'
      exporting
        field_ranges  = l_ds_trange
      importing
        where_clauses = i_where.
    if not i_where is initial.
      read table i_where with key 'YSCC' into t_where.
      if sy-subrc eq 0.
        select docno from &1
            appending table i_docno
            where (t_where-where_tab).
      endif.
    endif.
    refresh: l_ds_trange. clear: l_ds_range.
  endif.
end-of-definition.

Here one of table values for select contains the values like this way in table

ASC*B

BSC*H

CSC*M

DSC*A

ETC*B

FGT*L

aRs