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

Abap Objects .

herzelhaimharel_gilor
Participant
0 Likes
1,291

i'm building a new class and i got an srious problem .

here's the code :

CLASS lcl_alv_control DEFINITION .

PUBLIC SECTION.

*Structure to transfer to the Alv Grid

TYPES : BEGIN OF scrdisp ,

ts_icons(30) TYPE c,

dp_icons(30) TYPE c,

symbols(30) TYPE c,

info(4) TYPE c,

colinfo TYPE lvc_t_scol ,

cellstyles TYPE lvc_t_styl ,

  • checkbox,

  • lights,

links TYPE i ,

END OF scrdisp.

DATA:

gtab_scrdisp TYPE TABLE OF scrdisp INITIAL SIZE 0 ,

gstr_scrdisp LIKE LINE OF gtab_scrdisp,

*Field Catalog for the ALV Grid

gt_fieldcat_lvc TYPE TABLE OF lvc_t_fcat INITIAL SIZE 0 ,

gs_fieldcat_lvc LIKE LINE OF gt_fieldcat_lvc ,

*Color Table for handle all the cells colors .

gt_color TYPE TABLE OF lvc_t_scol INITIAL SIZE 0 ,

gs_color LIKE LINE OF gt_color .

*Another Global Data

METHODS:

set_ctl_name ,

build_layout ,

build_fieldcat ,

set_hendlers ,

exclude_toolbar_buttons ,

display ,

build_data ,

on_double_click ,

handle_user_command ,

handle_toolbar_set .

ENDCLASS.

CLASS lcl_alv_control implementation.

method build_layout.

gs_color-fname = 'whatever'. <--- the problematic line

endmethod.

endclass.

in the implementation section when i use the gs_color structure i got error that tells me : "GS_COLOR" is a table without a header line and therefore has no component called "FNAME".

could someone can help with this ??

6 REPLIES 6
Read only

Former Member
0 Likes
1,109

Hi Herzel,

You have defined gt_color as a table of lvc_t_scol. However, type lvc_t_scol is already a table. As a consequence the definition of gs_color is also a table.

Suggested correction:

gt_color TYPE lvc_t_scol,

gs_color TYPE lvc_s_scol.

Regards,

John.

Read only

herzelhaimharel_gilor
Participant
0 Likes
1,109

gt_color is table type of lvc_t_scol

and gs_color is like line of gt_color

so why should be a problem with it ???

Message was edited by: Herzel Elmalme

Read only

0 Likes
1,109

Again: lvc_t_scol is already a table; the way you define gt_color will create a table of a table. And thus gs_color (LIKE LINE OF) will be table also, and in OO you can not address a field in a table, you should use a falt structure.

John

Read only

0 Likes
1,109

ok .

but if i declare gs_color type lvc_s_scol

after wards i need to append

and then i write :

append gs_color to gt_color.

and again i got an error .

Read only

0 Likes
1,109

Hello Herzel,

what John tried to explain the table defintion should be fixed not the line definition. Can you please try the following?

Best Regards

Klaus


report  kzi_test_01.

data:
  gt_Color type lvc_T_Scol,
  gs_Color like line of gt_Color.


insert gs_Color into table gt_Color.

Read only

0 Likes
1,109

Would be nice to get any feedback if the remark was of any help....

Regards,

John.