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 statement

Former Member
0 Likes
2,204

Hi Friends,

I have a customised table with a field BUDTM (Posting date). From this table I want to select the data which are equal to or greater than 01.04.2007.

Kindly guide me.

TIA.

Regards,

Mark K

27 REPLIES 27
Read only

Former Member
0 Likes
2,179

select * from ztable into table itab

where budtm >= '20070401'.

Read only

0 Likes
2,179

Hi,

I have tried like this, but not getting the data. But if I look into the table, data is available for the given date.

Kindly suggest me.

Regards,

Read only

0 Likes
2,179

How is the data stored in the field? Is it a concatenated value of date and time?

eg: 20070104132056

Sudha

Read only

0 Likes
2,179

Hi Mark,

can u paste ur SELECT statement here?

Read only

0 Likes
2,179

Hi,

Data is stored as YYYYMMDD.

Why it is not working, I do not understand.

Regards,

Read only

0 Likes
2,179

Are u sure there is some data which is GE to the date in your table..

If yes paste the code here may be we can help.

santhosh

Read only

0 Likes
2,179

Hi Mark,

Try the below example. Its working fine.

data: begin of itab occurs 0,

ebeln type ebeln,

end of itab.

select ebeln from ekpo

into table itab

where aedat >= '20060421'.

Regards,

Ram

Pls reward points if helpful.

Read only

0 Likes
2,179

Mark,

Can you paste a small dump of the table contents showing the date field in question and the select query that you are using.

Regards,

Gajendra

Read only

0 Likes
2,179

Hi,

The code is pasted here below.

SELECT ZNUM REASON REMARKS NEW_PIF BELNR BSTNUM

FROM ZFIH0004_1

INTO CORRESPONDING FIELDS OF TABLE IT_DATA

WHERE ZGROUP = ZFIH0004_1-ZGROUP AND

BUDTM = '20070331'.

Regards,

Read only

0 Likes
2,179

Hi,

Table contains the data as following:

BUDTM

31.03.2007

31.03.2007

31.03.2007

31.03.2007

31.03.2007

31.03.2007

31.03.2007

31.03.2007

31.03.2007

31.03.2007

Regards,

Read only

0 Likes
2,179

what is 'ZFIH0004_1-ZGROUP'?

if it is one of the values of ZGROUP then change the select statement as below

SELECT ZNUM REASON REMARKS NEW_PIF BELNR BSTNUM

FROM ZFIH0004_1

INTO CORRESPONDING FIELDS OF TABLE IT_DATA

WHERE ZGROUP = <b>'ZFIH0004_1-ZGROUP'</b>

AND BUDTM = '20070331'.

if <b>ZFIH0004_1</b> is a select-option then change the select statement as below

SELECT ZNUM REASON REMARKS NEW_PIF BELNR BSTNUM

FROM ZFIH0004_1

INTO CORRESPONDING FIELDS OF TABLE IT_DATA

WHERE ZGROUP IN <b>ZFIH0004_1</b>

AND BUDTM = '20070331'.

Message was edited by:

Rajesh

Message was edited by:

Rajesh

Read only

0 Likes
2,179

The code is not working because of WHERE ZGROUP = ZFIH0004_1-ZGROUP condition.

You are fetching data from ZFIH0004_1 and specifying the same in where clause in this way. How this will work?

Please specify correct condition for ZGROUP.

Read only

0 Likes
2,179

Hi,

Ur select seems to be OK.

1) First check if ZFIH0004_1-ZGROUP has some value in it.

2) se16 or se11 open your table and go to the selection screen have

ZGROUP

and

BUDTM on ur selection screen there enter the zgroup u need and in the select option of BUDTM give the date and select option as GE...

check if u have the relavent data.

santhosh

Read only

0 Likes
2,179

hi Mark,

Are you sure the first condition satisfied ??

ZGROUP = ZFIH0004_1-ZGROUP AND

What is the declarationg of ZGROUP , chk out if any leading zeroes are missed ,

use CONVERSION_EXIT_ALPHA_INPUT to retain the leading zeroes

Read only

0 Likes
2,179

HI,

Just check the table SE11 execute your table

double click on the date field in your screen ..

chose >= selection enter the date..

For sure the data is not available in the table..

I think the query you worte does not match your requirement..

rewardsif useful

regards,

nazeer

Message was edited by:

nazeer shaik

Read only

0 Likes
2,179

HI,

data lv_date type sy-datum value '20070331'.

SELECT ZNUM REASON REMARKS NEW_PIF BELNR BSTNUM

FROM ZFIH0004_1

INTO CORRESPONDING FIELDS OF TABLE IT_DATA

WHERE ZGROUP = ZFIH0004_1-ZGROUP AND

BUDTM = lv_date..

This will work now..

Else Run your code debug mode and see the values . you will get the solution..

regards

nazeer.

Read only

0 Likes
2,179

Mark,

The code which you have pasted in response to Rajesh's reply is:

SELECT ZNUM REASON REMARKS NEW_PIF BELNR BSTNUM

FROM ZFIH0004_1

INTO CORRESPONDING FIELDS OF TABLE IT_DATA

WHERE ZGROUP = ZFIH0004_1-ZGROUP AND

BUDTM = '20070331'.

In the above code you have BUDTM = '20070331but in your original post you have mentioned that you want to "select the data which are equal to or greater than 01.04.2007.". Clearly your where clause is not in sync with your requirement.

Change the relational operator as follows and after that I'm sure it would work:

SELECT ZNUM REASON REMARKS NEW_PIF BELNR BSTNUM

FROM ZFIH0004_1

INTO CORRESPONDING FIELDS OF TABLE IT_DATA

WHERE ZGROUP = ZFIH0004_1-ZGROUP AND

BUDTM > '20070331'.

Regards,

Gajendra

Read only

0 Likes
2,179

SELECT ZNUM REASON REMARKS NEW_PIF BELNR BSTNUM

FROM ZFIH0004_1

INTO CORRESPONDING FIELDS OF TABLE IT_DATA

WHERE ZGROUP = ZFIH0004_1-ZGROUP AND

BUDTM = '20070331'.

My query would be what is ZFIH0004_1-ZGROUP ? Have you defined another parameter/field with the same name ?

Regards

Anurag

Read only

0 Likes
2,179

Mark,

If your issue was resolved then award points and close this thread.

Regards,

Gajendra

Read only

Former Member
0 Likes
2,179

select <fields> ....... where <your fiield >= condition.

Regards Jayant

Read only

Former Member
0 Likes
2,179
select * from ztable into table itab where BUDTM GE '20070401'.
Read only

Former Member
0 Likes
2,179

Data: GV_Date type Custom-table-BUDTM Value '01.04.2007'.

Select <fieldlist>

from custom-table

into table it_itab

where budtm GE gv_date.

santhosh

Read only

Former Member
0 Likes
2,179

p_date

SELECT * FROM ZTABLE

WHERE BUDTM >= p_date.

where p_date is the date parameter and you can input it to be 01.04.2007

Read only

Former Member
0 Likes
2,179

DATA: <VAR> LIKE SY-DATUM VALUE 'YYYYMMDD'.

SELECT

<fld1>

<fld2>

<fld3>

....

INTO [CORRESPONDING FIELDS OF TABLE ] <itab>

FROM <dbtab>

WHERE

BUDTM GE <VAR>.

Regards,

A. Singh

Read only

Former Member
0 Likes
2,179

hi

good

check the begda and endda with in the if statement comarinng with sy-datum.

thanks

mrutyun^

Read only

Former Member
0 Likes
2,179

Hi

Look at this code this is working fine.

tables vbak.

data it_vbak like vbak occurs 0 with header line.

select

vbeln

ernam

erdat

from vbak

into table it_vbak

where erdat > '19970122'.

loop at it_vbak.

write:/ it_vbak-vbeln,it_vbak-ernam,it_vbak-erdat.

endloop.

Regards

Haritha.

Read only

Former Member
0 Likes
2,179

Hi

May be the other condition which u gave is not getting satisfied. Without giving that condition just give only date condition may be u will get it. As the date format which u gave is correct only.

Regards

Haritha.