Skip to Content
author's profile photo Former Member
Former Member

Calling subroutine dynamically

Hi,

I have found the following SAP Help page ([Naming Subroutines|http://help.sap.com/saphelp_nw2004s/helpdata/EN/9f/db978335c111d1829f0000e829fbfe/content.htm]) regarding the dynamic subroutine call. But I wonder why the following code could not work.


PROGRAM zpld_test_goh.

DATA: subrname TYPE c LENGTH 4 VALUE 'test',
      programname type c LENGTH 20 value  'zpld_test_goh'.

PERFORM (subrname) IN PROGRAM (programname) IF FOUND.

FORM test.

  WRITE 'hello'.

ENDFORM. 

Could anyone please enlighten me on this issue?

Thanks in advance.

Regards,

Joon Meng

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Oct 07, 2009 at 12:19 PM

    Hello,

    PROGRAM ZTEST01335.
    
    DATA: SUBRNAME TYPE C LENGTH 4 VALUE 'TEST',
          PROGRAMNAME TYPE C LENGTH 20 VALUE  'ZTEST01335'.
    
    PERFORM (SUBRNAME) IN PROGRAM (PROGRAMNAME) IF FOUND.
    
    *&---------------------------------------------------------------------*
    *&      Form  test
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM TEST.
    
      WRITE 'hello'.
    
    ENDFORM.                    "test

    I think it is so because you have given the names in small case.

    BR,

    Suhas

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.