‎2009 Feb 09 5:53 AM
Hai ,
I am trying to read field attributes using DESCRIBE FIELD satement & I am getting the field type
in SYDES_DESC-types.
When I am trying to read the attributes of a structure like the one below,
data : begin of STRUCT ,
field1 type c,
field2 type c,
end of STRUCT.
and the table like below,
data : begin of TAB1 occurs 10,
field1 type c,
field2 type c,
end of TAB1.
that is ,
describe field STRUCT in w_sydes_desc.
describe field TAB1 in w_sydes_desc.
( w_sydes_desc is of type sydes_desc).
my question is,
for the above 2 stements the table W_SYDES_DESC-TYPES contains same values
though one is plain structure & another one is internal table with header line.
can any one tell how can we distinguish between the above fields?
or is ther any other approach to find wheter a variable is a struct or table?
Regards,
Bhaskar M
‎2009 Feb 09 6:08 AM
Hello,
describe field STRUCT in w_sydes_desc.
describe field TAB1 in w_sydes_desc.
When you use an int. table with HEADER LINE, then TAB1 represents the HEADER LINE & not the entire table body. To access the whole table you have to use TAB1[].
So you are getting the same results.
Try this coding:
TYPE-POOLS: sydes.
DATA : BEGIN OF struct ,
field1 TYPE c,
field2 TYPE c,
END OF struct.
DATA:
w_sydes_desc TYPE sydes_desc,
w_sydes_desc1 TYPE sydes_desc.
DATA :
BEGIN OF tab1 OCCURS 10,
field1 TYPE c,
field2 TYPE c,
END OF tab1.
DESCRIBE FIELD struct INTO w_sydes_desc.
DESCRIBE FIELD tab1[] INTO w_sydes_desc1.
IF sy-subrc = 0.
WRITE: 'Hurray !!!'.
ENDIF.BR,
Suhas
‎2009 Feb 09 6:01 AM
hi...
you can use this one for your information
http://help.sap.com/saphelp_46C/helpdata/EN/d3/2e974d35c511d1829f0000e829fbfe/frameset.htm
regards
‎2009 Feb 09 6:08 AM
Hello,
describe field STRUCT in w_sydes_desc.
describe field TAB1 in w_sydes_desc.
When you use an int. table with HEADER LINE, then TAB1 represents the HEADER LINE & not the entire table body. To access the whole table you have to use TAB1[].
So you are getting the same results.
Try this coding:
TYPE-POOLS: sydes.
DATA : BEGIN OF struct ,
field1 TYPE c,
field2 TYPE c,
END OF struct.
DATA:
w_sydes_desc TYPE sydes_desc,
w_sydes_desc1 TYPE sydes_desc.
DATA :
BEGIN OF tab1 OCCURS 10,
field1 TYPE c,
field2 TYPE c,
END OF tab1.
DESCRIBE FIELD struct INTO w_sydes_desc.
DESCRIBE FIELD tab1[] INTO w_sydes_desc1.
IF sy-subrc = 0.
WRITE: 'Hurray !!!'.
ENDIF.BR,
Suhas
‎2009 Feb 09 6:09 AM