‎2014 Apr 22 2:36 PM
Hi,
How can I achieve below type declarations?
TYPES:BEGIN OF ty_scarr,
carrid TYPE scarr-carrid,
carrname TYPE scarr-carrname,
currcode TYPE scarr-currcode,
END OF ty_scarr,
BEGIN OF ty_sflight,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
fldate TYPE sflight-fldate,
price TYPE sflight-price,
END OF ty_sflight,
tt_sflight TYPE STANDARD TABLE OF ty_sflight.
TYPES:BEGIN OF ty_result.
INCLUDE TYPE ty_scarr.
TYPES: sflight_tab TYPE tt_sflight,
END OF ty_result.
The above results in syntax error however below one works:
TYPES:BEGIN OF ty_scarr,
carrid TYPE scarr-carrid,
carrname TYPE scarr-carrname,
currcode TYPE scarr-currcode,
END OF ty_scarr,
BEGIN OF ty_sflight,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
fldate TYPE sflight-fldate,
price TYPE sflight-price,
END OF ty_sflight,
tt_sflight TYPE ty_sflight OCCURS 0.
TYPES:BEGIN OF ty_result.
INCLUDE TYPE ty_scarr.
TYPES: sflight_tab TYPE tt_sflight,
END OF ty_result.
Is there a way to achieve above without using "OCCURS 0" keyword as "OCCURS" keyword is not supported withing OO context?
Thanks!
‎2014 Apr 22 2:59 PM
Hello Shrinivas,
Please use the below syntax
Data : tt_sflight TYPE STANDARD TABLE OF ty_sflight.
Thanks
‎2014 Apr 22 2:59 PM
Hello Shrinivas,
Please use the below syntax
Data : tt_sflight TYPE STANDARD TABLE OF ty_sflight.
Thanks
‎2014 Apr 22 4:18 PM
I tried that too however with below code now I get syntax error "The type 'TT_SFLIGHT' is unknown, but there is a type with the similar name 'TY_SFLIGHT'." on line "TYPES: sflight_tab TYPE tt_sflight"
TYPES:BEGIN OF ty_scarr,
carrid TYPE scarr-carrid,
carrname TYPE scarr-carrname,
currcode TYPE scarr-currcode,
END OF ty_scarr,
tt_scarr TYPE STANDARD TABLE OF ty_scarr,
BEGIN OF ty_sflight,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
fldate TYPE sflight-fldate,
price TYPE sflight-price,
END OF ty_sflight.
DATA: tt_sflight TYPE STANDARD TABLE OF ty_sflight.
TYPES:BEGIN OF ty_result.
INCLUDE TYPE ty_scarr.
TYPES: sflight_tab TYPE tt_sflight,
END OF ty_result,
tt_result TYPE STANDARD TABLE OF ty_result.
‎2014 Apr 22 4:29 PM
Hello,
Which ABAP release are you working on?
When i use your code (on an ABAP 740 kernel) i get the following error message -
This is because the type is generic w.r.t the key. If you intend to use it in other types, you have to explicitly define the key for the table type.
Since I'm on ABAP release 740 so i can use the addition EMPTY KEY -
If you are on previous releases i think you can use the addition DEFAULT KEY.
BR,
Suhas
‎2014 Apr 22 4:41 PM