Skip to Content

It’s good to know that there is a way of writing

       

       

       

       

       

   

Program_Name.  

   

    • To Get the dynamically generated Program Name *

With the following additions:

   

       

       

       

       

       

Message.

       

      

    • Contains Error Message*

   

       

       

       

       

       

Include.

       

       

 

    • Name of the include program Concerned  to store this field*

   

       

       

       

       

       

Line.

       

       

     

    • Line Number in Transient program*

   

       

       

       

       

       

Word.

 

       

       

 

    • Incorrect word that caused the error*

   

       

       

       

       

       

Offset

 

       

       

  

    • Position of the incorrect word*

   

       

       

       

       

       

Trace-file.

       

      

    • Trace output*

How Generate Subroutine pool works

When Generate

Subroutine pool

command is
executed it takes the code in the Internal table and checks for errors;
in case of  errors it throws an error giving the line number error text and  so on. If
the code is free from errors it creates a program dynamically and program name
is stored in the field 

Program_Name

. Now you call the routines that are in
dynamically created program.

The syntax for calling the routine in

dynamic program

is:

PERFORM UPLOAD IN PROGRAM (PROGRAM_NAME).

   

       

       

       

       

       

    • Where Upload is a Subroutine in the dynamically created program*

The

Transient code

required to dynamically update a database table is written below:

** Begin of Code*

       
       

append:    
‘Report ztrans.’
       
       
       
       

to git_abaplist,

       
       
       
     
  
‘tables: ‘
       
  
       
       
       
       
to git_abaplist,

       
       
       
     
   
p_tabnam
      
       
       
       
       
to git_abaplist,

       
       
       
     
   
‘.’
      
     
     
       
       
       
       

to git_abaplist,

Internal table declaration

       
       
       
   
   
‘DATA tabname like ‘
       
       
      
to git_abaplist,

       
       
       
   
   
p_tabnam
   
      
      
       
       
      
to git_abaplist,

       
       
       
      

‘Occurs 0 with header line.’
 
       
      
to git_abaplist,

Start of Selection

       
       
       
   
   
‘Start-of-selection’.
       
      
      
    
to git_abaplist,

Perform upload

       
       
       
   
   
‘form upload.’
       
      
      
      
     
to git_abaplist,

GUI Upload

       
       
       
   
   
‘CALL FUNCTION ”GUI_UPLOAD” ‘
 
to git_abaplist,

       
       
       
   
   

‘EXPORTING ‘
       
   
   
       
   
  
to git_abaplist,

       
       
       
   
   
‘Filename = ‘
       
      
    

       
   
   

to git_abaplist.

       
       
       
   
   
concatenate ”” p_flname ””
   
      
   
into git_abaplist.

       
       
       
   
   

append git_abaplist.

       
       
append:   
‘FILETYPE = ”ASC” ‘
       
       
      
to git_abaplist,

       
       
       
   
   

‘HAS_FIELD_SEPARATOR = ”X” ‘

to git_abaplist,

       
       
       
   
   
‘tables’
       
       
   
       
       
   
      
to git_abaplist,

       
       
       
   
   
‘data_tab = tabname.’
       
       
   
    
to git_abaplist,

Updating the database table

       
       
       
   
   
‘modify’
       
       
       
       
       
     

to git_abaplist,

       
       
       
   
   
p_tabnam
       
       
    
       
       
     

to git_abaplist,

       
       
       
   
   
‘from table tabname.’
       
       
       
 
to git_abaplist,

       
       
       
   
   
‘endform. ‘
       
   
   
       
   
   
       
 
to git_abaplist.

    • End of Code*</font><br>

While Calling

Generate Subroutine pool

, the source code for the subroutine pool to be generated is passed on to the internal table. These Subroutine pools belong to the runtime context of the generating program.

Note:

Transient programs are written only for internal use of a program, and all possible exceptions have to be handled while writing a transient program.

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. Gerard White
    It’s true that generating transient routines can be very useful but there are certain considerations that should be made before chosing to do so:

    1) there’s a considerable performance overhead associated with transient routines,

    2) there’s a limit on the number of sub-routines that can be generated within a program. This limit is 36 and anythng over this will create a short-dump (GENERATE_SUBPOOL_DIR_FULL),

    3) SAP say that the GENERATE command is internal only. They write:

    “This statement is for internal use only.

    Incompatible changes or further developments may occur at any time without warning or notice.”

    (0) 
    1. Rajeev Narayanaswamy Post author
      I have used this in one of my Objects ,Which has already gone live long back and not yet faced any problem as of now,Any way since we are using this Command for Codes written by us as a part of customization, so i think this does not matter.

      Regds,
      Rajeev.N

      (0) 
      1. Scott Barden
        There is a way to get around the limit of 36 subroutine pool generations.

        Can I ask you to post this question in the ABAP forum, so that the answer is not lost for future reference?

        Cheers,
        Scott

        (0) 

Leave a Reply