‎2007 Oct 17 1:45 PM
I am getting this dump for the second time that I execute the program. I am executing a program which contains a selection screen with lots of select - options. When I execute the program the first time, it runs fine. But if I go back and execute the program again for the same input, it gives me a dump saying
The current ABAP program attempted to execute an OPEN SQL statement in which the WHERE condition contains an IN itab operator
The OPTION column should only contain EQ LE GE ....
The value " " is not allowed here
How to resolve this. Thanks
FORM filter_vbak.
* Extract all Sales Order Header Data for header criteria
SELECT vbeln vbtyp auart augru lifsk faksk vkorg vtweg spart vsbed kunnr
FROM vbak
INTO TABLE i_vbak
WHERE vkorg IN s_vkorg
AND vtweg IN s_vtweg
AND spart IN s_spart
AND erdat IN s_erdat
AND vbeln IN s_vbeln
AND kunnr IN s_kunnr
AND auart IN s_auart
AND lifsk IN s_lifsk
AND faksk IN s_faksk
AND augru IN s_augru.
ENDFORM. "filter_vbak
‎2007 Oct 17 1:47 PM
Hi,
In the END-OF-SELECTION, clear all the Selection screen fieds, and run this report
Regards
Sudheer
‎2007 Oct 17 1:47 PM
Hi,
In the END-OF-SELECTION, clear all the Selection screen fieds, and run this report
Regards
Sudheer
‎2007 Oct 17 1:49 PM
HI,
Can u just paste ur complete code here as there might be a place where the select-option is getting cleared but not properly.
Regards,
Himanshu
‎2007 Oct 17 1:50 PM
hi,
can u paste complete code.
ranges should have sign and option values filled in.
similar is for select options.
here is sample code
s_matnr-sign = 'EQ'.
s_matnr-option = 'I'.
s_matnr-low = l_matnr.
append s_matnr.
‎2007 Oct 17 1:50 PM
Hi,
do you fill the select-options in your abap,
and if yes can you show how and where you do it?
Regards, Dieter
‎2007 Oct 17 2:20 PM
I tried clearing and refreshing all select-options in endofselection but that did not fix the problem.
There is only one select-option that I fill and it is used in the query that gives me the dump. As you can see s_kunnr is been filled.
FORM filter_vbak.
* Extract all Sales Order Header Data for header criteria
SELECT vbeln vbtyp auart augru lifsk faksk vkorg vtweg spart vsbed kunnr
FROM vbak
INTO TABLE i_vbak
WHERE vkorg IN s_vkorg
AND vtweg IN s_vtweg
AND spart IN s_spart
AND erdat IN s_erdat
AND vbeln IN s_vbeln
AND kunnr IN s_kunnr
AND auart IN s_auart
AND lifsk IN s_lifsk
AND faksk IN s_faksk
AND augru IN s_augru.
ENDFORM. "filter_vbak
FORM compute_range_hkunnr.
CLEAR: cnt_hkunnr_i_eq, cnt_hkunnr_total.
*--------------------------------------------------------------------*
* Analyse the select option table for customer hierarchy to
* find out whether its a single value or a range
*--------------------------------------------------------------------*
LOOP AT s_hkunnr.
ADD 1 TO cnt_hkunnr_total.
IF s_hkunnr-low IS NOT INITIAL AND
s_hkunnr-sign = 'I' AND
s_hkunnr-option = 'EQ' AND
s_hkunnr-high IS INITIAL.
ADD 1 TO cnt_hkunnr_i_eq.
ELSE.
EXIT.
ENDIF.
ENDLOOP.
*--------------------------------------------------------------------*
* If only one customer hierarchy has been entered, go down 2 levels
* in customer hierarchy and get all sold to parties
*--------------------------------------------------------------------*
IF cnt_hkunnr_total > 0 AND cnt_hkunnr_total = cnt_hkunnr_i_eq.
* Extract customers with validity date greater than current date
SELECT kunnr hkunnr
FROM knvh
INTO TABLE i_knvh
WHERE hityp = 'A'
AND hkunnr = s_hkunnr-low
AND datbi >= sy-datum.
* Extract customers with valid hierarchy and criteria on sales org
IF sy-subrc = 0.
SELECT kunnr hkunnr
FROM knvh
INTO TABLE i_knvh
FOR ALL ENTRIES IN i_knvh
WHERE hityp = 'A'
AND hkunnr = i_knvh-kunnr
AND datbi >= sy-datum
AND vkorg IN s_vkorg.
IF sy-subrc = 0.
LOOP AT i_knvh INTO wa_knvh.
MOVE 'I' TO s_kunnr-sign.
MOVE 'EQ' TO s_kunnr-option.
MOVE wa_knvh-kunnr TO s_kunnr-low.
APPEND s_kunnr.
CLEAR s_kunnr.
ENDLOOP.
ENDIF.
ENDIF.
*--------------------------------------------------------------------*
* If a range of customer hierarchies have been entered, go down 2 levels
* in customer hierarchy for each value and get all the sold to parties
*--------------------------------------------------------------------*
ELSEIF cnt_hkunnr_total > 0.
* Extract customers with validity date greater than current date
SELECT kunnr hkunnr
FROM knvh
INTO TABLE i_knvh
WHERE hityp = 'A'
AND hkunnr IN s_hkunnr
AND datbi >= sy-datum.
* Extract customers with valid hierarchy and criteria on sales org
IF sy-subrc = 0.
SORT i_knvh BY kunnr DESCENDING. "Sort before deleting duplicate rows
DELETE ADJACENT DUPLICATES FROM i_knvh. "Remove all duplicate customers
SELECT kunnr hkunnr
FROM knvh
INTO TABLE i_knvh
FOR ALL ENTRIES IN i_knvh
WHERE hityp = 'A'
AND hkunnr = i_knvh-kunnr
AND datbi >= sy-datum
AND vkorg IN s_vkorg.
IF sy-subrc = 0.
LOOP AT i_knvh INTO wa_knvh.
MOVE 'I' TO s_kunnr-sign.
MOVE 'EQ' TO s_kunnr-option.
MOVE wa_knvh-kunnr TO s_kunnr-low.
APPEND s_kunnr.
CLEAR s_kunnr.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. "compute_range_hkunnr
‎2007 Oct 17 3:36 PM
‎2007 Oct 17 3:47 PM
‎2007 Oct 17 4:27 PM
END-OF-SELECTION.
CLEAR:
s_vkorg,
s_vtweg ,
s_spart ,
s_erdat ,
s_vbeln ,
s_mbdat ,
s_pernr ,
s_hkunnr ,
s_klabc ,
s_kunnr ,
s_kunag ,
s_cntry ,
s_auart ,
s_pstyv ,
s_werks ,
s_matnr ,
s_charg ,
s_lifsk,
s_faksk ,
s_dfaksk ,
s_cmgst ,
s_augru,
s_uvals.
REFRESH:
s_vkorg,
s_vtweg ,
s_spart ,
s_erdat ,
s_vbeln ,
s_mbdat ,
s_pernr ,
s_hkunnr ,
s_klabc ,
s_kunnr ,
s_kunag ,
s_cntry ,
s_auart ,
s_pstyv ,
s_werks ,
s_matnr ,
s_charg ,
s_lifsk,
s_faksk ,
s_dfaksk ,
s_cmgst ,
s_augru,
s_uvals.
‎2007 Oct 17 4:30 PM
Hi,
Just use
REFRESH:
<b> s_vkorg[],
s_vtweg[] ,</b>
like this
s_spart ,
s_erdat ,
s_vbeln ,
s_mbdat ,
s_pernr ,
s_hkunnr ,
s_klabc ,
s_kunnr ,
s_kunag ,
s_cntry ,
s_auart ,
s_pstyv ,
s_werks ,
s_matnr ,
s_charg ,
s_lifsk,
s_faksk ,
s_dfaksk ,
s_cmgst ,
s_augru,
s_uvals.
‎2007 Oct 17 4:52 PM
Right, clear will work fine, but you must specify the body of the internal table. REFRESH will clear the body without referencing the body specifically. If you wanted to use the CLEAR, you just remember the [].
CLEAR:
s_vkorg,
s_vtweg[] ,
s_spart[] ,
s_erdat[] ,
s_vbeln[] ,
s_mbdat[] ,
s_pernr[] ,
s_hkunnr[] ,
s_klabc[] ,
s_kunnr[] ,
s_kunag[] ,
s_cntry[] ,
s_auart[] ,
s_pstyv[] ,
s_werks[] ,
s_matnr[] ,
s_charg[] ,Regards,
Rich Heilman
‎2007 Oct 17 4:54 PM
Hi Megan,
sorry I don't know, but
* Extract customers with validity date greater than current date
SELECT kunnr hkunnr
FROM knvh
INTO TABLE i_knvh
WHERE hityp = 'A'
AND hkunnr = s_hkunnr-low
This will extract a maximum of 1 customer and it is very much by chance what the value will be; probably of the last line of selection table s_hkunnr or the first line of the range where the condition
IF s_hkunnr-low IS NOT INITIAL AND
s_hkunnr-sign = 'I' AND
s_hkunnr-option = 'EQ' AND
s_hkunnr-high IS INITIAL.
is not true because then you exit the loop.
Actually, you should check what happens and where is used the range s_kunnr - something is missing here.
Please post the source code section of the dump where you can see the exact error position.
Regards,
Clemens