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: 

include form--endform

Former Member
0 Kudos

i put in include

form xxxx

endform.

and i get error why?

what should i do?

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

hi,

perform xxxx.
..
..
..
....

form xxxx.

endform.

what is the error.

regards

vijay

10 REPLIES 10

former_member188685
Active Contributor
0 Kudos

hi,

perform xxxx.
..
..
..
....

form xxxx.

endform.

what is the error.

regards

vijay

0 Kudos

i use fm alv

i put 'USER_COMMAND'

MAKE

FORM USER_COMMAND

ENDFORM.

GET ERR FORM AMD ENDFORM.

0 Kudos

hi,

it should be..

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

  case r_ucomm.
    when 'BACK' or 'CANC' or 'EXIT'.
  endcase.
ENDFORM.                    "USER_COMMAND

regards

vijay

0 Kudos

Please you please post your code exactly as it is in the include. And also exactly where the INCLUDE statement is placed in the main program. It should be outside of any other FORMS or other modularization.

Regards,

Rich Heilman

0 Kudos

Hi,

Are you sure its just not a syntax error. I can't see a period of the FORM USER_COMMAND.

It could be a silly mistake.

Regards,

Ravi

0 Kudos

I'M AT HOME NOW SO I DONT HAVE THE CODE

BUT

I HAVE MAIN PROG

FORM XX

INCLUDE YY.

ENDFORM.

IN THE INCLUDE

I PUT CALL FUNCTION alv_GRID

AND THE FORM USER_COMMAND.

AS VAIJA MENTION.

0 Kudos

I don't think that you can do that, have an INCLUDE inside of a FORM. Put the INCLUDE statement at the end of your program outside the FORMS, you can include your code by wrapping it in a another FORM which is in the INCLUDE.

FORM XX.
   perform call_alv_grid.
ENDFORM.

include YY.

Now in the include source, have a FORM.

**include  YY.

form call_alv_Grid.
* Do whatever.

endform.

Also you can call the FORM directly instead of going thru the FORM XX.

Make sense?

Regards,

Rich Heilman

0 Kudos

It is the same concept that I talked about earlier. Of course I was assuming that you are working with a function module user exit, which turned out to be wrong.

You should remember that an include within a code will be replaced in its entirity during compilation. So if I expand your include it looks something like

FORM XX.

CALL FUNCTION ..ALV GRID...

FORM USER_COMMAND.

ENDFORM. " OF USER_COMMAND

ENDFORM. " OF XX.

So essentially you are writing nested FORMs which is not allowed.

Former Member
0 Kudos

Well ideally you should not get a error, can you tell us what is the error message?

Regards,

Ravi

Former Member
0 Kudos

Assuming that this include is part of a function module user exit, then it is not allowed as you are putting a FORM... ENDFORM inside of a FUNCTION .. ENDFUNCTION code.

Remember, an include within a function module is just normal code that you would otherwise insert between the FUNCTION... ENDFUNCTION.