10-10-2007 2:03 PM
Hi,
please correct me where i went wrong...
RANGES: r_daterange FOR vbak-audat.
RANGES:GRG_DATERANGE FOR VBAK-AUDAT.
PERFORM CHECK_SELECT_OPTIONS USING DATE_FROM
DATE_TO
CHANGING R_DATERANGE[].
if sales order number is the selection criteria
if not salesorder_no is initial.
clear :wa_vbak, wa_vbfa, wa_costlist_in.
refresh:t_vbak, costlist_in.
select avbeln aauart bposnr bnetpr
into table t_vbak
from vbak as a
inner join vbap as b
on avbeln = bvbeln
where a~vbeln = salesorder_no
and a~audat in r_daterange
and a~kunnr = partner_number
and b~abgru NE ' ' .
----
***INCLUDE /VWNA/LINSD_BAPI_INV_GET_INF01 .
----
&----
*& Form CHECK_SELECT_OPTIONS
&----
text
----
-->P_DATE_FROM text
-->P_DATE_TO text
<--P_R_DATERANGE[] text
----
FORM CHECK_SELECT_OPTIONS USING P_DATE_FROM LIKE VBAK-AUDAT
P_DATE_TO LIKE VBAK-AUDAT
CHANGING PRG_DATERANGE LIKE GRG_DATERANGE[].
DATA: WA_DATERANGE LIKE GRG_DATERANGE.
REFRESH PRG_DATERANGE.
WA_DATERANGE-SIGN = 'I'.
iF ( P_DATE_FROM IS INITIAL ) AND ( P_DATE_TO IS INITIAL ).
CLEAR WA_DATERANGE.
ELSEIF P_DATE_FROM IS INITIAL.
WA_DATERANGE-OPTION = 'LE'.
MOVE P_DATE_TO TO WA_DATERANGE-LOW.
ELSEIF P_DATE_TO IS INITIAL.
WA_DATERANGE-OPTION = 'GE'.
MOVE P_DATE_FROM TO WA_DATERANGE-LOW.
ELSE.
WA_DATERANGE-OPTION = 'BT'.
MOVE P_DATE_FROM TO WA_DATERANGE-LOW.
MOVE P_DATE_TO TO WA_DATERANGE-HIGH.
ENDIF.
APPEND WA_DATERANGE TO PRG_DATERANGE.
clear wa_daterange.
When i execute the code its creating a short dump and the message is :The current ABAP/4 program attempted to execute an ABAP/4 Open SQL
statement in which the WHERE condition contains an IN itab operator.
The IN itab operator is used with internal tables which
have the following structure:
SIGN(1) OPTION(2) LOW LIKE db_field HIGH LIKE db_field
In the SIGN column, use only one of the values "I" or "E".
The value " " is not allowed here.
Thanks,
Challa.
10-10-2007 2:10 PM
Hi,
You clear the SIGN field before appending it. Change the coding from your
WA_DATERANGE-SIGN = 'I'.
iF ( P_DATE_FROM IS INITIAL ) AND ( P_DATE_TO IS INITIAL ).
CLEAR WA_DATERANGE.
ELSEIF P_DATE_FROM IS INITIAL.
to this:
CLEAR WA_DATERANGE.
WA_DATERANGE-SIGN = 'I'.
iF ( P_DATE_FROM IS INITIAL ) AND ( P_DATE_TO IS INITIAL ).
ELSEIF P_DATE_FROM IS INITIAL.
Notice I moved the line <b>CLEAR WA_DATERANGE.</b>.
Hope this helps (please reward me if it does),
Joerg
10-10-2007 2:10 PM
Hi,
You clear the SIGN field before appending it. Change the coding from your
WA_DATERANGE-SIGN = 'I'.
iF ( P_DATE_FROM IS INITIAL ) AND ( P_DATE_TO IS INITIAL ).
CLEAR WA_DATERANGE.
ELSEIF P_DATE_FROM IS INITIAL.
to this:
CLEAR WA_DATERANGE.
WA_DATERANGE-SIGN = 'I'.
iF ( P_DATE_FROM IS INITIAL ) AND ( P_DATE_TO IS INITIAL ).
ELSEIF P_DATE_FROM IS INITIAL.
Notice I moved the line <b>CLEAR WA_DATERANGE.</b>.
Hope this helps (please reward me if it does),
Joerg
10-10-2007 2:32 PM
Hi,
I made the suggested changes ...now when i execute it ..its again causing short dump and the message is..
The current ABAP/4 program attempted to execute an ABAP/4 Open SQL
statement in which the WHERE condition contains an IN itab operator.
The IN itab operator is used with internal tables which
have the following structure:
SIGN(1) OPTION(2) LOW LIKE db_field HIGH LIKE db_field
The OPTION column should contain only one of the following values:
"EQ LE GE CP BT NE LT GT NP NB"
The value " " is not allowed here. Please help me in resolving the error..
Thanks,
challa.
10-10-2007 6:50 PM
According to the dump, this time the option field is empty. If you are using a range for any entry in the range table at least the fields SIGN, OPTION and LOW need to have a valid entry (LOW can be space and depending on the option you use you might need an entry in HIGH).
Just go through your coding and make sure that in each condition block you fill all the necessary fields (SIGN,OPTION,LOW).
That should solve your problem.
Regards,
Michael