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

ABAP query issue

Former Member
0 Likes
699

Hi All ,

While creating ABAP query to fetch data from a table , i want to fetch data where one field begins with 1* or 2* or 3* or 4* . If it possible to write select stmt while creating query thru SQ01 , where should i write it ? Where should i COUNT the data selected and display it . i'm using SAP 6.0

Thanks & Regards ,

Sabu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
606

Hi,

I hope Alex is right.please close the thread

Regards

rasheed

5 REPLIES 5
Read only

Former Member
0 Likes
606

Actually you can get report for the query.May be be you can write in that.

search the forum.

Read only

Former Member
0 Likes
606

Hi

I think you can write a report to fetch data and count data, then display.

For select statement

select field1 field2 ...

from db_tab

into table i_tab

where condition_field like '1%'

or condition_field like '2%'

or condition_field like '3%'

or condition_field like '4%'.

For display

loop at i_tab into w_tab.

write:/ w_tab-field1, w_tab-field2, ... .

endloop.

Edited by: alex yu on Nov 25, 2008 6:00 AM

Read only

Former Member
0 Likes
607

Hi,

I hope Alex is right.please close the thread

Regards

rasheed

Read only

0 Likes
606

No, above mentioned is not the solution for your problem.

I believe you want to write ABAP Query (i.e. Tcode SQ01), NOT the SQL Query in a normal program.

Now, if you want to put abap code behind a field in your SQ01 query then you need to create custom field in your infoset. To learn how to create custom fields I have written a blog:

Good news is that you do not need to create custom fields for the requirement that you mentioned.

i want to fetch data where one field begins with 1* or 2* or 3* or 4* .

For this, simply put the field on the selection screen by selecting appropriate check box and just use 1, 2, 3* or 4* in on the selection screen.

Where should i COUNT the data selected and display it .

when you execute the report, click on the 'Layout' icon, and select 'Column for number of rows'. It will give you last row with count. You can then save the layout as default layout so that it appears automatically.

If you want to do anything different than above then you need to create custom fields, see my blog for that.

Read only

0 Likes
606

Thank you all , the issue solved .

Thanks Shafiq this is very useful one .

Sabu