Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CORRESPONDING

Former Member
0 Likes
695

can we change the statement as follows

SELECT carrid connid airpfrom cityfrom airpto cityto deptime arrtime

FROM spfli

INTO CORRESPONDING FIELDS OF wa_spfli.

SELECT carrid connid airpfrom cityfrom airpto cityto deptime arrtime

FROM spfli

INTO TABLE wa_spfli.

1 ACCEPTED SOLUTION
Read only

former_member404244
Active Contributor
0 Likes
672

Hi,

u need to declare the internal table like this.

data : begin of wa_spfli occurs 0,

carrid type S_CARR_ID,

connid type S_CONN_ID,

airpfrom type S_FROMAIRP,

cityfrom type S_FROM_CIT,

airpto type S_TOAIRP,

cityto type S_TO_CITY,

deptime type S_DEP_TIME,

arrtime type S_ARR_TIME,

end of wa_spfli.

now write ur select statement

SELECT carrid connid airpfrom cityfrom airpto cityto deptime arrtime

FROM spfli

INTO TABLE wa_spfli.

regards,

Nagaraj

6 REPLIES 6
Read only

Former Member
0 Likes
672

If the table wa_spfli is declared in the order of selecting field then u can change the code like the second select.

REgards,

Vasanth

Read only

Former Member
0 Likes
672

<b>INTO TABLE </b> is specified for an internal table.

Read only

former_member404244
Active Contributor
0 Likes
673

Hi,

u need to declare the internal table like this.

data : begin of wa_spfli occurs 0,

carrid type S_CARR_ID,

connid type S_CONN_ID,

airpfrom type S_FROMAIRP,

cityfrom type S_FROM_CIT,

airpto type S_TOAIRP,

cityto type S_TO_CITY,

deptime type S_DEP_TIME,

arrtime type S_ARR_TIME,

end of wa_spfli.

now write ur select statement

SELECT carrid connid airpfrom cityfrom airpto cityto deptime arrtime

FROM spfli

INTO TABLE wa_spfli.

regards,

Nagaraj

Read only

Former Member
0 Likes
672

Yes its possible..

Provided your internal table has been declared , in the same order of the fields ,

as you are using in the select statement .

Praveen .

Read only

Former Member
0 Likes
672

hi,

can we change, but before chnaging you must create internal table as per selected fields sequence.

you must create internal table with selected fields order or write the select statement as per internal table fields order.

SELECT carrid connid airpfrom cityfrom airpto cityto deptime arrtime

FROM spfli

INTO CORRESPONDING FIELDS OF wa_spfli.

in this case no need to keep the internal table fields and selected fields in same sequence. but this statement affects on perfomace.( don't use select statements with CORRESPONDING addition).

SELECT carrid connid airpfrom cityfrom airpto cityto deptime arrtime

FROM spfli

INTO TABLE wa_spfli.

this statement deffinetly improves the perfomance of your program. but here you must take care regarding internal table fields order and selected fields order.

regards,

Ashokreddy.

Read only

Former Member
0 Likes
672

Hi Abhijeet,

Good question and this is what you are supposed to do everytime to better the code as per the performance issue.

You can achieve this by using the following things.

1> Create a types declaration.

types: begin of ty_vbak,

field1 type vbak-field1,

field2 type vbak-field2,

field3 type vbak-field3,

end of ty_vbak.

2> Make sure that occurances of fields are in the sequential order as they are in the table.

field1 occurs first from the top and after field1 field2 occurs so that fetching can be done in the same manner.

3> Create a structure for this.

data: x_vbak type ty_vbak.

4> Create an internal table if it is contain more than one line/entry of data.

data: it_vbak type table of ty_vbak.

5> Even in the select query make sure that the conditions are also given in the sequential order.

These should empower u from replacing corresponding keyword.

Reward Points if useful.

Thanks,

Tej..