SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Generate subroutine pool



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dynamic Programming | Динамическое программирование
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sat Oct 06, 2007 2:00 am    Post subject: Generate subroutine pool Reply with quote

Author: Rich Heilman

Hi again, so if you can not use the IN in a dynamic where clause you might be forced to dynamically build the entire select statement, Here is a sample program which may give you some ideas, notice that we are writing the select statement code, putting it in another program and generating the subroutine at runtime, then call this routine. I'm sure that this will help you see what you need to do.

Code:
report zrich_0003 .
 
tables: kna1.
 
types: t_source(72).
 
data: routine(32) value 'DYNAMIC_SELECT',
             program(8),
             message(128),
             line type i.
 
data: isource type table of t_source,
            xsource type t_source.
 
ranges:
        r_kunnr for kna1-kunnr.
 
data: ikna1 type table of kna1.
data: xkna1 type kna1.
 
 
r_kunnr-sign = 'I'.
r_kunnr-option = 'EQ'.
r_kunnr-low    = '0001000500'.
append r_kunnr.
 
xsource = 'REPORT ZTEMP.'.
insert xsource  into isource index 1.
xsource = 'FORM dynamic_select'.
insert xsource  into isource index 2.
xsource = 'Tables r_kunnr ikna1.'.
append xsource to isource.
xsource = 'select * into table ikna1 from kna1'.
append xsource to isource.
xsource = 'where kunnr in r_kunnr.'.
append xsource to isource.
xsource = 'ENDFORM.'.
append xsource to isource.
 
generate subroutine pool isource name program
                         message message
                         line line.
if sy-subrc = 0.
  perform (routine) in program (program) tables r_kunnr
                                                ikna1.
else.
  write:/ message.
endif.
 
loop at ikna1 into xkna1.
  write:/ xkna1-kunnr.
endloop.


Regards,
Rich Heilman

PS: There is limit in 36 generate subroutine pool in one internal session.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dynamic Programming | Динамическое программирование All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.