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: 

Incorrect nesting in module pool

Former Member
0 Kudos

Hi ,

I have been doing a report inorder to create a new entries this report has to be done in alv from the BCALV_edit_01 using that i have been doing the coding in  module poool i hav done the coding it is throwing the error ' incorrect nesting: Before the statement "MODULE", the control structure

introduced by if must be concluded by end if .

DATA: ok_cod LIKE sy-ucomm,

       save_ok like sy-ucomm,

       g_container TYPE scrfname VALUE 'CUST_ALV',

       g_grid  TYPE REF TO cl_gui_alv_grid,

       g_custom_container TYPE REF TO cl_gui_custom_container,

       gs_layout TYPE lvc_s_layo.

data:gt_outtab type STANDARD TABLE OF ty_temp.

call SCREEN 101.

MODULE PBO OUTPUT.

*

  IF g_custom_container IS INITIAL.

   CREATE OBJECT g_custom_container

            EXPORTING container_name = g_container.

     CREATE OBJECT g_grid

            EXPORTING i_parent = g_custom_container.

    

*§1.Set status of all cells to editable using the layout structure.

    

     gs_layout-edit = 'X'.

         CALL METHOD g_grid->set_table_for_first_display

          EXPORTING i_structure_name = 'TY_TEMP'

                    is_layout        = gs_layout

          CHANGING  it_outtab        = gt_outtab.

*§2.Use SET_READY_FOR_INPUT to allow editing initially.

*   (state "editable and ready for input").

     CALL METHOD g_grid->set_ready_for_input

           EXPORTING i_ready_for_input = 1.

ENDIF.

ENDMODULE.                 " PBO  OUTPUT

*&---------------------------------------------------------------------*

*&      Module  PAI  INPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE pai INPUT.

   save_ok = ok_cod.

   clear ok_cod.

   CASE save_ok.

     WHEN 'EXIT'.

       PERFORM exit_program.

     WHEN 'SWITCH'.

       PERFORM switch_edit_mode.

     WHEN OTHERS.

*     do nothing

   ENDCASE.

ENDMODULE.                 " PAI  INPUT

FORM switch_edit_mode.

*§3.Use IS_READY_FOR_INPUT to fetch current substate of editable cells.

   IF g_grid->is_ready_for_input( ) EQ 0.

*§4.Use SET_READY_FOR_INPUT to switch between the substates.

     CALL METHOD g_grid->set_ready_for_input

                      EXPORTING i_ready_for_input = 1.

   ELSE.

     CALL METHOD g_grid->set_ready_for_input

                      EXPORTING i_ready_for_input = 0.

   ENDIF.

ENDFORM.

FORM exit_program.

   LEAVE PROGRAM.

ENDFORM.

This is my coding.

Regards ,

Maha.

11 REPLIES 11

former_member185613
Contributor
0 Kudos

Hi,

Can you please provide the screen capture of the error? I tried compiling the above code and it got activated successfully (after declaring the type ty_temp which was not declared).

Regards,

~Athreya

0 Kudos

yes sure

venuarun
Active Participant
0 Kudos

Hi Mahalakshmi,

Please check in  which module this error comes. When you double click on the syntax this will point you to that line.

Activate your whole program.

With Regards

Arun VS

Former Member
0 Kudos

hi arun,

Line No. 31-Module PBO output

Module PAI Input

Line No.53 it is throwing error when i am commented the first module it is throwing the same error at the second

0 Kudos

Hi,

Can you please provide the entire code that you have written? It looks like module PBO and module PAI are written in the main program while you also have an include which has code written in it.

Regards,

~Athreya

venuarun
Active Participant
0 Kudos

Hi Mahalakshmi,

Can you share the screenshot of your PBO Screen with  the if end if condition.

You are saving the modules in different include ?

With Regards

Arun VS

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Based on your provided code there is no error !

[my changes]

1. I have declared table with mara.

2. In PBO declare pf-status and titlebar.

3. Check -->ACtivated-->OK.

4. Check your code again / copy below code , change mara table to your table.


  DATA: ok_cod LIKE sy-ucomm,
        save_ok like sy-ucomm,
        g_container TYPE scrfname VALUE 'CUST_ALV',
        g_grid  TYPE REF TO cl_gui_alv_grid,
        g_custom_container TYPE REF TO cl_gui_custom_container,
        gs_layout TYPE lvc_s_layo.
data:gt_outtab type STANDARD TABLE OF mara.


call SCREEN 99.



MODULE STATUS_0099 OUTPUT.
   SET PF-STATUS 'ZPFST'.
   SET TITLEBAR 'ZTIT'.


   IF g_custom_container IS INITIAL.

    CREATE OBJECT g_custom_container
             EXPORTING container_name = g_container.
      CREATE OBJECT g_grid
             EXPORTING i_parent = g_custom_container.
*§1.Set status of all cells to editable using the layout structure.
      gs_layout-edit = 'X'.
          CALL METHOD g_grid->set_table_for_first_display
           EXPORTING i_structure_name = 'TY_TEMP'
                     is_layout        = gs_layout
           CHANGING  it_outtab        = gt_outtab.
*§2.Use SET_READY_FOR_INPUT to allow editing initially.
*   (state "editable and ready for input").
      CALL METHOD g_grid->set_ready_for_input
            EXPORTING i_ready_for_input = 1.
ENDIF.

ENDMODULE.                 " STATUS_0099  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0099  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0099 INPUT.
    save_ok = ok_cod.
    clear ok_cod.
    CASE save_ok.
      WHEN 'EXIT'.
        PERFORM exit_program.
      WHEN 'SWITCH'.
        PERFORM switch_edit_mode.
      WHEN OTHERS.
*     do nothing
    ENDCASE.
ENDMODULE.                 " USER_COMMAND_0099  INPUT
*&---------------------------------------------------------------------*
*&      Form  EXIT_PROGRAM
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM EXIT_PROGRAM .
LEAVE PROGRAM.
ENDFORM.                    " EXIT_PROGRAM
*&---------------------------------------------------------------------*
*&      Form  SWITCH_EDIT_MODE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM SWITCH_EDIT_MODE .
*§3.Use IS_READY_FOR_INPUT to fetch current substate of editable cells.
    IF g_grid->is_ready_for_input( ) EQ 0.
*§4.Use SET_READY_FOR_INPUT to switch between the substates.
      CALL METHOD g_grid->set_ready_for_input
                       EXPORTING i_ready_for_input = 1.
    ELSE.
      CALL METHOD g_grid->set_ready_for_input
                       EXPORTING i_ready_for_input = 0.
    ENDIF.

ENDFORM.                    " SWITCH_EDIT_MODE

pavanm592
Contributor
0 Kudos

Hi Mahalakshmi,

I think your clicking the check button in the include program, Once try like this go to your main program in SE80 and right click and activate all the objects event if it has the errors click on activate any way and then give us the details of error what your getting on checking your program.

Regards,

Pavan

matt
Active Contributor
0 Kudos

Ctrl-F7 syntax checks the entire program.It is clear that we have not been given all the code.

Former Member
0 Kudos

yes i now i got that