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 program

Former Member
0 Likes
1,055

Hi All,

When i check the syntax check for a program i got the below error.

The line structure of the table LIFNR_WORKTAB is incorrect.

The declaration and select statement is like this.

data:   begin of lfa1_tab occurs 200.       
        include structure lfa1.
data:   end   of lfa1_tab.

data:   begin of lifnr_worktab occurs 500,  
         lifnr like lfa1-lifnr,
        end   of lifnr_worktab.      

          select * from lfa1 appending table lfa1_tab
                           where lifnr in lifnr_worktab.

How i can solve this one.

Regards

Jai

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
802

Hi,

data: begin of lfa1_tab occurs 200.

include structure lfa1.
data:   end   of lfa1_tab.
 
data:   begin of lifnr_worktab occurs 500,  
         lifnr like lfa1-lifnr,
        end   of lifnr_worktab.      
 
          select * from lfa1 appending table lfa1_tab
                     for all entries in lifnr_worktab " As per your code this happens to be Internal Table
                           where lifnr = lifnr_worktab-lifnr

.

Cheerz

Ram

4 REPLIES 4
Read only

Sm1tje
Active Contributor
0 Likes
802

Well to be honest, this is not the only thing that fails / will fail.

In this case you are comparing two different things actually. This would be the way

select * from lfa1 appending table lfa1_tab

where lifnr in lifnr_worktab-lifnr.

But now you will face problem that this is not an internal table. But what you need here is a range.

Some well meant advice: Better check ABAP help first.

Just to be complete about this:

Stop using the OCCURS statement. Obviously no one is using ABAP OO yet??

Read only

Former Member
0 Likes
803

Hi,

data: begin of lfa1_tab occurs 200.

include structure lfa1.
data:   end   of lfa1_tab.
 
data:   begin of lifnr_worktab occurs 500,  
         lifnr like lfa1-lifnr,
        end   of lifnr_worktab.      
 
          select * from lfa1 appending table lfa1_tab
                     for all entries in lifnr_worktab " As per your code this happens to be Internal Table
                           where lifnr = lifnr_worktab-lifnr

.

Cheerz

Ram

Read only

Former Member
0 Likes
802

Answered

Read only

0 Likes
802

Before raising further basic questions, learn the difference between a correct, very helpful and helpful answer and assign p0ints accordingly.