02-03-2012 7:14 AM
hi ,
i have declared following in a abap class...
TYPES:
zts_alv_line TYPE zmat_pr_costest_alv.
TYPES:BEGIN OF ts_alv_line,
include type zts_alv_line,
matkl type mara-matkl,
t023t type t023t-wgbez,
lvorm type mara-lvorm,
end of ts_alv_line.
TYPES: tt_alv_data TYPE STANDARD TABLE OF ts_alv_line WITH DEFAULT KEY.
DATA:
alv_data TYPE tt_alv_data.
now while refering to alv_data-matnr the sap is giving error that this component does not have matnr.
please help.
Edited by: Suhas Saha on Feb 3, 2012 1:11 PM
02-03-2012 7:32 AM
TYPES:
zts_alv_line TYPE ZCOMP_S_query_line.
TYPES:BEGIN OF ts_alv_line,
matkl type mara-matkl,
t023t type t023t-wgbez,
lvorm type mara-lvorm.
include type zts_alv_line.
types:end of ts_alv_line.
TYPES: tt_alv_data TYPE STANDARD TABLE OF ts_alv_line WITH DEFAULT KEY.
DATA:
alv_data type ts_alv_line-->Change here
02-03-2012 7:29 AM
Hi,
Try like below, Inside method & in declaration,
TYPES:BEGIN OF ty_chk,
b TYPE mara, ( Give your struct/table name)
c TYPE matnr,
END OF ty_chk.
DATA: lt_tbl TYPE TABLE OF ty_chk,
lw_tbl TYPE ty_chk.
lw_tbl-c = lw_tbl-b-matnr.
Regards,
S.Senthilkumar
02-03-2012 7:38 AM
hi senthi,
thanks for yout reply.
i have understood what you have said.
but is there any method to jst refer it derectly as w_tbl-matnr.
because if it is lyk that i will have to change it in every method it is called.
regards,
somesh
02-03-2012 9:14 AM
Hi,
I dont think it's possible, as you are referring a filed(matnr) which is one of the fields of structure 'zts_alv_line'.
Any way I will also try.
Regards,
S.Senthilkumar.
02-03-2012 7:32 AM
TYPES:
zts_alv_line TYPE ZCOMP_S_query_line.
TYPES:BEGIN OF ts_alv_line,
matkl type mara-matkl,
t023t type t023t-wgbez,
lvorm type mara-lvorm.
include type zts_alv_line.
types:end of ts_alv_line.
TYPES: tt_alv_data TYPE STANDARD TABLE OF ts_alv_line WITH DEFAULT KEY.
DATA:
alv_data type ts_alv_line-->Change here
11-04-2012 11:32 AM
04-10-2015 2:17 PM
02-03-2012 7:48 AM
TYPES: zts_alv_line TYPE zmat_pr_costest_alv.
TYPES:BEGIN OF ts_alv_line,
include type zts_alv_line,
matkl type mara-matkl,
t023t type t023t-wgbez,
lvorm type mara-lvorm,
end of ts_alv_line.
Actually by defining this you've defined include as field of ts_alv_line. Actually ts_alv_line is a nested structure.
I think you need to re-define the structure definition as:
TYPES:BEGIN OF ts_alv_line.
INCLUDE TYPE zts_alv_line.
TYPES: matkl TYPE mara-matkl,
t023t TYPE t023t-wgbez,
lvorm TYPE mara-lvorm.
TYPES: END OF ts_alv_line.
BR,
Suhas
02-03-2012 7:57 AM
hi suhas,
thanks to your reply.
but i am still geting the same error.
the problem is that the variable is in some other class which is refering to the type ts_alv_line.
so when i acess matnr it gives the error.
regards,
somesh
12-27-2012 3:58 PM
Hi Somesh,
The Above Class is Right ,Go ahead once or else try a new structure to define. it would be best for you.
Regards,
Kabil