It's good to know that there is a way of writing
Program_Name.
With the following additions:
Message.
Include.
Line.
Word.
Offset
Trace-file.
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).
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.
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.