Skip to Content
author's profile photo Former Member
Former Member

Range table to list of selections

Hi,

I would like to know is there any FM, which can accept the range table as input parameter and return me list of individual selected values as output?

For example if i pass the range table as

SIGN OPTION LOW HIGH

I BT 2 5

E EQ 3

The output should be

2

4

5

Thanks.

Rajee

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 12, 2008 at 05:17 AM

    Hello

    I use this:

    ranges: r_matnr for mara-matnr.
    data: begin of itab occurs 0,
          value like mara-matnr,
          end of itab.
    data: begin of etab occurs 0,
          value like mara-matnr,
          end of etab.
    *****
    * there fill ranges
    *****
    loop at r_matnr.
      case r_matnr-sign.
        when 'I'.
          case r_matnr-option.
            when 'EQ'.
              itab-value = r_matnr-low. append itab.
            when 'BT'.
              while r_matnr-low <> r_matnr-high.
                itab-value = r_matnr-low. append itab.
                r_matnr-low = r_matnr-low + 1.
              endwhile.
              itab-value = r_matnr-high. append itab.
          endcase.
        when 'E'.
          case r_matnr-option.
            when 'EQ'.
             etab-value = r_matnr-low. append etab.
            when 'BT'.
              while r_matnr-low <> r_matnr-high.
                etab-value = r_matnr-low. append etab.
                r_matnr-low = r_matnr-low + 1.
              endwhile.
              etab-value = r_matnr-high. append etab.
          endcase.
      endcase.
    endloop.
    
    delete adjacent duplicates from itab.
    delete adjacent duplicates from etab.
    sort: itab, etab.
    loop at etab.
      read table itab with key value = etab-value binary search.
      if sy-subrc = 0.
        delete itab.
      endif.
    endloop.
    
    loop at itab.
      write: itab-value. new-line.
    endloop.
    

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.