Sap abap programming Ranges usage

Source: Internet
Author: User
Tags ranges

In SAP, the structure of a single value is sometimes changed to a range structure, which is similar to the SELECTION-OPTION function. SAP provides RANGES to implement this function.

(SELECTION-OPTION is a very powerful function in SAP. It is also often required to be similar to the SELECTION-OPTION function in the program. If no screen is painted, SAP provides the RANGE function)

Example:

DATA: table_t like table of spfli,
Table_wa LIKE spfli.
RANGES: g_ranges FOR spfli-carrid.

* "Single value
* CLEAR G_ranges [].
* G_ranges-sign = 'I '.
* G_ranges-option = 'EQ '.
* G_ranges-low = 'a '.
* APPEND G_ranges.

"Interval
CLEAR g_ranges [].
G_ranges-sign = 'I '.
G_ranges-option = 'BT '.
G_ranges-low = 'a '.
G_ranges-high = 'hh '.
APPEND g_ranges.

SELECT * FROM spfli into table table_t WHERE carrid IN g_ranges.
Loop at table_t INTO table_wa.
WRITE:/table_wa-carrid, table_wa-connid, table_wa-cityto.
ENDLOOP.


G_ranges is equivalent to the type defined by SELECTION-OPTION.
* Options:
* 1. SIGN The values are I and E.I is include,E is exclusion,I is generally used.
* 2. OPTIONIf HIGHIt is null and is selected as a single value.YesLogical operations such as EQ, NE, GT, LE, and LTFor *'sCP inclusionNP is excluded
*                  If HIGHNot emptySelect rangeAvailable for BT and NB
* 3.LOW    Low value
* 4. HIGH   High value


Sap abap programming Ranges usage

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.