on 2005 Jul 25 10:17 AM
In the select statement, how can I specify fields of an internal table which I want to be filled from a database table? Is it possible to define in INTO clause that I want db_field1 to be copied into itab_field3?
... INTO (f1, ..., fn)
Places the result set in the target area (f1, ..., fn). The fields of the result set are transported to the target fields fi from left to right. INTO (f1, ..., fn) is allowed only if a list with n elements is also specified in the SELECT clause.
If the result of a selection is a table, the data is retrieved in a processing loop introduced by SELECT and concluded by ENDSELECT. The processing passes through the loop once for each line read. If the result is a single record, the closing ENDSELECT is omitted.
Example
Output a list of all airlines (with short description and name):
TABLES SCARR.
DATA: CARRID LIKE SCARR-CARRID,
CARRNAME LIKE SCARR-CARRNAME,
SELECT CARRID CARRNAME
INTO (CARRID, CARRNAME)
FROM SCARR.
WRITE: / CARRID, CARRNAME.
ENDSELECT
If u have defined an internal tabel and in select query u r retrieving a few fields then use INTO CORRESPONDING FIELDS OF..
DATA: Begin of tab occurs 0,
matnr like mara-matnr,
maktl like mara maktl,
end of tab.
select matnr from
mara <b>into corresponding fields of table tab</b>
where matnr IN s_matnr.
Try this one.
Message was edited by: Judith Jessie Selvi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
10 | |
10 | |
10 | |
10 | |
9 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.