06-22-2007 3:18 PM
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 &----
<b>
This is my source code
</b>
*&---------------------------------------------------------------------*
* 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.
aRs
06-22-2007 3:47 PM
It looks to me like it's saying that the DOCNO can be a maximum of eight characters, and the pattern you are pssing "%40R22.5%" is more than eight characters. It's nine characters. You may be trying to use EQ instead of LIKE.
Rob
06-22-2007 3:34 PM
Hi
In dynamic selection it can't use SELECT-OPTION, u can use only fix values.
The fm FREE_SELECTIONS_RANGE_2_WHERE is to translate the sets of selection to be transfered to a submit of a report using a logical database.
Max
06-22-2007 3:39 PM
Hi.
Maybe there is a difference in data declaration of
l_ds_range and s_awerk
and so result longer patterns than allowed in the selection.
Regards,
Timo.
06-22-2007 3:47 PM
It looks to me like it's saying that the DOCNO can be a maximum of eight characters, and the pattern you are pssing "%40R22.5%" is more than eight characters. It's nine characters. You may be trying to use EQ instead of LIKE.
Rob
06-22-2007 3:48 PM
Hi Max,
It has been working for select options all the below mentioned in dynamic where. and also checked the
call function FREE_SELECTIONS_RANGE_2_WHERE, it is giving proper where condition.
Timo,
I checked the input values are with in the limit.
Rob,
If you check the following 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
it is generating a dynamic where for finding out the docno of these select options
aRs
06-22-2007 4:27 PM
Between the macro call dynamic_where: s_awerk text-082 'werks'. " text-082 - YARSAUTHPLNTS and the macro call get_unique yarsauthplnts, add a few lines to verify the contents of your WHERE tab.