2004 Nov 23 3:32 PM
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 ??
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.
2004 Nov 23 3:42 PM
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.
2004 Nov 23 4:24 PM
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
2004 Nov 23 4:39 PM
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
2004 Nov 23 5:16 PM
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 .
2004 Nov 23 5:26 PM
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.
2004 Nov 30 2:05 PM
Would be nice to get any feedback if the remark was of any help....
Regards,
John.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |