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

scan and check abap-source syntax error

Former Member
0 Likes
2,564

Hello,

I am trying to use SCAN AND CHECK ABAP-SOURCE statement.

{code}

*DATA : BEGIN OF itab5 OCCURS 0,

*       text TYPE char200,

*       END OF itab5.

data itab5 TYPE TABLE OF char200.

DATA  itab4 TYPE sysch_result OCCURS 0.

READ REPORT 'ZAASHTEST_TOKENS' INTO itab5.

*data is there in itab5, verified in debugger

SCAN AND CHECK ABAP-SOURCE itab5 RESULT INTO itab4.

{/code}

I am getting the syntax error - ''SCAN AND" must be followed by a source code table.

I have tried defining itab5 in both the ways as shown above.

What can I do to resolve this error?

13 REPLIES 13
Read only

ThomasZloch
Active Contributor
0 Likes
1,914

Not sure, but if you want to just do a syntax check for the code in itab5 I suggest you rather use statement SYNTAX-CHECK, which is easier to use and not flagged as "internal use only".

Thomas

Read only

0 Likes
1,914

Thanks for taking the time to reply Thomas.

My requirement is to identify data objects and do further processing on it and syntax-check will not serve my purpose.

Help on this statement(scan and check abap-source) says that this statment does exactly what I want.

Read only

0 Likes
1,914

Hi,

Use class CL_RECA_RS_SERVICES & method CHECK_SYNTAX as mentioned by our friend Vinod in this wiki

http://wiki.sdn.sap.com/wiki/display/ABAP/Source+code+Download+and+Syntax+Check+using+CL_RECA_RS_SER...

Read only

Former Member
0 Likes
1,914

Hi,

Your codes seems correct as per my checking in ABAP Keyword Documentation. Try to define your itab5 as:

DATA: itab5 TYPE STANDARD TABLE OF string.
or  try to apply these extras.

Parts marked with " ..." are interchangeable

Extras:

1. ... PROGRAM FROM c1 2. ... INCLUDE INTO c2
3. ... MESSAGE INTO c3
4. ... WORD    INTO c4
5. ... LINE    INTO n1
6. ... OFFSET  INTO n2

Regards,

Jake

Read only

0 Likes
1,914

Hi Jake,

Thanks for taking the time to reply.

I tried both your suggestions. Unfortunately neither works .

I am still getting the same error.

-Aashrith.

Read only

Former Member
0 Likes
1,914

Hi,

Why not try SCAN ABAP-SOURCE ? Try to view this link from Prakash Bhatia.

http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP+-+SCAN+Utility+to+identify+ABAP+statements+based+...

Regards,

jake

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,914

Did you check the class / method I mentioned ? If its not working the please specify the exact reason .

Read only

0 Likes
1,914

Thanks for following up, Kesavadas.

The method you have mentioned tells me whether my source code has errors or not.

My requirement is to identify data objects in the source code.

Eg : 1. data c type mara-matnr.

       2. tables kna1.

       3. select * from mard.

       4. " marc is another table name.

Here mara-matnr, kan1 & mard should be identified and marc should be ignored.

Read only

0 Likes
1,914

"Here mara-matnr, kan1 & mard should be identified and marc should be ignored"

On what basis you are ignoring MARC. This question doesn't match with your actual question. How is "SCAN AND CHECK ABAP-SOURCE" going to help you with this ?

"My requirement is to identify data objects in the source code"

Check if this blog helps you http://help-abap.zevolving.com/2012/02/list-the-environment-variables-used-in-a-program/ , mark 'X' to environment_selection-tabl and check it

Read only

0 Likes
1,914

Scan and check abap-source  identifies all the data objects .

Marc should be igonored because it's used inside a comment and does not act as a data object in the example above.

That's the reason I am trying to use it.

Read only

Former Member
0 Likes
1,914

Hi,

Try using 'SCAN ABAP-SOURCE'   instead of 'SCAN AND CHECK ABAP-SOURCE'.

Regards,

Sharin

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,914

In that case the blog which I mentioned will provide you the solution.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,914

In that case the blog which I mentioned will provide you the solution.