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: 

Range declaration

Former Member
0 Kudos
33,824

Hi i have to declare the vendor number,idoc date and invoice date in a range how should i do?as of now i have declared in select-options.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
771

Hi,

Ranges: s_itab1 for vendor number,

S_itab2 for idoc date,

S_itab3 for invoice date.

s_itab1-sign = 'I'.

s_itab1-options = 'EQ'.

s_itab1-low = '00000000000000106'.

s_itab1 -high = '00000000000000109'.

append s_itab1.

s_itab2-sign = 'I'.

s_itab2-options = 'EQ'.

s_itab2-low = date.

s_itab2 -high = date.

append s_itab2.

S_itab3-sign = 'I'.

s_itab3-options = 'EQ'.

s_itab3-low = date.

s_itab3 -high = date.

append s_itab3.

9 REPLIES 9

UmaArjunan
Active Participant
0 Kudos
771

Former Member
0 Kudos
772

Hi,

Ranges: s_itab1 for vendor number,

S_itab2 for idoc date,

S_itab3 for invoice date.

s_itab1-sign = 'I'.

s_itab1-options = 'EQ'.

s_itab1-low = '00000000000000106'.

s_itab1 -high = '00000000000000109'.

append s_itab1.

s_itab2-sign = 'I'.

s_itab2-options = 'EQ'.

s_itab2-low = date.

s_itab2 -high = date.

append s_itab2.

S_itab3-sign = 'I'.

s_itab3-options = 'EQ'.

s_itab3-low = date.

s_itab3 -high = date.

append s_itab3.

0 Kudos
771

Hi what values should i declare in the high n low values

0 Kudos
771

Hi its showing an error to declare as an internal table.

771

Hi,

Try using the structure SELOPT as RANGES statement is obsolete.

Eg:

DATA:

*"     Table for Valuation area

        i_bwkey               TYPE STANDARD TABLE OF selopt ,

*"     Valuation area

        e_bwkey                  TYPE selopt  .

e_bwkey-sign      = 'I'.

e_bwkey-option   = 'BT'.

e_bwkey-low       =  '100'.

e_bwkey-low       =  '200'. 

APPEND e_bwkey TO i_bwkey.

Former Member
0 Kudos
771

Hi,

find the below example.

RANGES :  r_rr FOR p0000-massg.
*      (or)
data :r_rr1 type range of p0000-massg INITIAL SIZE 0,
        w_rr1  LIKE LINE OF r_rr1. 
INITIALIZATION.
  
* Ranges table for matching the Reasons for Resign
  r_rr-option  = 'EQ'.
  r_rr-sign    = 'I'.
  r_rr-low     = '01'.          " Cessation of Contract
  APPEND r_rr.

  r_rr-option  = 'EQ'.
  r_rr-sign    = 'I'.
  r_rr-low     = '05'.          " Medical Boarded out
  APPEND r_rr.
  
* Ranges table for matching the Reasons for Resign
  w_rr1-option  = 'EQ'.
  w_rr1-sign    = 'I'.
  w_rr1-low     = '01'.          " Cessation of Contract
  APPEND w_rr1 to r_rr1.

  w_rr1-option  = 'EQ'.
  w_rr1-sign    = 'I'.
  w_rr1-low     = '05'.          " Medical Boarded out
  APPEND w_rr1 to r_rr1.
.

Regards,

Sreenivasa Sarma K.

UmaArjunan
Active Participant
0 Kudos
771

Eg. to RANGES:

-


REPORT YARRANGE.

TABLES YTXLFA1.

RANGES: VENDOR FOR YTXFLA1-LIFNR.

- - - -

- - - --

- - - -

SELECT LIFNR LAND1 NAME1 FROM LFA1 INTO TABLE ITAB

WHERE LIFNR IN VENDOR.

Here with RANGES user has to design an internal table with fields -

SIGN,OPTION,LOW and HIGH EXPLICITLY.

Example:

select-options: bukrs for zstock-bukrs.

Should the user fill in 'ABFI' in BUKRS on the selection screen, BUKRS will look like this:

IEQABFI

This is because BUKRS is set as a table as follows:

begin of bukrs occurs 0,

SIGN(1) type c,

OPTION(2) type c,

LOW like bukrs,

HIGH like bukrs,

end of bukrs.

Now, when you create the following range, it will have the exact same fields set inside its table:

Ranges: bukrs for zstock-bukrs.

The difference is, because ranges doesn't show on the selection screen, you will have to fill it yourself, meaning you will have to fill bukrs-sign, bukrs-option, bukrs-low & bukrs-high all manually.

Some tips:

Sign is always I (for Include) or E (for Exclude)

Option can be a whole range, which includes:

EQ (Equal)

BT (Between))

CP (Contain Pattern)

So let's say you want to have the range check for all company codes not starting with AB, you will set your code as follow:

ranges: bukrs for zstock-bukrs.

bukrs-sign = 'E'. "Exclude

bukrs-option = 'CP'. "Pattern

bukrs-low = 'AB*'. "Low Value

bukrs-high = ''. "High Value

append bukrs.

Always remember to APPEND your range when you fill it, as the WHERE clause checks against the lines of the range table, not against the header line.

Hope this explains it well enough.

0 Kudos
771

Hi,

This Logic may be helpful for you.

* DATA DECLARATION

RANGES : r_itab_1 for comm_product-product_id .

  Data : wa_retreq like line of lt_retreq ,

         lt_retreq_1 like lt_retreq ,

         wa_retreq_1 like line of lt_retreq .

  loop at lt_retreq into wa_retreq .                                         * LT_RETREQ HOLDS THE VEHICLE ID

        shift wa_retreq-vehicle_id left deleting leading '0' .

         r_itab_1-sign = 'I' .

         r_itab_1-option = 'EQ'.

         r_itab_1-low = wa_retreq-VEHICLE_ID .

         APPEND r_itab_1 .

  endloop .

*-- Get Vehicle Guid

  IF r_itab_1 IS NOT INITIAL.

Select product_guid

          product_id

            from comm_product

                     into table lt_commpr

                     where product_id in r_itab_1 .

Regards ,

Joyjit B

Former Member
0 Kudos
771

do not use RANGES: as it is obsolete. Use DATA: lr_test type range of blabla.