2007 Mar 31 3:33 AM
2007 Mar 31 5:57 AM
Hi,
First Ranges are similar to select-options.
You declare ranges using the ranges keyword.
For ex:
Ranges r_matnr for mara-matnr occurs 0.
Don't forget to declare mara with the TABLES statement. This creates the ranges internal table with a header. Remember that ranges are similar to select-options. So, the ranges internal table has the same structure as select-options. The structure is as follows...
sign option low high
Hope this answers your question.
Regards,
Koushik
2007 Mar 31 5:52 AM
If you declare ranges like select-options, ranges table will be automatically created by system.
2007 Mar 31 5:57 AM
Hi,
First Ranges are similar to select-options.
You declare ranges using the ranges keyword.
For ex:
Ranges r_matnr for mara-matnr occurs 0.
Don't forget to declare mara with the TABLES statement. This creates the ranges internal table with a header. Remember that ranges are similar to select-options. So, the ranges internal table has the same structure as select-options. The structure is as follows...
sign option low high
Hope this answers your question.
Regards,
Koushik
2007 Mar 31 6:32 AM
This is a Sample for Creation range Table..............
Range Table Declaration
DATA : r_ettyp TYPE RANGE OF vbep-ettyp WITH HEADER LINE.
Making The Range Table
r_ettyp-sign = 'I'.
r_ettyp-option = 'EQ'.
r_ettyp-low = 'CP'.
r_ettyp-high = 0.
APPEND r_ettyp.
CLEAR r_ettyp.
r_ettyp-sign = 'I'.
r_ettyp-option = 'EQ'.
r_ettyp-low = 'EP'.
r_ettyp-high = 0.
APPEND r_ettyp.
CLEAR r_ettyp.
Have a nice day..
2007 Mar 31 6:35 AM
Ranges : R_matnr for mara-matnr.
R_matnr-sign = 'I'.
R_matnr-option = 'BT'.
R_matnr-low = '1000000'.
R_matnr-high = ''.
append R_matnr.
clear R_matnr.
2007 Mar 31 6:59 AM
Hi,
Check this code.
- Here the range table is for field "company code".
- After that the range table is filled using macro. Using macro you can omit using same code again and again.
-Then this range table is used in select statement.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
*--- MACRO - Fill Company Code
DEFINE fill_bukrs.
r_bukrs-sign = 'I'.
r_bukrs-low = &1.
r_bukrs-option = 'EQ'.
append r_bukrs.
END-OF-DEFINITION.
TABLES: t001.
DATA: lit_bkpf LIKE STANDARD TABLE OF bkpf.
RANGES: r_bukrs FOR t001-bukrs. "<-- This is how you define range
fill_bukrs '0001'. "<-- range table is filled using MACRO
fill_bukrs '0100'. " which is defined at the top
fill_bukrs '1000'.
fill_bukrs '1001'.
* here DBTAB = database table
* & INTAB = internal table
SELECT *
FROM <DBTAB>
INTO TABLE <INTAB>
WHERE bukrs IN r_bukrs.
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
Let me know if you have any question.
Regards,
RS