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

sapsql_like_pattern_too_long - dump?

former_member194669
Active Contributor
0 Likes
2,021

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

4 REPLIES 4
Read only

Former Member
0 Likes
1,031

I replied in your previous post for the same issue. You have to debug this and since these are macros you cannot. So change them temporarily into subroutines and debug. You will find where the issue is.

I don't see "selopt_t" getting refreshed in your "dynamic_where" macro.

Read only

former_member194669
Active Contributor
0 Likes
1,031

Srinivas,

Thanks for your reply.

It is not happening all the time. This report work well when i execute . This dump comes once in a while, so how to debug this. ?

The variant that has been used (when dump it created) i executed again and again not giving any dump.

In this scenario how to trace the actual problem by looking into this dump?

aRs

Read only

0 Likes
1,031

You have to look at the contents of all the variables to see if there is any difference. If the dump occurs randomly for the same set of values, then it is difficult to say. There has to be some pattern. You have to try to isolate it. I see that it is always happening at one point of the code, so may be you should comment that and see if it happens. If it doesn't occur, no matter how many times you execute, then you can focus on that one statement to see why it dumps.

Read only

0 Likes
1,031

Please focus on the following statement and the values it is getting.


  dynamic_where: s_awerk text-082 'werks'.
  get_unique yarsauthplnts.

As per the rule, your values for s_awerk should not be greater than the length of the field WERKS.

Also please add the refresh selopt_t statement to the dynamic_where.