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

Combining 2 different pgm

Former Member
0 Likes
636

Is there a way to create a new program by adding few lines dynamically?

5 REPLIES 5
Read only

Former Member
0 Likes
609

Using Submit Program You Can Do .

Regards

Vijay

Read only

athavanraja
Active Contributor
0 Likes
609

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

Read only

Former Member
0 Likes
609

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

Read only

Former Member
0 Likes
609

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

Read only

Former Member
0 Likes
609

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