‎2008 Jul 09 4:42 AM
Hello,
I am trying to include some subroutines I have written in an include program but they are not able to execute. For example, my include program contains:
FORM F1 USING STR1 STR2.
WRITE: / 'STR1 =', STR1, / 'STR2 = ', STR2.
ENDFORM.
Prog name: ZINCLUDE
Attributes: Include program
When I try to call this subroutine in another program (attributes: executable) using the following code it doesn't work:
REPORT ZTEST.
INCLUDE ZINCLUDE.
WRITE: / 'Calling sub..'.
PERFORM F1 IN PROGRAM ZINCLUDE USING 'abc' 'def'.
WRITE:/ 'Sub called.'.
This program activates and gets compiled successfully. However, when I run it produces no output, not even the local write statements. Please help.
Regards
‎2008 Jul 09 5:01 AM
Hi khan,
REPORT ZTEST.
WRITE: / 'Calling sub..'.
PERFORM F1 USING 'abc' 'def'.
WRITE:/ 'Sub called.'.
INCLUDE ZINCLUDE.
and in ZINCLUDE include the following code hope this helps you
FORM F1 USING STR1 STR2.
WRITE: / 'STR1 =', STR1, / 'STR2 = ', STR2.
ENDFORM.
Regards,
Sravanthi.
‎2008 Jul 09 4:45 AM
hi Khan,
Goto SE80 and activate the main program ZTEST .... Also make the below modification ....
REPORT ZTEST.
INCLUDE ZINCLUDE.
WRITE: / 'Calling sub..'.
PERFORM F1 USING 'abc' 'def'.
WRITE:/ 'Sub called.'.
Regards,
Santosh
‎2008 Jul 09 4:53 AM
Hi Khan,
I think it should be a executable program.
Best reagrds,
raam
‎2008 Jul 09 4:57 AM
Hi,
IT will Work Man.. I handled so many reports like this..
try once again.. it will work .. Make shure that the include program should be active stage ...
Check it once..
Raghunath.S
9986076729
‎2008 Jul 09 5:01 AM
Hi khan,
REPORT ZTEST.
WRITE: / 'Calling sub..'.
PERFORM F1 USING 'abc' 'def'.
WRITE:/ 'Sub called.'.
INCLUDE ZINCLUDE.
and in ZINCLUDE include the following code hope this helps you
FORM F1 USING STR1 STR2.
WRITE: / 'STR1 =', STR1, / 'STR2 = ', STR2.
ENDFORM.
Regards,
Sravanthi.
‎2008 Jul 09 5:22 AM
Hi,
when you are including program.No need to write inprogram while calling subroutine and also we need to use start-of-selection .
REPORT ZTEST.
INCLUDE ZINCLUDE.
WRITE: / 'Calling sub..'.
PERFORM F1 IN PROGRAM ZINCLUDE USING 'abc' 'def'.
WRITE:/ 'Sub called.'.
Above code need to be write as
REPORT ZTEST.
INCLUDE ZINCLUDE.
START-OF-SELECTION.
WRITE: / 'Calling sub..'.
PERFORM F1 USING 'abc' 'def'.
WRITE:/ 'Sub called.'.
This will work.
‎2008 Jul 09 5:24 AM
Hi Khan,
Actually I have worked with this scenario, where we write the FORM routines in the include program of type I.
I have taken your code and worked on that.
Report ZMK_TEST no standard page heading line-size 255.
If you use the first code which is your actual code the program goes to dump once you execute as the include you used is a program of type I and in the perform you are using the statement PERFORM F1 IN PROGRAM ZMK_INCLUDE USING 'abc' 'def'.
*INCLUDE Zmk_INCLUDE.
*WRITE 'Calling sub'.
*PERFORM F1 IN PROGRAM ZMK_INCLUDE USING 'abc' 'def'.
*WRITE:/ 'Sub called.'.Use this code it will work correctly and the main modification is use of start-of-selection and the change in perform statement
INCLUDE Zmk_INCLUDE.
START-OF-SELECTION.
WRITE 'Calling sub'.
PERFORM F1 USING 'abc' 'def'.
WRITE:/ 'Sub called.'.Reward points if helpful.
Thanks,
Khan.