Application Development 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: 

Select Query

Former Member
0 Kudos

I want to write a select query for getting data into an internal table. This query is based on a condition. The data from the zcycle_details custom table has two fields event_date and cycle_act_date. The data should be selected such that the event_date field value containing date shoudld be greater than cycle_act_date.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

write the select queary like this..

select *

from zcycle_details as a

into table i_cycle_details

where aevent_date gt acycle_act_date.

Thanks,

Rajinikanth

6 REPLIES 6

Former Member
0 Kudos

hi

do like this

if zcycle_details-event_date > zcycle_details-cycle_act_date

select x

y

z

into table XYZ

from zcycle_details

where

date1 = event_date

and

date2 = cycle_act_date

endif.

Cheers

Snehi

Edited by: snehi chouhan on Jul 15, 2008 9:32 AM

Former Member
0 Kudos

Hi,

u can use

select event_date cycle_act_date from zcycle_details where event_date > cycle_act_date.

Hope it helps.

Anju

Former Member
0 Kudos

Hi

If your z-table hasn't a very large number of hits u can write:

SELECT * FROM ZCYCLE_DETAILS INTO T_ZCYCLE_DETAILS.
  IF T_ZCYCLE_DETAILS-EVENT_DATE > T_ZCYCLE_DETAILS-CYCLE_ACT_DATE.
    APPEND  T_ZCYCLE_DETAILS.
  ENDIF.
ENDSELECT.

Max

Former Member
0 Kudos

hi yogesh,

data: DATA: i_zcycle_details LIKE STANDARD TABLE OF zcycle_details .

select event_date

cycle_act_date

from zcycle_details

into i_zcycle_details .

loop at i_zcycle_details into wa_zcycle_details

if wa_zcycle_details - event_date > wa_zcycle_details - cycle_act_date.

write : wa_zcycle_details .

else.

exit.

endif.

endloop.

regards,

sandeep

Former Member
0 Kudos

HI,

You can get all the details into table it_itab and delete the unwanted ones through the following code.

loop at it_itab where cycle_act_date GT event_date.
delete it_itab.
endloop.

OR

delete it_itab where  cycle_act_date GT event_date.

Thanks,

Shailaja

Former Member
0 Kudos

Hi,

write the select queary like this..

select *

from zcycle_details as a

into table i_cycle_details

where aevent_date gt acycle_act_date.

Thanks,

Rajinikanth