‎2005 Nov 07 12:53 PM
Hello,
I am building a subroutine pool with the statement 'Generate subroutine pool' and will create a form within this so I can call the form with statement 'Perform (FORM) in program (PROG) if found .....'.
However I am having difficulties building the code for this form.
What I need to do in this form is to build up a select statement using ranges as the selection parameters ie.
Select * from BSEG into itab where belnr in S_BELNR etc.
I cannot fill the values for the range S_BELNR (I cannot hardcode them since I am using values contained in another internal table).
Does anybody have a similar example?
Thank you,
Kevin
‎2005 Nov 07 1:06 PM
Hi,
Try with Dynamic Conditions.
"To specify a condition dynamically, use:
SELECT ... WHERE (<itab>) ...
where <itab> is an internal table with line type C and maximum length 72 characters. All of the conditions listed above except for selection tables, can be written into the lines of <itab>. However, you may only use literals, and not the names of data objects. The internal table can also be left empty.
If you only want to specify a part of the condition dynamically, use:
SELECT ... WHERE <cond> AND (<itab>) ...
You cannot link a static and a dynamic condition using OR.
You may only use dynamic conditions in the WHERE clause of the SELECT statement."
Svetlin
‎2005 Nov 07 1:13 PM
Hi Kevin,
If you are writing a subroutine, then you must be passing some belnrs using an internal table.
If you already have some BELNR values in an internal table,
then you should pass them to the s_belnr ranges.
i.e
loop at itab.
s_belnr-low = itab-belnr.
s_belnr-options = 'EQ'
s_belnr-sign = 'I'
append s_belnr.
clear s_belnr.
endloop.
‎2005 Nov 07 2:03 PM
Hi,
you can transfer your sel-opt. to generated form :
PERFORM (upro) IN PROGRAM (genprog) USING s_bukrs s_belnr....
regards Andreas