2023 Aug 08 4:07 PM
Hello,
I get an error when I want to define a structure named "rs_table" after making a type definition.
error : TYPE ''CCT'' is unknown.
method get_cc_mail.
data: lt_data type table of ty_data.
types : begin of ty_cc,
cc type ad_smtpadr,
end of ty_cc.
data : cct type table of ty_cc.
data : rs_table type cct.
...
..
Can't we define type inside method?
Please suggest if anyone has a solution for this.
Thanks.
2023 Aug 08 4:30 PM
2023 Aug 08 7:06 PM
Or else can use 'LIKE' in place of 'TYPE' keyword.
DATA: rs_table like cct.
2023 Aug 08 9:07 PM
2023 Aug 08 9:11 PM
Note that we don't know what type should be RS_TABLE... structure, table or what... infinite number of solutions
2023 Aug 09 5:52 AM
By the naming convention, we can guess sometimes, but yes, there could be many solutions.
2023 Aug 09 6:49 AM
But I dont understand.
"sflight" is a table.
"cct" is a table.
data : gs_flight TYPE sflight " =>I am not getting any error.<br> "
data : rs_table TYPE cct "=> i am getting error. ( "cct" is a table)"
2023 Aug 09 8:29 AM
cct is a table. But it isn't a type. After the TYPE keyword you must specify a type.
Go back to your notes and try and learn the difference between TYPE and DATA.
2023 Aug 09 9:04 AM
sflight is a table but it isn't a type.
cct is a table but it isn't a type.
but
data : gs_flight TYPE sflight "=> I am not getting any error"
data : rs_table TYPE cct "=> i am getting error. ( "cct" is a table)"
2023 Aug 09 9:47 AM
sflight defines the structure of a database table in the data dictionary. It is a type. It is not a data object.
cct is an internal table. It is a data object. It is not a type.
At the risk of confusing you further, you can write:
cct = value #( ( cc = '1' ) ).
but you cannot write
sflight = value #( ( carrid = '2' ) ).
2023 Aug 09 10:09 AM
2023 Aug 08 5:00 PM
"metot" -> "method"
Of course you can define local types.
You should look again at your code, the error is "obvious" (at least you should be able to find it after looking again and again).
2023 Aug 08 9:08 PM
Please edit your question (Actions>Edit), select your code and press the button [CODE], which makes the code appear colored/indented, it'll be easier for people to look at it. Thanks!
2023 Aug 09 6:50 AM
I dont understand.
"sflight" is a table.
"cct" is a table.
data : gs_flight TYPE sflight "=> I am not getting any error"
data : rs_table TYPE cct "=> i am getting error. ( "cct" is a table)"
2023 Aug 09 8:03 AM
It seems that your question is that you want to know
If you know, you will be able to solve easily this kind of syntax error.
A "data type" is declared by "TYPES", a "data object" is declared by "DATA".
You declare a data object or a data type based on another "data type" by using "TYPE" or on another "data object" by using "LIKE".
So, your code is currently wrong.
2023 Aug 09 8:19 AM
2023 Aug 09 9:36 AM
yalcin.mete You have said that:
data : gs_flight TYPE sflight "=> I am not getting any error"
data : rs_table TYPE cct "=> i am getting error. ( "cct" is a table)"
My answer:
2023 Aug 09 10:09 AM