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: 

Ranges statement

Former Member
0 Kudos

Hi,

I have some values for a particualr filed

for example Field is Personal Area (WERKS).

personal area key field is emp number.

Werks has values like V1, V2, V3 V4....to V10.

I need to read set of Emp Num related to Werks with V2, V3, V4.

Can any one suggest how to use ranges for this.

Thanks

10 REPLIES 10

Former Member
0 Kudos

Hi

I don't know if I understand your issue, anyway:

RANGES R_WERKS FOR <table>-WERKS.

R_WERKS(3) = 'IEQ'.
R_WERKS-LOW = 'V2'.
APPEND R_WERKS.

R_WERKS-LOW = 'V3'.
APPEND R_WERKS.

R_WERKS-LOW = 'V4'.
APPEND R_WERKS.

Now u can use this range to select the data u need, u have to use the range just like a select-option

Max

Former Member
0 Kudos

Did you see the F1 help on the statement RANGE ? This will help you in defining Range and how to use it.

Remember ranges are nothing but same as select options , except that they dont have a user interface where the values can be provided. The values should be populated programitically.

BR,

Advait

former_member404244
Active Contributor
0 Kudos

Hi,

Try like this

Ranges : r_werks for marc-werks.

r_werks-sign = 'I'.

r_werks-option = 'EQ'.

r_werks-low = 'V2'.

append r_werks.

r_werks-sign = 'I'.

r_werks-option = 'EQ'.

r_werks-low = 'V3'.

append r_werks.

r_werks-sign = 'I'.

r_werks-option = 'EQ'.

r_werks-low = 'V4'.

append r_werks.

Now u can use the Ranges (r_werks).

Regards,

Nagaraj

sreeramkumar_madisetty
Active Contributor
0 Kudos

Hi

DATA: IT_WERKS TYPE STANDARD TABLE OF PS0001.

SELECT PERNR

FROM PA0001

INTO IT_PA0001

WHERE WERKS = S_WERSKS.

IF SY-SUBRC EQ 0.

ENDIF.

HERE S_WERKS WILL CONTAINS V1, V2, V3 V4....to V10.

Regards,

Sreeram

venkat_o
Active Contributor
0 Kudos

If you are working on HR programming with LDB PNP. You need to check like below. I believe that you give personal area on selection-screen.

TABLES PERNR.
INFOTYPES 0000.
START-OF-SELECTION.
GET PERNR.
  IF PERNR IN PNPWERKS.
    "Continue coding to read data
  ELSE.
    REJECT.
  ENDIF.
Thanks Venkat.O

Former Member
0 Kudos

Hi,

Ranges statement is no longer used.

press F1 on the ranges statement it wil give the syntax to be used intead of ranges.

ITs just like declaring an internal table.

populate the work area with all the values and append it to the internal table.

Former Member
0 Kudos

closed

Former Member
0 Kudos

Hi Rakhnil,

For using ranges the statement is now obsolete in ECC 6.0.

You have to declare an internal table and work area in the following manner:

DATA: It_range TYPE RANGE OF werks.

It has to be populated in the same manner as indicated in the above replies.

Regards,

Anand.

Former Member
0 Kudos

Hi,

RANGES: r_werks FOR marc-werks.

r_werks-sign = 'I'. u201CIncluding

r_werks-option = 'EQ'.

r_werks-low = 'V2'.

APPEND r_werks.

Clear r_werks.

r_werks-sign = 'I'. u201CIncluding

r_werks-option = 'EQ'.

r_werks-low = 'V3'.

APPEND r_werks.

Clear r_werks.

r_werks-sign = 'I'. u201CIncluding

r_werks-option = 'EQ'.

r_werks-low = 'V4'.

APPEND r_werks.

Clear r_werks.

Thanks,

Krishna

Former Member
0 Kudos

Thanks a lot