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 Query Issues

Former Member
0 Likes
688

Hi all,

I want to write a select query in which i select data from standard table to my internal table, while filling my internal table i want one column in my internal table to be filled though hard code.

For e.g. if my itab has 5column the 4 column will be filled data from the standard table and the 5th column should have e.g "X" data.

Kindly advice me how to write a query.

Regards,

shegar

4 REPLIES 4
Read only

Former Member
0 Likes
555

Loop the internal table and modify the table with the required hard coded value

Read only

0 Likes
555

Thanks Ganti,

I thought there would be something in select query.

Anyway thanks for your reply.

Rohini

Read only

RaymondGiuseppi
Active Contributor
0 Likes
555

AFAIK, OPEN-SQL SELECT statement is not able to fulfill your requirement, so SELECT first data into your internal table and then update the internal table, either with a MODIFY WHERE or a LOOP AT ASSIGNING statements.

As some database SQL allow the use of constants in the resulting columns, you could then consider using a native sql syntax, but there is not much interest in doing so.

Regards,

Raymond

Read only

Former Member
0 Likes
555

Rohit,

There is a 2 step process in this, first select all the data without that column being populated of any values. In the second step, you need to do following

wa_itab-field4 = 'xxxxxx'.

Modify itab from wa_itab transporting field4 where field4 IS INITIAL.

This will update all the fields with the hard coded values. You will not have to loop.

Regards,

Hardik Mehta