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: 

regading Usig rang values in Parameters

Former Member
0 Kudos

Hi all,

I am working on ranges.

And i want to use values of these ranges in Parameters. i.e Range-low should come by default in P_FROM and Range-high shold come by defalut on P_TO

so frnds can anyone help me how to get it.

Below i m providing my code.

<code>

REPORT ZDEMO_FOR_RANGES_1.

ranges : date1 for sy-datum,

date2 for sy-datum,

date3 for sy-datum.

date1-sign = 'I'.

date1-option = 'BT'.

date1-low = sy-datum + 1. "tommorrows date

date1-high = sy-datum + 60. "60 days later.

APPEND date1.

date2-sign = 'I'.

date2-option = 'BT'.

date2-low = date1-low + 61. "61days after of tomorrow

CALL FUNCTION 'MONTH_PLUS_DETERMINE'

EXPORTING

months = '6'

olddate = date2-low

IMPORTING

NEWDATE = date2-high.

APPEND date2.

read table date1 index 1.

*append lines of date1 to p_from index 1.

parameters : p_from like sy-datum ,

p_to like sy-datum,

p_from_1 like sy-datum,

p_to_1 like sy-datum.

</code>

I have tried in many ways but i m not getting any help frnds.

regards,

satish

3 REPLIES 3

Former Member
0 Kudos

Hi Sathish..

You can try like this..

parameters : p_from like sy-datum default date2-low ,

p_to like sy-datum default date1-high,

p_from_1 like sy-datum,

p_to_1 like sy-datum.

I think this is what u want..

Regards

Sandeep.

Former Member
0 Kudos

Hi Satish,

If you want to read a range, you need to READ TABLE <range> INDEX x for the range, hence if you need values from date1 and date2, perform READ TABLE on both ranges to get the low and high values in the range header.

Also, to default the values you can code within the AT SELECTION-SCREEN OUTPUT event like this:

INITIALIZATION.

date1-sign = 'I'.

date1-option = 'BT'.

date1-low = sy-datum + 1. "tommorrows date

date1-high = sy-datum + 60. "60 days later.

APPEND date1.

date2-sign = 'I'.

date2-option = 'BT'.

date2-low = date1-low + 61. "61days after of tomorrow

CALL FUNCTION 'MONTH_PLUS_DETERMINE'

EXPORTING

months = '6'

olddate = date2-low

IMPORTING

NEWDATE = date2-high.

APPEND date2.

read table date1 index 1.

AT SELECTION-SCREEN OUTPUT.

IF p_from IS INITIAL.

MOVE date1-low TO p_from.

ENDIF.

IF p_to IS INITIAL.

MOVE date1-high TO p_to.

ENDIF.

--- the IF condition is to ensure that the user's entered value in p_from/p_to is not again overwritten by the default.

Regards,

Aditya

Former Member
0 Kudos

>

> Hi all,

> I am working on ranges.

>

> And i want to use values of these ranges in Parameters. i.e Range-low should come by default in P_FROM and Range-high shold come by defalut on P_TO

> so frnds can anyone help me how to get it.

>

> Below i m providing my code.

>

>

> <code>

>

> REPORT ZDEMO_FOR_RANGES_1.


PARAMETERS : p_from TYPE sy-datum,
                         p_to TYPE sy-datum.

>

> ranges : date1 for sy-datum,

> date2 for sy-datum,

> date3 for sy-datum.

>

> date1-sign = 'I'.

> date1-option = 'BT'.

> date1-low = sy-datum + 1. "tommorrows date

> date1-high = sy-datum + 60. "60 days later.

>

> APPEND date1.

>

>

> date2-sign = 'I'.

> date2-option = 'BT'.

> date2-low = date1-low + 61. "61days after of tomorrow

>

> CALL FUNCTION 'MONTH_PLUS_DETERMINE'

> EXPORTING

> months = '6'

> olddate = date2-low

> IMPORTING

> NEWDATE = date2-high.

>

> APPEND date2.


p_from = range-low. " I'm not sure which range low you are going to assign
p_to = range-high.

> </code>

>

> I have tried in many ways but i m not getting any help frnds.

>

> regards,

> satish