导航

Range table

Posted on 2010-07-21 14:20  Hahappyppy  阅读(569)  评论(0编辑  收藏  举报

通过SE11建立range table type

 

在函数传递range table时可以通过ype group来定来range table type

Defining Range Type in ABAP

Range is internal table of structure which has four component in it namely SIGN, OPTION, LOW and HIGH. The data type of LOW and HIGH is specified while creating the range.
For example, if you want to define a range of type MARA-MATNR then statement would be.

DATA : r_matnr TYPE RANGE OF mara-matnr .

To insert data in range table you will need compatible work area which can be defined using TYPE LINE OF clause.

DATA : ty_matnr TYPE LINE OF r_matnr.

You can use range to specify complex criteria in many statements in ABAP .i.e. IF, LOOP, CHECK, SELECT etc.
Range type can be defined centrally in data dictionary which can be very useful in case of passing values between program and function module or smartform.

Step 1 : Go to transaction SE11 and enter name of range in Data type input and hit create.
clip_image001
Step 2 : Select ‘Table Type’
clip_image002
Step 3 : Enter short text and select menu Edit->Define as range table type.
clip_image003
Step 4: Specify ‘Data Element’ as MATNR and enter name in ‘Structured Row Type’ then Save. After saving hit ‘Create’ button.
clip_image004
Step 5: Work are will be created automatically with data element MATNR. Enter short text, save and activate.
clip_image005