‎2005 Nov 22 11:12 AM
Is there a way to create a new program by adding few lines dynamically?
‎2005 Nov 22 11:15 AM
‎2005 Nov 22 11:18 AM
do you want to create a program dynamically from another program?
you should use
GENERATE SUBROUTINE POOL
check out the ABAP key word documentation for GENERATE SUBROUTINE POOL for explanation on this and sample code.
http://help.sap.com/saphelp_erp2005/helpdata/en/9f/db999535c111d1829f0000e829fbfe/frameset.htm
Regards
Raja
‎2005 Nov 22 11:18 AM
Hi Aruna,
I Don't think that there is a way to create a new program dynamically.
What exactly is your requirement?
If you already have a program, then copy it and make changes to the copy of the original program.
Is this what you are looking for?
Regards,
Ravi
‎2005 Nov 22 11:20 AM
In one report u can call the other like this
SUBMIT REPORT01
VIA SELECTION-SCREEN
USING SELECTION-SET 'VARIANT1'
USING SELECTION-SETS OF PROGRAM 'REPORT00'
AND RETURN.
Regards
vijay
‎2005 Nov 22 11:28 AM
yes, You can create a ABAP program dynamically & can insert few lines of code in that.here is the process
1)we must create an internal table first. i.e., internal table with a single column of type character and a row width of 72.
DATA: code TYPE TABLE OF rssource-line.
type of an editor line: rssource-line
2) append required ABAP code to this Internal table
APPEND 'REPORT ZDYN1.'
TO code.
APPEND 'WRITE / ''Hello, I am dynamically created!''.'
TO code.
3)
INSERT REPORT <prog> FROM <itab>.
If a program with this name does not already exist, it is created with the following attributes:
Title: None
Type: 1 (report)
Application: S (basis)
The new program <prog> is stored persistently on the database but is not assigned to a package. It is therefore not affected by the transport system.
Pl NOTE that : If a program with the name <prog> already exists, its source code is replaced with a new one from the internal table <itab> without prior warning. All other attributes remain intact.
FOR CHANGING EXISTING PROGRAMS :
you can change the existing ABAP program.
1) first read the total ABAP report into <ITAB>
READ REPORT <prog> INTO <itab>.
2) add your required code to this <ITAB>
3) now u can insert the new changed code
INSERT REPORT 'ZDYN2' FROM CODE
thanks
srikanth