2006 Oct 03 5:33 AM
Hello,
This is related to BW infospoke enhancement,
in this class i have structure which is filled and i have to aggregate the data in this structure by one of the field level,
i want to declare a internal table with header and take the data from structure into internal table and then do a collect statement on to this internal table..
but i am getting a message that no one more header line is supported in OOPS concept..meaning i am not able to declare a internal table with header line..
any solution to this will be awarded with points.
Hello,
This is related to BW infospoke enhancement,
in this class i have structure which is filled and i have to aggregate the data in this structure by one of the field level,
i want to declare a internal table with header and take the data from structure into internal table and then do a collect statement on to this internal table..
but i am getting a message that no one more header line is supported in OOPS concept..meaning i am not able to declare a internal table with header line..
any solution to this will be awarded with points.
2006 Oct 03 5:39 AM
Hi,
Try this.
TYPES: BEGIN OF TYPE_STRUCTURE,
MATNR TYPE MATNR,
VBELN TYPE VBELN,
END OF TYPE_STRUCTURE.
DATA: T_ITAB TYPE STANDARD TABLE OF TYPE_STRUCTURE.
DATA: WA TYPE TYPE_STRUCTURE.
LOOP AT T_ITAB INTO WA.
IF WA-MATNR IS INITIAL.
.....
ENDIF.
ENDLOOP.
Thanks
Naren
2006 Oct 03 6:26 AM
guys thanks for the quick reply,
now can u guys let me know how do move the data from the structure to the internal table ITAB.
also if i want to declare the type structure with a structure in it..like include structure...??
2006 Oct 03 6:32 AM
Hi,
I don't know whether I understood the qn. correctly.
To get records into itab.
select * from db into table itab.
To move from itab into workarea,use collect statement to fetch the unique entries.
.. here both itab and itab1 are of same type.
data : itab type standard table of ty,
itab1 type standard able of ty.
loop at itab into wa.
....
collect wa into itab1.
endloop.
2006 Oct 03 6:35 AM
here i want to get the records from a structure(e_t_data_out) into itab please.
loop at e_t_data_out into itab.etc..is not working..
2006 Oct 03 6:38 AM
Hi,
just try moving the fields and appending afterwards.
move-corresponding e_t_data_out into wa.
append wa to itab.
2006 Oct 03 6:44 AM
i tried the below,
loop at e_t_data_out.
move-corresponding e_t_data_out into wa.
append wa to itab.
endloop.
AND
loop at e_t_data_out into wa.
move-corresponding e_t_data_out into wa.
append wa to itab.
endloop.
getting the message, e_t_data_out is not a structure OR internal table with headerline.
E_T_DATA_OUT is of type ANY TABLE.
2006 Oct 03 5:46 AM
Hi,
As told,declare types statement.
types : begin of ty,
f1 ...
end of ty.
Then declare internal table and work area of that type.
data : itab type standard table of ty,
wa type ty.
loop at itab into wa.
...
collect wa into itab.
endloop.
If you use COLLECT with a work area, the work area must be compatible with the line type of the internal table.
Try this and kindly reward points if it helps.
2006 Oct 03 3:37 PM
Hi,
Post the code of your internal table declaration..
Thanks,
Naren
2006 Oct 03 7:52 PM
Hello Shashi
You should not use itab with header lines since they mess up any coding and are a nightmare when it comes to maintaining code.
Fortunately, SAP has abandoned header lines from ABAP-OO. If you are not using table types then you have to define your own types, e.g.:
TYPES: BEGIN OF ty_s_line.
TYPES: field_a TYPE ... .
TYPES: field_b TYPE ... .
TYPES: END OF ty_s_line.
TYPES: ty_t_itab TYPE STANDARD TABLE OF ty_s_line
WITH DEFAULT KEY.
DATA:
ls_line TYPE ty_s_line,
lt_itab TYPE ty_t_itab.
* Now fill your itab, e.g.
SELECT * FROM ... INTO CORRESPONDING FIELDS
OF TABLE lt_itab.
* Now working with the itab data.
LOOP AT lt_itab INTO ls_line.
...
ENDLOOP.Regards
Uwe