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

offset indicator on date

Former Member
0 Likes
2,626

hi

i am using offset indicator on date field, i.e.

select single * from vbak into wvbak where erdat+0(3) = '2000'.

but querry does not fetch data, what could be the solution for this.

thanx in adv

manoj

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,793

Plz change ur code as per below.

Data wvbak1 like wvbak with header line.

select single * from vbak into wvbak.

Loop at wvbak

If wvbak-erdat+0(4) = '2000'.

move wvbak to wvbak1.

append wvbak1.

Clear wvbak1.

Endif.

Endloop.

rgds

rajesh

7 REPLIES 7
Read only

Former Member
0 Likes
1,793

Hi ,

OFFSET won't work in the where clause.

Regards

Prabhu

Read only

Former Member
0 Likes
1,793

select single * from vbak into wvbak where erdat0(3) = '2000'.+

we cannot use offset in query.

first fetch data than compare with offset and delete unwanted data.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,793

select single * from vbak into wvbak 
  WHERE ERDAT <= '20001231'
  or    ERDAT >  '20000101'.

I think you should be using SELECT UP TO 1 ROWS .. ENDSELECT as ERDAT is not key field in the table.

BR,

Suhas

Edited by: Suhas Saha on Aug 7, 2008 1:14 PM

Read only

Former Member
0 Likes
1,793

hi,

select all the data into one internal table and use the following code.

loop at itab into wa.

if wa-date+0(4) eq '2000'.

move-corresponding wa to final_itab.

clear wa.

endif.

endloop.

Regards,

Satish Reddy.

Read only

Former Member
0 Likes
1,794

Plz change ur code as per below.

Data wvbak1 like wvbak with header line.

select single * from vbak into wvbak.

Loop at wvbak

If wvbak-erdat+0(4) = '2000'.

move wvbak to wvbak1.

append wvbak1.

Clear wvbak1.

Endif.

Endloop.

rgds

rajesh

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,793

Hello Satish & Rajesh,

What if we restrict the data fetch @ the time of selection )


  WHERE ERDAT <= '20001231'
  OR    ERDAT >  '20000101'.

I guess this will be more efficient performance-wise.

BR,

Suhas

Read only

Former Member
0 Likes
1,793

hiii

select query will not work with OFFSET...

LOOP AT i_marc INTO wa_marc.
if  wa_marc-date+0(4) = '2000'.
.....
endif.
endloop.

regards

twinkal