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

Perform Statement in Include Program

Former Member
0 Likes
2,256

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" . . . . . . . .

1 ACCEPTED SOLUTION
Read only

former_member156446
Active Contributor
0 Likes
1,915

in the form endform.. you might have used a case statement which u did not end with Endcase.. check that

14 REPLIES 14
Read only

Former Member
0 Likes
1,915

Most probably you forgot to put a point to close a previous line, thus rendering the endcase illegible.

Read only

Former Member
0 Likes
1,915

Hello,

You code will be of great help.

Thanks.

Jayant.

Read only

former_member156446
Active Contributor
0 Likes
1,916

in the form endform.. you might have used a case statement which u did not end with Endcase.. check that

Read only

0 Likes
1,915

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.

Read only

0 Likes
1,915

Hello Venkat,

Paste the subroutine (form.. endform) to the top of the same include.

Thanks,

Jayant

Read only

0 Likes
1,915

Even though i use like this..i am getting the same error.

Read only

0 Likes
1,915

Can you please paste the code that you hvae written.

Thanks,

Jayant

Read only

0 Likes
1,915

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.

Read only

0 Likes
1,915
*-----------------------------------------------------------------------
* 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. 
Read only

0 Likes
1,915

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.

Read only

0 Likes
1,915

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

Read only

0 Likes
1,915

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. 

Read only

0 Likes
1,915

Thanks Advait. It solves my problem. Is there any other way we can do it?

Read only

Former Member
0 Likes
1,915

change as ..

form .....

endform ...

then declare your case .. endcase ... or declare case .. endcase ... in form .. endform ..

case ..

.

.

.

.

endcase