on 04-20-2006 5:03 AM
Hi experts,
Some doubts, please advice.
I am trying to send aggregate value of one column in ODS table into an internal table. I am using the following code.
select carrid connid AVG( seatsocc ) as seatsocc
from /BIC/ODSTable
into corresponding fields of table itab
where fldate = sy-datum group by carrid connid
But either because there is no header line in ODS table, or because I did use right column names in the internal table itab, I got "0" in all rows. Could anyone please tell me which is the reason of my error?
I tried to skip "corresponding fields of table itab ", and using internal table, however, i got an syntax error.
I saw some ABAP book using working area. Is it the only solution? I am not familiar with working area and someone told me I should be very careful of working area. what's the deal with working area? Can I append working area to an internal table?
Any suggestion will be really appreciated.
Jenny
Hello JennY,
how r u ?
The statements should be in the loop, if u want to use Internal Table automatically the Work Area and body will be created.
Work Area will hold only one record at a time, so u have to append the Internal Table after every record selection.
Loop at itab.
(your statements).
.....
Append itab.
Endloop.
Try with this....
Best Regards....
Sankar Kumar
+91 98403 47141
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
It is not necessary that the field names of your internal table should be same as that of the ODS. But the data type of the internal table fields should be same as that of the ODS fields.
And in the select query you have to specify the field name of the ODS and not the field name of internal table.
Sample:
Data: Begin of itab occurs 0,
CARRID type /BIC/ODSTABLE-/BIC/ZCARRID,
CONNID type /BIC/ODSTABLE-/BIC/ZCONNID,
SEATSOC type /BIC/ODSTABLE-/BIC/ZSEATSOC,
End of itab.
Select /BIC/ZCARRID /BIC/ZCONNID AVG(SEATSOC)
From /BIC/ODSTABLE
Into table itab
Where fldate = sy-datum group by /BIC/ZCARRID /BIC/ZCONNID.
Hope you would be able to get it solved.
Regards,
Prema
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If your Internal table itab has someother fields other than these 3 fields that you are updating then you need to specify into corresponding fields of itab. Whereas if your itab contains only these three fields then into table itab will work.
Work Area is a data object that should be compatible with the line type of the Internal table. It is an interface to the entries in the Internal table.
When you write data to internal table, the data is first written to the work Area and then transferred to appropriate entries in the table.
When you read data from an internal table to work Area, the record is over written to the work Area and it is used in the program.
You can also access an internal table using field symbols. In this case you do not need to copy the data into a work area. You can assign a line of an internal table to a field symbol. Ideally, the field symbol will have the same type as the line type of the internal table. Once you have assigned the entry to the field symbol, working with the field symbol has exactly the same effect as accessing the corresponding line directly.
Regards,
Prema
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.