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

RANGES STATEMENT

Former Member
0 Likes
1,199

HI ABAPERS,

I am using RANGES statement and i am selecting the range of dates in it.

using this range i want to pass one by one date to function module how can i do.

<b>BELOW IS THE CODE WHAT I AM DOING</b>

I WANT TO PASS ALL THE DATES TO THIS FN MODULE

data : begin of wr_date occurs 0, " ranges accepts in format YYYY MM DD

sign(1),

option(2),

low type char8,

high type char8,

end of wr_Date.

wr_date-sign = 'I'.

wr_date-option = 'BT'.

wr_date-low = w_low. " HERE IAM PASSING INITIAL DATE

wr_date-high = w_high. " HERE IAM PASSING LAST DATE

APPEND wr_date.

loop at WR_DATE where option = 'BT' AND SIGN = 'I'.

CALL FUNCTION 'CONVERSION_EXIT_INVDT_INPUT'

EXPORTING

input = " HERE I WANT TO PASS ONE BY ONE DATE"

IMPORTING

OUTPUT = " APPENDING SOME INTERNAL TABLE"

endloop.

pLEASE HELP

AHMED

6 REPLIES 6
Read only

Former Member
0 Likes
752

u have to define ranges like this

ranges : r_budat for bkpf-budat.

then no need to put a logic.

Regards

prabhu

Read only

Former Member
0 Likes
752

if it is same as tht of ur previos query then just copy my code and it work as to read data from tcurr ,u need to do any conversion.if it something else then simply do as follows -

loop at WR_DATE where option = 'BT' AND SIGN = 'I'.

CALL FUNCTION 'CONVERSION_EXIT_INVDT_INPUT'

EXPORTING

input = wr_date-low

IMPORTING

OUTPUT = wr_date-low.

CALL FUNCTION 'CONVERSION_EXIT_INVDT_INPUT'

EXPORTING

input = wr_date-high

IMPORTING

OUTPUT = wr_date-high.

modify wr_date index sy-tabix.

endloop.

Message was edited by:

Amit Tyagi

Read only

0 Likes
752

how will i select all the dates and convert all the dates and for all the dates converted to inverted fom.

Read only

0 Likes
752

just check ur internal table wr_date it is having all the converted dates now..

now u can have select query on the databse table based on these dates to fetch data.

amit

Read only

Former Member
0 Likes
752

Hi Ahmed ,

Here is a sample code which must be able to help

wr_date-sign = 'I'.
wr_date-option = 'BT'.
wr_date-low = w_low. " HERE IAM PASSING INITIAL DATE
wr_date-high = w_high. " HERE IAM PASSING LAST DATE
APPEND wr_date.

*loop at WR_DATE where option = 'BT' AND SIGN = 'I'. "Commenetd
LOOP AT WR_DATE .
IF NOT WR_DATE-LOW IS INITIAL. 
CALL FUNCTION 'CONVERSION_EXIT_INVDT_INPUT'
EXPORTING
input = WR_DATE-LOW 
IMPORTING
OUTPUT = WA_FTABLE-DATE.
APPEND WA_FTABLE.  " append to your internal table
ENDIF. 
F NOT WR_DATE-high IS INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_INVDT_INPUT'
EXPORTING
input = WR_DATE-HIGH 
IMPORTING
OUTPUT = WA_FTABLE-DATE.
APPEND WA_FTABLE.
ENDIF. 
endloop.

Do revert back in case you have more queries.

Regards

Arun

Read only

Former Member
0 Likes
752

Hi Ahmed,

RANGES r_budat for bkpf-budat.

r_budat-sign = 'I'.

r_budat-option = 'BT'.

r_budat-low = lowdate.

r_budat-high = highdate.

APPEND r_budat.

loop at r_budat where option = 'BT' AND SIGN = 'I'.

CALL FUNCTION 'CONVERSION_EXIT_INVDT_INPUT'

EXPORTING

input = " pass date here like r_budat.

IMPORTING

OUTPUT = " APPENDING SOME INTERNAL TABLE"

endloop.

Regards,

Sunil