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

Can we use Form - Endform in include program

Former Member
0 Likes
1,832

Dear All,

I am using main program and calling include for editable alv list.

when i using FORM statement in include program

it says

Incorrect nesting: Before the statement "FORM", the structure

introduced by "CASE" must be concluded with "ENDCASE". -

what can i do

i want to use this FM

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'

EXPORTING

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

i_callback_program = GD_REPID

is_layout_lvc = GD_LAYOUT

it_fieldcat_lvc = IT_FIELDCAT

i_save = 'X'

TABLES

t_outtab = IT_ZPP014_001

EXCEPTIONS

program_error = 1

OTHERS = 2.

*

IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*

and i want to write USER_COMMAND capturing form

FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD.

*

BREAK ITNR.

CASE R_UCOMM.

WHEN '&DATA_SAVE'. " Exploring orders with selected materials

*

* MODIFY ZPP014_001 FROM TABLE IT_ZPP014_001.

*

ENDCASE.

*

endform.

can any one give me valueble answers to solve my problem.

Thanks in Advance!

6 REPLIES 6
Read only

Former Member
0 Likes
1,160

Hi,

u can use the form...endform(subroutine) in include.

it might be the problem with the code somewhere else in ur program

rgds,

bharat.

Read only

0 Likes
1,160

Dear Bharat Kalagara

can you please give me some examples still im in same problem.

Thanks in Advance

Read only

JozsefSzikszai
Active Contributor
0 Likes
1,160

hi Nelson,

I guess the problem is before the FORM statement. There should be a CASE, which is not closed with ENDCASE.

hope this helps

ec

Read only

Former Member
0 Likes
1,160

Hi,

Please refer to the code below:


call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
            i_callback_program      = gd_repid
            i_callback_top_of_page   = 'TOP-OF-PAGE'
            I_callback_user_command = 'USER_COMMAND'   "see FORM 
            is_layout               = gd_layout
            it_fieldcat             = fieldcatalog[]
            i_save                  = 'X'
       tables
            t_outtab                = it_ekko
       exceptions
            program_error           = 1
            others                  = 2.

 
*------------------------------------------------------------------*
*       FORM USER_COMMAND                                          *
*------------------------------------------------------------------*
*       --> R_UCOMM                                                *
*       --> RS_SELFIELD                                            *
*------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
                  rs_selfield TYPE slis_selfield.

* Check function code
  CASE r_ucomm.
    WHEN '&IC1'.
*   Check field clicked on within ALVgrid report
    IF rs_selfield-fieldname = 'EBELN'.
*     Read data table, using index of row user clicked on
      READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
*     Set parameter ID for transaction screen field
      SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
*     Sxecute transaction ME23N, and skip initial data entry screen
      CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
    ENDIF.
  ENDCASE.
ENDFORM.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
1,160

Hi,

Remove the BREAK statement.see if u have ended the case statement correctly with ENDCASE before ENDFORM.

hope then it will work.

Please reward points if useful.

Regards

rose

Read only

Former Member
0 Likes
1,160

As Eric said, the likely cause is the program not the include... comment out the include statement in the main program and try the syntax check again on the main program - based on the message you are getting it would appear to be incomplete.

Jonathan