2008 Nov 21 2:40 PM
Hi,
I have created Perform statement in include and form and endform. When i used this in includeprogram,i am getting the following error.Incorrect nesting: Before the statement "FORM", the structure
introduced by "CASE" must be concluded by "ENDCASE" . . . . . . . .
2008 Nov 21 2:44 PM
in the form endform.. you might have used a case statement which u did not end with Endcase.. check that
2008 Nov 21 2:42 PM
Most probably you forgot to put a point to close a previous line, thus rendering the endcase illegible.
2008 Nov 21 2:43 PM
2008 Nov 21 2:44 PM
in the form endform.. you might have used a case statement which u did not end with Endcase.. check that
2008 Nov 21 2:50 PM
Hi,
I have used Perform statement in include program and form and endform in main program. Now it is not showing any error. But, if i use like the main program length could be very high. So, How can i avoid this? I have 6 include programs.
i want both Peform, form and endform in include program itself.
2008 Nov 21 2:53 PM
Hello Venkat,
Paste the subroutine (form.. endform) to the top of the same include.
Thanks,
Jayant
2008 Nov 21 2:58 PM
2008 Nov 21 3:03 PM
Can you please paste the code that you hvae written.
Thanks,
Jayant
2008 Nov 21 3:07 PM
Includes cannot contain PERFORM statement on its own .. these have to be inside .. form .. endform ..
In your Include program ..
FORM XX. <-- call this from your main program ...
perform YY.
ENDFORM.
FORM YY.
ENDFORM.
2008 Nov 21 3:08 PM
*-----------------------------------------------------------------------
* start-of-selection
*-----------------------------------------------------------------------
START-OF-SELECTION.---->This is Main program
IF p_dload = 'X'.
PERFORM create_folder_in_directory.
ENDIF.
CASE 'P_DCODE'.
WHEN 'CODEA' OR 'CODEB.
INCLUDE ZPROGRAM1.
WHEN 'CODEC' OR 'CODED'.
INCLUDE ZPROGRAM2.
ENDCASE.
In Include program.
Program ZPROGRAM1.
Perform get_data.
Form get_data.
Endfor.
2008 Nov 21 3:12 PM
in the case statement I dint find a need to call the include.. I donno how you are not showing a syntax error if you are using include in case statments... Includes always need to be on the top of the program lines...
instead you can call the perform directly in the case.. when statement..
CASE 'P_DCODE'.
WHEN 'CODEA' OR 'CODEB.
Perform get_data.
WHEN 'CODEC' OR 'CODED'.
Perform get_data_C.
Perform get_data_D.
ENDCASE.
2008 Nov 21 3:12 PM
Hello Venkat,
Try it this way.
INCLUDE ZPROGRAM1.
INCLUDE ZPROGRAM2.
*----
start-of-selection
*----
START-OF-SELECTION.---->This is Main program
IF p_dload = 'X'.
PERFORM create_folder_in_directory.
ENDIF.
CASE 'P_DCODE'.
WHEN 'CODEA' OR 'CODEB.
perform get_some_data1. (Include the subroutine (form..endform) in INCLUDE ZPROGRAM1.)
WHEN 'CODEC' OR 'CODED'.
perform get_some_data1. (IInclude the subroutine (form..endform) in INCLUDE ZPROGRAM2.)
ENDCASE.
Hope it solves your problem.
Thanks,
Jayant
2008 Nov 21 3:15 PM
Hi,
What you need to do is call the Perform in the main program within the case endcase, Keep the subroutines form...endform in the include program. Also you will have to include program 1 & 2 at the end of the main program
*-----------------------------------------------------------------------
* start-of-selection
*-----------------------------------------------------------------------
START-OF-SELECTION.---->This is Main program
IF p_dload = 'X'.
PERFORM create_folder_in_directory.
ENDIF.
CASE 'P_DCODE'.
WHEN 'CODEA' OR 'CODEB.
Perform get_data.
WHEN 'CODEC' OR 'CODED'.
Perform .......
ENDCASE.
INCLUDE ZPROGRAM1.
INCLUDE ZPROGRAM2.
" End of main program -------------------------------------------
In Include program.
Program ZPROGRAM1.
Form get_data.
Endform.
2008 Nov 21 3:25 PM
Thanks Advait. It solves my problem. Is there any other way we can do it?
2008 Nov 21 2:44 PM
change as ..
form .....
endform ...
then declare your case .. endcase ... or declare case .. endcase ... in form .. endform ..
case ..
.
.
.
.
endcase