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

TVARV table entries

Former Member
0 Likes
781

Hello folks,

I am just wondering how to code a select statement on a tvarv table with ranges.

To be clear, I had created a variable with name ZTEST and then I clicked on the YELLOW arrow on the right and entered 10 numbers from 1 to 10.

Now I have a report with a selection screen field 'p_num' and in that report I am coding the SELECT statement on tvarv in the following way.

select single *

from tvarv

into ls_tvarv

where name eq 'ZTEST'

and low eq p_num.

Is this correct. p_num can have values anywhere between 1 and 10.

Will the above code work if p_num is 1 or 2 or 3 up to 10??

Please let me know.

Thanks,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
528

Hi

Your record in TVAR it should be:

TVAR-NAME = 'ZTEST'.

TVAR-TYPE =

TVAR-NUMB =

TVAR-SIGN =

TVAR-OPTI =

TVAR-LOW = 1

TVAR-HIGH = 10.

In your code:

DATA: MIN TYPE I, MAX TYPE I.

SELECT * FROM TVARV WHERE NAME = 'ZTEST'.

MOVE: TVARV-LOW TO MIN,

TVARV-HIGH TI MAX.

EXIT.

ENDSELECT.

IF P_NUM < MIN OR P_NUM > MAX.

ERROR.

ENDIF.

Max

Hello folks,

I am just wondering how to code a select statement on a tvarv table with ranges.

To be clear, I had created a variable with name ZTEST and then I clicked on the YELLOW arrow on the right and entered 10 numbers from 1 to 10.

Now I have a report with a selection screen field 'p_num' and in that report I am coding the SELECT statement on tvarv in the following way.

select single *

from tvarv

into ls_tvarv

where name eq 'ZTEST'

and low eq p_num.

Is this correct. p_num can have values anywhere between 1 and 10.

Will the above code work if p_num is 1 or 2 or 3 up to 10??

Please let me know.

Thanks,

1 REPLY 1
Read only

Former Member
0 Likes
529

Hi

Your record in TVAR it should be:

TVAR-NAME = 'ZTEST'.

TVAR-TYPE =

TVAR-NUMB =

TVAR-SIGN =

TVAR-OPTI =

TVAR-LOW = 1

TVAR-HIGH = 10.

In your code:

DATA: MIN TYPE I, MAX TYPE I.

SELECT * FROM TVARV WHERE NAME = 'ZTEST'.

MOVE: TVARV-LOW TO MIN,

TVARV-HIGH TI MAX.

EXIT.

ENDSELECT.

IF P_NUM < MIN OR P_NUM > MAX.

ERROR.

ENDIF.

Max