‎2007 May 19 5:16 PM
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.
‎2007 May 20 5:32 AM
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
‎2007 May 19 8:51 PM
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_ROUTINEAnd 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
‎2007 May 20 5:28 AM
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
‎2007 May 20 5:32 AM
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
‎2008 Apr 30 8:27 PM