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: 

Facing problems while Adding a Character & a Integer

Former Member
0 Kudos

Hi friends,

I have a problem when additing a Character and a interger

My requirement:

I have to build a range ..... with only option = 'EQ'

So if iam encoutering any 'BT' iam changing it to 'EQ'

The following is my code and the problem ;-(

*********************************

LOOP AT I_SETLEAF.

CLEAR L_LOW_SETLEAF.

R_SETLEAF-SIGN = I_SETLEAF-VALSIGN.

R_SETLEAF-OPTION = I_SETLEAF-VALOPTION.

IF R_SETLEAF-OPTION EQ 'BT'.

L_LOW_SETLEAF = I_SETLEAF-VALFROM.

WHILE L_LOW_SETLEAF LE I_SETLEAF-VALTO.

R_SETLEAF-SIGN = I_SETLEAF-VALSIGN.

R_SETLEAF-OPTION = 'EQ'.

R_SETLEAF-LOW = L_LOW_SETLEAF .

R_SETLEAF-HIGH = L_LOW_SETLEAF.

L_LOW_SETLEAF = L_LOW_SETLEAF + '1'. ---> 1

L_LOW_SETLEAF = L_LOW_SETLEAF + '1'. ---> 2

APPEND R_SETLEAF.

CLEAR R_SETLEAF.

ENDWHILE.

ELSE.

R_SETLEAF-LOW = I_SETLEAF-VALFROM.

R_SETLEAF-HIGH = I_SETLEAF-VALTO.

APPEND R_SETLEAF.

CLEAR R_SETLEAF.

ENDIF.

ENDLOOP.

My L_LOW_SETLEAF is LIKE I_SETLEAF-VALFROM.

**************************************

I ve tried with both ...... 1 & 2 but still the loop goes to endless loop ;-(

EXPECTING ur replies .....

Thanks in Advance

Cheers,

R.Kripa.

3 REPLIES 3

franois_henrotte
Active Contributor
0 Kudos

The only way to do it right is to use a SELECT statement on table concerned by your range and get list of items.

Then you put those items in your own range with EQ.

If you don't do that, you will potentially fill your range with values not existing in the database and this is not efficient.

former_member184569
Active Contributor
0 Kudos

Hi Kripa,

Did you try the last code that I had sent in your previous post? Did not that work?

YOu can also try this.

select-options s_datum1 for char24.

ranges s_datum2 for char24.

data : value type char24.

loop at s_datum1.

if s_datum1-option = 'EQ'.

s_datum2 = s_datum1.

append s_datum2.

elseif s_datum1-option = 'BT'.

value = s_datum1-low.

do.

s_datum2-sign = s_datum1-sign.

s_datum2-option = 'EQ'.

s_datum2-low = value.

append s_datum2.

if value = s_datum1-high.

exit.

endif.

value = value + 1.

condense value.

enddo.

endif.

endloop.

Please do reply if it works for you?

Thanks,

Susmitha

former_member184569
Active Contributor
0 Kudos

Try

CONDENSE L_LOW_SETLEAF.

after

L_LOW_SETLEAF = L_LOW_SETLEAF + 1.

Regards,

Susmitha