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

Strange Error

Former Member
0 Likes
885

Hello Experts,

I am creating the ALV grid using method and class.

I have declare the following fields as

DATA: i_fieldcat TYPE lvc_t_fcat,

wa_fieldcat TYPE lvc_t_fcat.

and below i am filling the structure.

CLEAR i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'BUKRS'.

wa_fieldcat-inttype = 'C'.

wa_fieldcat-outputlen = 4.

wa_fieldcat-coltext = text-t01.

APPEND wa_fieldcat TO i_fieldcat.

When i am activing the code it is throwing the error

"WA_FIELDCAT is a table without a header line and therefore has no componentcalled FIELDNAME.

I am using the same code in another program and other program is working perfectly all right. I am not able to find why it is throwing such error. Please help me.

Thanks,

amit

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
770

Please change the code as follows.



DATA: i_fieldcat TYPE lvc_t_fcat,
      wa_fieldcat TYPE <b>lvc_s_fcat</b>.

REgards,

Rich Heilman

5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
771

Please change the code as follows.



DATA: i_fieldcat TYPE lvc_t_fcat,
      wa_fieldcat TYPE <b>lvc_s_fcat</b>.

REgards,

Rich Heilman

Read only

0 Likes
770

The reason is that you have defined the work area wa_fieldcat as the type table lvc_t_fcat, since it is a table type, there is no header line, which means that the ABAP syntax checking can not see the structure. You must reference the structure LVC_S_FCAT for your work area.

REgards,

Rich Heilman

Read only

0 Likes
770

Thanks Rich, now it is activated.

Read only

Manohar2u
Active Contributor
0 Likes
770

DATA: i_fieldcat like lvc_t_fcat occurs 0 with header line,

wa_fieldcat TYPE lvc_t_fcat.

Read only

Former Member
0 Likes
770

Hi Amit,

Reference ALV GRID program using ABAP OBJECTS,

BCALV_EDIT_01

BCALV_EDIT_02

BCALV_EDIT_03

BCALV_EDIT_04

BCALV_EDIT_05

BCALV_EDIT_06

BCALV_EDIT_07

BCALV_EDIT_08

Regards,

Azaz Ali.