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

Generate subroutine pool

Former Member
0 Likes
535

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

3 REPLIES 3
Read only

Former Member
0 Likes
512

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

Read only

Former Member
0 Likes
512

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.

Read only

andreas_mann3
Active Contributor
0 Likes
512

Hi,

you can transfer your sel-opt. to generated form :

  PERFORM (upro) IN PROGRAM (genprog) USING s_bukrs s_belnr

....

regards Andreas