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

Call to external subroutines from include program

Former Member
0 Likes
2,482

I have an include program and i need to call an external subroutine from inside this

PERFORM Ztest in program ( ztestvalid ) if exists. -- in include program

created external subroutine pool program-ztestvalid

FORM Ztest

endform.

But the program fails at perform

Can any one please let me know how i can call an external subroutine from a program.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,126

Use always upper case and you will get better results..

PERFORM Ztest in program ( 'ZTESTVALID' ) if exists. -- in include program

created external subroutine pool program-ztestvalid

FORM Ztest

endform.

Thanks

Seshu

4 REPLIES 4
Read only

uwe_schieferstein
Active Contributor
0 Likes
1,126

Hello Narendra

Perhaps you have a problem with upper/lower case of the program names. Here is an example that works.

&----


*& Subroutine pool ZUS_SDN_SUBROUTINE_POOL

*&

&----


*&

*&

&----


PROGRAM  ZUS_SDN_SUBROUTINE_POOL.
" This is my (external) subroutine pool

*&---------------------------------------------------------------------*
*&      Form  MY_ROUTINE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form MY_ROUTINE .

  message 'My routine called externally' type 'I'.

endform.                    " MY_ROUTINE

And here is the report using an external routine:

*&---------------------------------------------------------------------*
*& Report  ZUS_SDN_PERFORM_EXTERNAL
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zus_sdn_perform_external.


DATA:
  gd_report    TYPE progname.


START-OF-SELECTION.


  PERFORM unknown_routine IN PROGRAM ('ZUS_SDN_SUBROUTINE_POOL')
                          IF FOUND.

  PERFORM my_routine IN PROGRAM ('ZUS_SDN_SUBROUTINE_POOL')
                     IF FOUND.
*
  gd_report = 'ZUS_SDN_SUBROUTINE_POOL'.  " upper case !!!
  PERFORM my_routine IN PROGRAM (gd_report)
                     IF FOUND.


END-OF-SELECTION.

Regards

Uwe

Read only

Former Member
0 Likes
1,126

Hi Narendra,

Specify the Subroutine name as well as the program name in Capital letters. If this doesn't help please post the error message so that we may be able to help you better.

Regards,

Saurabh

Read only

Former Member
0 Likes
1,127

Use always upper case and you will get better results..

PERFORM Ztest in program ( 'ZTESTVALID' ) if exists. -- in include program

created external subroutine pool program-ztestvalid

FORM Ztest

endform.

Thanks

Seshu

Read only

Former Member
0 Likes
1,126

done