‎2007 May 07 4:50 PM
TYPES: BEGIN OF ty_data,
Field1 like table-field1,
Field2 like table-field2,
Field3 like table-field3,
end of ty_data.
DATA: t_data TYPE TABLE OF ty_data.
SELECT field2 field3
INTO CORRESPONDING FIELDS OF TABLE t_data
FROM table
WHERE a <> ''
AND b = 'CO'
AND c = '01'.
While I use the above SELECT statement I do not get any data in my internal table . All the columns are blanks though it shows that there are 1000 records .
SELECT field2 field3
INTO TABLE t_data
FROM table
WHERE a <> ''
AND b = 'CO'
AND c = '01'.
When I use the one above I get the data for all the 1000 records but they are not populated in the right column in the internal table .
Please advise where I am going wrong .
Also After I get all the data for field2 and field3 . I need to loop again at t_data and create a relationship between field2 and field3 which is going to be field1 = zzzz.
Please advise .
Thank you,
‎2007 May 07 5:00 PM
Hi,
If you use INTO TABLE the sequence has to match..
So Move the FIELD1 declaration to the third position..
TYPES: BEGIN OF ty_data,
Field2 like table-field2,
Field3 like table-field3,
<b>Field1 like table-field1,</b>
end of ty_data.
Thanks,
Naren
‎2007 May 07 4:55 PM
Make your fields lower case:
TYPES: BEGIN OF ty_data,
field1 like table-field1,
field2 like table-field2,
field3 like table-field3,
end of ty_data.
They must match the DB table exactly.
‎2007 May 07 4:57 PM
The table only has field2 and field3 .
After getting field2 and field3 I need to create a relationship 'ZZZZ' between fields2 and field3 which will field1 = 'ZZZZ'.
Thanks ,
‎2007 May 07 5:02 PM
‎2007 May 07 5:00 PM
Hi,
If you use INTO TABLE the sequence has to match..
So Move the FIELD1 declaration to the third position..
TYPES: BEGIN OF ty_data,
Field2 like table-field2,
Field3 like table-field3,
<b>Field1 like table-field1,</b>
end of ty_data.
Thanks,
Naren
‎2007 May 07 5:27 PM
Do not use Corresponding field statement ( It has Preformance issue ).
First Declare your Internal Table like :
Structure
TYPES: BEGIN OF ty_data,
Field2 like table-field2,
Field3 like table-field3,
end of ty_data.
Internal Table
DATA: t_data TYPE TABLE OF ty_data.
Work Area
Data : wa_data like line of t_data.
Structure
TYPES: BEGIN OF ty_data1,
Field1 like table-field1,
end of ty_data1.
Internal Table
DATA: t_data1 TYPE TABLE OF ty_data1.
Work Area
Data : wa_data1 like line of t_data1.
Start-of-selection.
SELECT field2 field3
INTO TABLE t_data
FROM table
WHERE a <> ''
AND b = 'CO'
AND c = '01'.
Now loop your internal table
Loop at t_data into wa_data.
Do the your comparision
And modify the data into one more internal table
T_data1 has value now.
Endloop.
Reward Points if it is helpful
Thanks
Seshu