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: 

Summarizing Range Values

Former Member
0 Kudos

Hi Guys,

Assume i have an internal table with range values on Personnel Area authorizations.

DATA: LI_RANGE LIKE rsrange OCCURS 0 WITH HEADER LINE.

Values are:

SIGN	OPTION	LOW	HIGH
I	EQ	CA01	
I	EQ	CA04
I	BT	CA05	CA10

What I am trying to achieve is reduce the number of lines, to something like:

SIGN	OPTION	LOW	HIGH
I	EQ	CA01
I	BT	CA04	CA10

There may be a few ways to do this, one way I thought was to first get all the individual values from the above range table, something like


DATA: li_persa TYPE TABLE OF WERKS.
SELECT PERSA FROM T500P APPENDING li_persa WHERE PERSA IN LI_RANGE
- this may not be syntactically correct but you get the idea

Now I have the list of individual Personnel Areas, I need to find sort them and find which ones can be included in a range (BT), and which ones need to be individual values (EQ).

SORT li_persa.
LOOP AT li_persa.
   "Here I need to find out if one personel area is adjaecnt to another,
   "For example, if CA04 is next to CA05, these 2 can be contained in a range
ENDLOOP.

What I'm not sure about is how to compare 2 char values, like CA04 and CA05, to see if they adjacent to each other. I tried adding 1 to CA04 to see if it equalled CA05 but got a short dump. Thought of using another data type....

Any ideas?

Regards,

Kevin

1 REPLY 1

Former Member
0 Kudos

Hi,

If you are use that the field length is four...and the last two will always be numeric..Then you can extract the last two digits and increment them..

data: v_num(2) type n.

  • move the last two digits.

v_num = lt_range-low+(2).

  • increment the value.

v_num = v_num + 1.

  • assign back the value..

lt_range-low+(2) = v_num.

Thanks

Naren