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

Calling a Subroutine dynamically (PERFORM xxxx IN PROGRAM yyyy)

Former Member
0 Likes
1,458

Hello Gurus,

Please help me to work with this. I'm trying to call a subroutine to a particularly program, but I want it to be flexible/reusable. I tried using field-symbols to pass the name of subroutine and program, but can't make it. Here's the details:

I have 2 paramaters:

PARAMETERS:

prognam LIKE tnapr-pgnam,

formnam(50).

Inside my program, Iwant to make this PERFORM statement to be dynamic:

PERFORM formname IN PROGRAM prognam.

So I don't need to crete several perform statements. Any help is very very much appreciated.

1 ACCEPTED SOLUTION
Read only

Former Member
896

Hi,

You cannot give the Formname dynamically where as you can give the program name.

PERFORM CALL_549B IN PROGRAM (PROGNAM)
                  USING BACK
                        STATUS
                        STRUC_CONTENT.

Hi,

You cannot give the Formname dynamically where as you can give the program name.

PERFORM CALL_549B IN PROGRAM (PROGNAM)
                  USING BACK
                        STATUS
                        STRUC_CONTENT.

3 REPLIES 3
Read only

Former Member
897

Hi,

You cannot give the Formname dynamically where as you can give the program name.

PERFORM CALL_549B IN PROGRAM (PROGNAM)
                  USING BACK
                        STATUS
                        STRUC_CONTENT.

Read only

896

Try this:

PARAMETERS:

prognam LIKE tnapr-pgnam,

formnam(50).

PERFORM (formnam) IN PROGRAM (prognam).

Read only

896

Hi Vijay,

Bingo! Yes, this what I want. Many many thanks for a great help from you