‎2010 Mar 17 11:28 AM
Hi everyone
Could any body give right solution for my doubt below
1)I would like to create a nested sorted /hashed table
This is what i tried
TYPES : BEGIN OF tt_sflight,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
fldate TYPE sflight-fldate,
price TYPE sflight-price,
END OF tt_sflight.
DATA it_sflight TYPE STANDARD TABLE OF tt_sflight INITIAL SIZE 2 WITH KEY carrid connid fldate .
DATA jt_sflight LIKE SORTED TABLE OF it_sflight WITH NON-UNIQUE KEY carrid connid fldate
This gives an error
A table without a header line has no components and therefore no component called "CARRID".
I understand while using "with header line" line type cant be a table type.
So does that means a nested sorted table/hashed table is out of question?U cant create one???
please answer this
‎2010 Mar 17 11:54 AM
Hi,
When you use LIKE you should refer to the line TYPE (When your internal table doesn't have header line, system can't recognize the fields). Below are different solutions.
Solution 1: Create line type and refer to that.
DATA it_sflight TYPE STANDARD TABLE OF tt_sflight INITIAL SIZE 2 WITH KEY carrid connid fldate .
DATA: lwa_sflight TYPE tt_sflight. "Line type/work area
DATA jt_sflight LIKE SORTED TABLE OF lwa_sflight WITH NON-UNIQUE KEY carrid connid fldate.Solution 2: Use TYPE and refer to TYPEs definition
DATA it_sflight TYPE STANDARD TABLE OF tt_sflight INITIAL SIZE 2 WITH KEY carrid connid fldate .
DATA jt_sflight TYPE SORTED TABLE OF tt_sflight WITH NON-UNIQUE KEY carrid connid fldate.Check F1 help for more details.
Thanks,
Vinod.
‎2010 Mar 17 11:50 AM
You should use WITH key and INITIAL SIZE satementst with types, while declaring your structure.
For example
TYPES dtype { {TYPE tabkind OF [REF TO] type}
| {LIKE tabkind OF dobj} }
[WITH key] [INITIAL SIZE n].
For more details read F1 help of DATA and TYPES statement.
‎2010 Mar 17 11:54 AM
Hi,
When you use LIKE you should refer to the line TYPE (When your internal table doesn't have header line, system can't recognize the fields). Below are different solutions.
Solution 1: Create line type and refer to that.
DATA it_sflight TYPE STANDARD TABLE OF tt_sflight INITIAL SIZE 2 WITH KEY carrid connid fldate .
DATA: lwa_sflight TYPE tt_sflight. "Line type/work area
DATA jt_sflight LIKE SORTED TABLE OF lwa_sflight WITH NON-UNIQUE KEY carrid connid fldate.Solution 2: Use TYPE and refer to TYPEs definition
DATA it_sflight TYPE STANDARD TABLE OF tt_sflight INITIAL SIZE 2 WITH KEY carrid connid fldate .
DATA jt_sflight TYPE SORTED TABLE OF tt_sflight WITH NON-UNIQUE KEY carrid connid fldate.Check F1 help for more details.
Thanks,
Vinod.
‎2010 Mar 20 10:25 AM
‎2010 Mar 20 10:27 AM