Application Development 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: 

Perform Statement in Include Program

Former Member
0 Kudos
500

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

former_member156446
Active Contributor
0 Kudos
159

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

14 REPLIES 14

Former Member
0 Kudos
159

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

Former Member
0 Kudos
159

Hello,

You code will be of great help.

Thanks.

Jayant.

former_member156446
Active Contributor
0 Kudos
160

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

0 Kudos
159

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.

0 Kudos
159

Hello Venkat,

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

Thanks,

Jayant

0 Kudos
159

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

0 Kudos
159

Can you please paste the code that you hvae written.

Thanks,

Jayant

0 Kudos
159

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.

0 Kudos
159
*-----------------------------------------------------------------------
* 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. 

0 Kudos
159

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.

0 Kudos
159

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

0 Kudos
159

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. 

0 Kudos
159

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

Former Member
0 Kudos
159

change as ..

form .....

endform ...

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

case ..

.

.

.

.

endcase