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: 

Weird syntax error "type ABAP_BOOL not found"

jrgkraus
Active Contributor
2,721

We have this program:

report zp_ca10_mat_used_in_bom2.
data bool type abap_bool.
START-OF-SELECTION.
  data(scrap_wf) = zcl_ca10_scrap_wf=>new( ).

When we do a syntax check on it, the cursor goes to "abap_bool" on line 2 and the syntax checker says:

Type "ABAP_BOOL" is unknown.

Note that the class zcl_ca10_scrap_wf is active and has no syntax errors.

When we comment out the last line, the syntax check passes. Isn't that crazy?

We are working on ABAP 750.

21 REPLIES 21

DominikTylczyn
Active Contributor
1,956

Hi there, abap_bool type is definitely supported in 751 - SAP Help: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abendataobjects_true_value_guidl.htm

I can't tell about 750.

You can always use TYPE C LENGTH 1 instead. It's not the most elegant though.

Dominik Tylczynski

0 Kudos
1,956

That's not the point. We have tons of programs that use abap_bool (without even declaring TYPE-POOLS ABAP.) They all work fine. Only programs that make use of this class seem to be affected.

0 Kudos
1,956

Hi Jörg, so you are saying that if you delete the last (fourth) line of the code, the syntax check doesn't complain?

0 Kudos
1,956

In working in ABAP 750, EHP8, and no syntax check issue with use of abap_bool type...
Double click on type display that It's a type defined in ABAP type group as :

**** GENERAL ***********************************************************
types:
abap_bool type c length 1.

0 Kudos
1,956

jrg.krause , I assume you did, but just to make sure: You also get the error if you explicetly include the TYPE-POOL: abap.

report zp_ca10_mat_used_in_bom2.
TYPE-POOLS: abap. " explicitly included

data bool type abap_bool.

START-OF-SELECTION. data(scrap_wf) = zcl_ca10_scrap_wf=>new( ).

0 Kudos
1,956

Dominik Tylczynski The OP said:

"When we comment out the last line, the syntax check passes."

matt
Active Contributor
0 Kudos
1,956

abap_bool has been allowed without the type-pools declaration since 7.31

thalesvb
Active Contributor
1,956

I think that your case was probably caused by a hideous thing called invisible character: it is a character but doesn't occupy any space (unlike a space character that is empty but takes one position, visible feedback).

I did reproduce your syntax error here with that invisible character. The easy way to fix is delete entire line (selecting when the mouse cursor flips) and retype.

Edit: I just found out this online tool to check for invisible characters, you can check if it really this issue by copy-pasting.

Best regards

0 Kudos
1,956

That character is indeed weird and messes up the syntax check and if you dont know its hard to figure out what and where it is. Weird, where did you find that thing 😉

But this would mean, contrary to the claim in the question, that this character is between TYPE and abap_bool, thats at least how I reproduced it. And that it has nothing to do with the last line in the coding. So, interesting to see if that actually is the problem for this case.

0 Kudos
1,956

How do you explain this OP remark?

"When we comment out the last line, the syntax check passes."

thalesvb
Active Contributor
0 Kudos
1,956

Unfortunately my lawyer advised me to not answer your question michael.piesche . Use your imagination to find out 🙂

thalesvb
Active Contributor
0 Kudos
1,956

sandra.rossi and michael.piesche I updated the answer with a tool to check it, its more a blindshot since there are no other cues than this until now. It's still a open X-Files.

1,956

It's not a matter of invisible character, as the OP explained: it works well in all cases except when the class mentioned is used. It's a kernel bug.

Tomas_Buryanek
Active Contributor
0 Kudos
1,956

Just a thought - can you try different variable name instead of "bool" for example "custom_bool".

-- Tomas --

Sandra_Rossi
Active Contributor
0 Kudos
1,956

I can't think other than it's a kernel/syntax checker bug. Either contact SAP support (check SAP notes first of course), or if you want to "play to the detective", copy zcl_ca10_scrap_wf to a new class then remove half elements, test again, repeat until the error does not occur any more, then repeat again the whole process to better identify the culprit...

matt
Active Contributor
0 Kudos
1,956

What happens if you comment out

data(scrap_wf) = zcl_ca10_scrap_wf=>new( ).<br>

I've noticed some odd syntax errors coming up from time to time with functional method calls not quite correctly expressed.
Also, is zcl_ca10_scrap_wf syntactically correct?

jrgkraus
Active Contributor
1,956

I really think it's a kernel bug. When I add the type-pools abap declaration, the syntax check passes:

report zp_ca10_mat_used_in_bom2.
type-pools abap.
data bool type abap_bool.

START-OF-SELECTION.
  data(scrap_wf) = zcl_ca10_scrap_wf=>new( ).

matt
Active Contributor
0 Kudos
1,956

It's beginning to seem likely. but I'm not totally convinced. By adding the type pool, you could be somehow masking what's up with abap_bool.

What happens if you do this:

report zp_ca10_mat_used_in_bom2.
data zbool type abap_bool.

START-OF-SELECTION.
  data(scrap_wf) = zcl_ca10_scrap_wf=>new( ).

(Which tomas.buryanek suggest above) If that gives you the same issue, then I'd say it's definitely kernel. And if it doesn't, it's probably a language restriction with bool somehow being a reserved word or something - which is also kernel really!

jrgkraus
Active Contributor
1,956

I tried do change this. The syntax error persists.

0 Kudos
1,956

If a syntax error appears, check to make sure that the parentheses are matched up correctly. If one end is missing or lined up incorrectly, then type in the correction and check to make sure that the code can be compiled. Keeping the code as organized as possible also helps.

Regards,

Rachel Gomez

mahlzeit1948
Explorer
0 Kudos
1,769

Did you ever find out the reason for this? I have a very similar issue.