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

include with form in user-exit

huseyin_catalbas
Explorer
0 Likes
1,463

Hello everyone,

I am trying to put an include which contains a form routine into a user-exit include . My include source activates normally by itself but when i try to activate the user-exit include which contains my custom include i am getting the error " Incorrect nesting: Before the statement "FORM", the structure introduced by "FUNCTION' must be concluded by "ENDFUNCTION" "

Any ideas on how i can fix that?

Regards,

Huseyin

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,197

Hi huseyin,

1. Inside the se37 code,

2. put your include

as the first line,

BEFORE the FUNCTION Definition.

regards,

amit m.

Hi huseyin,

1. Inside the se37 code,

2. put your include

as the first line,

BEFORE the FUNCTION Definition.

regards,

amit m.

3 REPLIES 3
Read only

Former Member
0 Likes
1,198

Hi huseyin,

1. Inside the se37 code,

2. put your include

as the first line,

BEFORE the FUNCTION Definition.

regards,

amit m.

Read only

0 Likes
1,197

Hello Amit,

Thanks for your reply but i couldnt understand well. I havent created any functions using se37. I have just created the include from se38 and it includes a form.... endform block. What i want is to make use of this form using a perform statement in the user-exit.

Did you mean the source code of the user-exit function? If so i think exit function sources are not changeable.

Thanks,

Huseyin

Read only

0 Likes
1,197

Hi Huseyin,

userexits are done by filling an include which itself is source code of the function module. If you want to do some structurized programming, you should copy the EXIT function to customer name space and to your own function group. Then, in the include, you call your own function passing exactly the parameters of the EXIT function.

Then you are free to create includes, forms, data, objects,... whatever you want to achieve structured functionality.

Sample code:


*&---------------------------------------------------------------------*
*& Include.: ZXTRKU12                                                  *
*...
* new functionality sourced out to new function module
  call function 'Z_EXIT_SAPLV55K_004'
    importing
      processing_protocol = processing_protocol
    tables
      idoc_data           = idoc_data
    changing
      idoc_control        = idoc_control
    exceptions
      idoc_error          = 1
      do_not_process_idoc = 2
      others              = 3.
  case sy-subrc .
    when 0.
      exit.
    when 1.
      raise idoc_error.
    when others.
* Can't raise OTHERS -> 2 AND Others handled in common
      raise do_not_process_idoc.
  endcase.

Here we created a new function group ZXTRK for the exit function group XTRK. We copied function EXIT_SAPLV55K_004 to function z_exit_saplv55k_004. In our case, we created 22 form includes and one top include because our programming guidelines require an include for each form.

The rest shoud be crystal-clear. If not, feel fre to ask for details.

Regards,

Clemens