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

Error with code

Former Member
0 Likes
616

I am getting the following error when I check some code:

E:"LT_TAB1" is a table without a header line and therefore has no component called "COMPONENT1".

I have defined the table as:

DATA: lt_tab1 type standard table of /BI0/Ptable initial size 0,

ls_tab1 type /BI0/Ptable.

It was originally defined as:

DATA: lt_tab1 LIKE /BI0/Ptable OCCURS 0,

ls_tab1 LIKE LINE OF lt_tab1.

But the second definition was giving an error otherwise.

Can someone advise? Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
593

Hello,

The table that you've declared doesn't have a header line like before. Instead you need to read it (using READ lt_tab1... INTO ls_tab1) or do a LOOP lt_tab1 ... INTO ls_tab1 to works with the data in this.

I suggest you to do not use the WITH HEADER LINE because this command has some restriction in ABAP Objects.

Extract from SAP Help

Note

These statements for processing individual table rows have short forms that implicitly use the header line as work area. These short forms are allowed only outside of ABAP Objects.

Regards.

4 REPLIES 4
Read only

Former Member
0 Likes
594

Hello,

The table that you've declared doesn't have a header line like before. Instead you need to read it (using READ lt_tab1... INTO ls_tab1) or do a LOOP lt_tab1 ... INTO ls_tab1 to works with the data in this.

I suggest you to do not use the WITH HEADER LINE because this command has some restriction in ABAP Objects.

Extract from SAP Help

Note

These statements for processing individual table rows have short forms that implicitly use the header line as work area. These short forms are allowed only outside of ABAP Objects.

Regards.

Read only

matt
Active Contributor
0 Likes
593

You need to post more code, like specifically WHERE the error occurs.

Chance are you are using lt_tab1 where you should be using ls_tab1.

matt

Read only

Former Member
0 Likes
593

Hi,

Try using the option 'WITH HEADER LINE' and see if it helps.

Rugmani.

Read only

0 Likes
593

Thanks for this. The work is part of SAP BI update rules. Where I have carried out the following in a start routine:

DATA: lt_tab1 type standard table of /BI0/Ptable initial size 0,

ls_tab1 type /BI0/Ptable

***********

REFRESH lt_tab1.

SELECT field1

FROM /BI0/Ptable

INTO TABLE lt_tab1

FOR ALL ENTRIES IN lt_other_table

WHERE field1 EQ lt_other_table-field1

AND OBJVERS EQ 'A'.

IF sy-subrc = 0.

SORT lt_tab1 BY field1 ASCENDING.

ENDIF.

I am not reading the table and will make modifications to do the same. Have awarded points