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

Syntax error in Function Group, but no syntax error in Function Module

Former Member
0 Likes
6,538

Hello Experts,

I encountered a function group (which I will call - ZFG) and this function group has only one function module - which I will call ZFM.

Now, when I go to the function group (ZFG) and do a Ctrl+F2 syntax check, I get errors and all the error messages point to the function module - ZFM. The error messages point to the first executable line of the source code of ZFM and says that it is not accessible. The second error message points to the last statement of ZFM, which is ENDFUNCTION and says ENDFUNCTION has got no open control structure starting with FUNCTION (even though the statement FUNCTION is present).

The surprising thing is, when I come to the function module (ZFM), and do Ctrl+F2 syntax check...SAP says - "ZFM is syntactically correct".

Why do I get such conflicting syntax check results?

I am writing a code that does syntax checks for various objects programatically. So ultimately, should my program conclude that ZFM has got syntax errors or should it conclude that it is syntactically correct?. At present, the logic that I've written in my program concludes that ZFM has got syntax errors.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,492

Hello all,

I found a way to get rid of this strange behaviour. Once you open the FM in SE37, go to the menu path:

Utilities -> Update Navigation Index. This will re-arrange all the calls (i.e. re-arrange the versions properly...I am not very clear with what exactly it does and would appreciate if anyone could explain me more about it).

Now, it is behaving the way I expected it to. Syntax check on the function module gives an error and syntax check done on the function group also gives the error.

My sincere thanks to you all for taking the time and effort to help me out.

13 REPLIES 13
Read only

Ruediger_Plantiko
Active Contributor
0 Likes
4,492

Hello Muthuswamy,

please start transaction SE37, enter your function module name, and select "Utilities (M) -> Repair Function Group".

Regards,

Rüdiger

Read only

0 Likes
4,492

Hello Rudiger,

Could you please explain what happens when I do - "Utilities (M) -> Repair Function Group". I want to be sure of what I am doing because, this function module was not created by me. So I am being careful.

Thanks for your time and effort.

Update: I did as you said, but the condition persists - on doing syntax checks on the function group, I get errors pointing to the function module. But when I dod syntax check on FM, it says no errors. So finally, what is the syntax check status of thefunction module? Does it have errors or is it syntactically ok?

Read only

0 Likes
4,492

Hello Muthuswamy,

the data of a function module are stored with some redundancies, for efficiency. From your description, it seems that the function group data are in an inconsistent state. Function group -> Repair is an attempt to bring the function group into a consistent state again.

If you are afraid that something could be damaged, make a download of the function module and save it. Since your function group only has one function module, it should be not an enormous effort to restore it later.

If "repair function group" doesn't help, you can delete the function group and create it again from the scratch. Something weird happened when ZFM was created. (Of course, it would be good to find out what.)

Regards,

Rüdiger

Read only

0 Likes
4,492

Hi Muthuswamy,

Do you get the same errors when you activate the Function group?

Thanks,

Shambu

Read only

0 Likes
4,492

Hi Shambhu,

Yes. When I activate the function group, I get a pop-up like the one below.

Read only

0 Likes
4,492

Is the TOP include active?

Does it start with FUNCTION-POOL?

Thanks,

Shambu

Read only

0 Likes
4,492

Hi,

Could you please show the screenshot of the coding inside the include LZKK_TEST_19019U02?

With what statement does it begin?

Regards,

Kumud

Read only

0 Likes
4,492

Hi Kumud,

It is actually LZKK_TEST_19019U01..and not U02 (as mentioned in the question, there is only 1 FM inside this function group). Anyway, the following is the screen shot of the FM:

Read only

0 Likes
4,492

Hi Shambhu,

Yes, the TOP include is active. It has ONLY the FUNCTION-POOL statement. It has got no data declarations.

Read only

snipersap
Product and Topic Expert
Product and Topic Expert
0 Likes
4,492

Rüdiger Plantiko wrote:

Hello Muthuswamy,

please start transaction SE37, enter your function module name, and select "Utilities (M) -> Repair Function Group".

Regards,

Rüdiger

Dear Rüdiger,

Thanks for your input. It solved one similar problem I faced, where the Function Group was not showing the FM in the list (as the FM was deleted) but the include of the FM was still present in the UXX include of the function group. This was not allowing me to activate the function group.

The repair utility resolved the problem.

Read only

roberto_vacca2
Active Contributor
0 Likes
4,492

HI...

for my experience I can say you that these kind of errors sometimes are only of appearance. When you activate all, the abap compiler can see the whole code (calls between the two function group that are not visible at pre-compiler time ). Try to force activation and you shouldn't see any warnings. These kind of errors happen when you create for example an INCLUDE TOP_DATA immediately after a Report instruction, inside a new include  (the include inside can't see the report outside -> chineses boxes )

example:

report Z_REPORT

include z_top_report   "Created inside include Z_TOP_REPORT

Hope to help, bye.

Read only

Former Member
0 Likes
4,492

Hi Muthuswamy,

Take a minute to check the versions of the function module. There might be a possibility that one  of the versions of the Function module might  be inconsistent. The compiler might be parsing a version of the Function module which is syntatically wrong  and it considers that to be the current version to be activated. This might happen, when you try activating and you lose N/W connectivity or when you save and your SAP GUI loses connectivity. ( I am just giving a hint , the actual cause might be something else too ).

Hope this helps.

Thanks,

Venkat.

Neverthless, to answer your second question, if the compiler throws an error, then so be it. Your custom program should also throw  the same error in my opinion.

Message was edited by: Venkat Gowrishankar

Read only

Former Member
0 Likes
4,493

Hello all,

I found a way to get rid of this strange behaviour. Once you open the FM in SE37, go to the menu path:

Utilities -> Update Navigation Index. This will re-arrange all the calls (i.e. re-arrange the versions properly...I am not very clear with what exactly it does and would appreciate if anyone could explain me more about it).

Now, it is behaving the way I expected it to. Syntax check on the function module gives an error and syntax check done on the function group also gives the error.

My sincere thanks to you all for taking the time and effort to help me out.