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

SELECT with fixed value

Former Member
0 Likes
6,891

Hi,

I want to use SELECT....INTO TABLE statement but using a fixed value in one column, is that possible???

I'm trying to do something like this:

SELECT matnr "sy-datum" quantity FROM ztable INTO TABLE it_table.

The it_table has got 3 columns: matnr, date and quantity but in the ztable there isn't a date and I want to insert into the table with a variable or something...

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,842

It is not possible ..

U have to write the coding as ...

SELECT matnr quantity FROM ztable

INTO corresponding fields of TABLE it_table.

Loop at it_table.

it_table-date = <date>.

modify it_table index sy-tabix.

endloop.

8 REPLIES 8
Read only

Former Member
0 Likes
2,842

hi,

do this way ..


SELECT matnr date quantity FROM ztable INTO TABLE it_table where date = sy-datum.

Regards,

Santosh

Read only

ThomasZloch
Active Contributor
0 Likes
2,842

don't think so. You'll probably have to select two fields from ztable by INTO CORRESPONDING FIELDS and then perform a mass update on the internal table in a second step.

Thomas

Read only

prasanth_kasturi
Active Contributor
0 Likes
2,842

hi,

Its not possible with select statemnet

first you must go with select using its corresponding addition

then use loop statemnt and modify the record

regards

prasanth

Read only

Former Member
0 Likes
2,843

It is not possible ..

U have to write the coding as ...

SELECT matnr quantity FROM ztable

INTO corresponding fields of TABLE it_table.

Loop at it_table.

it_table-date = <date>.

modify it_table index sy-tabix.

endloop.

Read only

0 Likes
2,842

Ok... Thanks Srinivas.

I thought it was possible.

I already knew the loop solution but it doesn't looks like a good performance solution

Read only

Former Member
0 Likes
2,842

you can use into corresponding fields of it_table and then modify the it_table with sy-datum.

Read only

Former Member
0 Likes
2,842

Do like this.

SELECT matnr date quantity FROM ztable INTO TABLE it_table.

loop at it_table into wa_table.

wa_table-date = sy-datum.

modify it_table from wa_table.

endloop.

DhanaLakshmi

Read only

Former Member
0 Likes
2,842

Hi,

you can do like this.

Suppose your internal table structure is like that,

********************************************************************

data:begin of itab occurs 0,

matnr type mara-matnr,

datum type sy-datum,

quant type menge,

end of itab.

SELECT matnr quant FROM ztable INTO corresponding fields of TABLE it_table.

loop at itab .

itab-datum = sy-datum.

modify itab index sy-tabix.

endloop.

********************************************************************

If you do like this then your column of itab-datum will have sy-datum .

I hope this will help you.

Help children of U.N World Food Program by rewarding them and encourage others to answer your queries