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

function module

Former Member
0 Likes
372

Hi,

I have an internal table lfa1

which has fields lifnr

name1

land1 and

created_date

in the function module

in the table parametrs

date like zdata

zdata has two fields

1. from(8) type c,

2. to(8) type c.

select lifnr name1 land1 created_date from lfa1

into table i_lfa1

where created_date = R

HERE IN THE R I HAVE TO PASS THE RANGE OF DATE BETWEEN FROM AND TO WHICH ARE IN THE TABLE PARAMETERS.

that from and to range date will be given by the enduser.

note: dont say that created _date is not in the lfa1 table here I just used for explanation purpose.

4 REPLIES 4
Read only

Former Member
0 Likes
342

Hi!

You can use a RANGE for that:


DATA: lt_date TYPE RANGE OF <data element>,
          ls_date LIKE LINE OF lt_date.

ls_date-sign = 'I'.
ls_date-option = 'BT'.
ls_date-low = <first_date>
ls_date-high = <second_date>.
append ls_date to lt_date.

SELECT * FROM <tab> WHERE dat IN lt_date.

So you have the SELECT that you want to have.

Reward if useful

Greets

Edited by: JetGum on Feb 5, 2008 8:53 AM

Read only

Former Member
0 Likes
342

hI

POPULATE UR RANGE LIKE THIS

RANGES RA_DATE TYPE SY-DATUM .

loop AT ZDATA .

ra_DATE = 'I'.

ra_DATE-option = 'EQ'.

ra_DATE-low = so_ekgrp-low.

APPEND ra_DATE.

CLEAR: ra_DATE.

ENDLOOP .

SELECT < FIELDS FOR SELECTION > INTO TABLE l_t_ekgrp

FROM < DB RTABLE >

WHERE CREATE_DATE in ra_DATE.

hOPE IT HELPS.

pRAVEEN

Read only

Former Member
0 Likes
342

This can be possible through ranges.

Ranges: r_date for vbak-erdat.

CLEAR R_date.

REFRESH R_date.

R_date-SIGN = 'I'.

R_date-OPTION = 'EQ'.

R_date-LOW = 'date low value'

R_date-HIGH = 'date high value'.

APPEND R_date.

Select f1 f2 from lfa1 into table i_lfa1 where date in r_date.

Regards,

Kumar.

Read only

Vijay
Active Contributor
0 Likes
342

hi

u can use between keyword as well to solve your problem.

example

SELECT carrid connid fldate

FROM sflight

INTO CORRESPONDING FIELDS OF TABLE sflight_tab

WHERE fldate BETWEEN sy-datum AND date.

regards

vijay

reward points if helpful