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

Selection within a range

Former Member
0 Likes
703

HI Experts,

I want to select from LIPS within a month. However, my code don,t work.

SELECT * FROM LIPS INTO wa_dn WHERE ERDAT > '2005.05.27' .

Plz help.

BR,

King

1 ACCEPTED SOLUTION
Read only

arivazhagan_sivasamy
Active Contributor
0 Likes
666

Hi King Kong,

You can write a code like below..

SELECT * FROM LIPS INTO wa_dn WHERE ERDAT > '20050527' .

Arivazhagan S

5 REPLIES 5
Read only

arivazhagan_sivasamy
Active Contributor
0 Likes
667

Hi King Kong,

You can write a code like below..

SELECT * FROM LIPS INTO wa_dn WHERE ERDAT > '20050527' .

Arivazhagan S

Read only

former_member196157
Active Participant
0 Likes
666

hiii,

If u want to use range then try with select-options

and for ur given query try with following,

SELECT * FROM LIPS INTO wa_dn WHERE ERDAT > '20050527' .

Read only

Former Member
0 Likes
666

hi king,

                     kindly explain more , i am not able to understand whats ur requirement,

           you want RANGE and pass to selection query or anything else?

with regards,

vikas

Read only

Former Member
0 Likes
666

Hi King Kong ,

What is wa_dn, is it a work area? if yes then change it to an internal table.

If you want to select all the records where erdate is greater than the given date in select query then, do it like this..

SELECT * FROM LIPS INTO wa_dn WHERE ERDAT > '20050527' .

But if you want to select record within a month range, better you use select option for that.

SELECT-OPTION: date FOR lips-erdate.

SELECT * FROM LIPS INTO wa_dn WHERE ERDAT IN date.

Read only

Former Member
0 Likes
666

Hi,

The user enters a date.

Use that date in the FM and get the enddate and start date.

Create a structure like below.

Types : BEGIN      OF   ty_select,    "Range Table

           sign       TYPE char01,

           option     TYPE char02,

           low        TYPE char40,

           high       TYPE char40,

           END        OF   ty_select.

Data :  lt_range TYPE STANDARD TABLE OF ty_select,

           lx_range TYPE ty_select.

DATA : v_startdate TYPE sy-datum.

DATA : v_enddate TYPE sy-datum.

DATA : v_temp TYPE dats.

v_temp = sy-datum.

CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'

    EXPORTING

      day_in            = v_temp

    IMPORTING

      last_day_of_month = v_enddate

    

CONCATENATE  v_enddate+0(6)  '01'  INTO  v_startdate.

Now feel the range table created.

lx_range-sign = 'I'

lx_range-option = 'BT'.

lx_range-low = v_enddate.

lx_range-high = v_startdate.

Append lx_range to lt_range.


No use the query.

SELECT * FROM LIPS INTO wa_dn WHERE ERDATIN lt_range.


Hope it works.


Regards