‎2006 May 29 5:55 AM
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.
‎2006 May 29 6:12 AM
Hi Kripa,
Cheer up!!
Try out this code. I tried it with dates.
REPORT ZTEST_11 .
select-options s_datum1 for sy-datum.
ranges s_datum2 for sy-datum.
data : value like sy-datum.
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.
enddo.
endif.
endloop.
Its working for me. If its still not working, can you tell me the datatype of your parameter?
Hope that this will be useful..
Thanks,
Susmitha
‎2006 May 29 7:05 AM
hey ..... Susmitha Thomas
no iam not getting it ...
still ENDLESS LOOP ;-(
any more inputs ??
‎2006 May 29 7:16 AM
‎2006 May 29 7:24 AM
how is I_SETLEAF-VALFROM declared and what sort of values does it have?
and is the infinite loop happening in the 'while' or the 'loop'?
‎2006 May 29 7:33 AM
HI,
The datatyp of the parameter L_LOW_SETLEAF is SETLEAF-VALFROM (i.e) CHAR24 .....
The Endless Loop is inbetween WHILE .. ENDWHILE
Cheers,
R.Kripa
‎2006 May 29 7:37 AM
can you give us the values it's looping on? i.e what's the low and high values it's trying to use?
‎2006 May 29 7:49 AM
yeah my values are
SIGN OPTION LOW HIGH
I EQ 950000 950000
I EQ 551046 551046
I EQ 551500 551500
I EQ 551400 551400
I EQ 551071 551071
I EQ 551040 551040
I EQ 551086 551086
I BT 551000 551030
I EQ 551045 551045
????????
‎2006 May 29 7:53 AM
I think after adding it it right justifies the result. So your compare will never exit the while. If your data will always be numeric you can work in num or int and then move that left-justified to the char field.
or you can left justify by removing leading zeros,
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.
shift L_LOW_SETLEAF left deleting leading ' '.
APPEND R_SETLEAF.
CLEAR R_SETLEAF.
ENDWHILE.
‎2006 May 29 8:08 AM
HI Kripa,
I guess I got your problem.
This code will hopefull solve your problem.
types char24(24) type c.
data : char24 type char24.
select-options s_datum1 for char24.
ranges s_datum2 for char24.
data : value type char24,
val(24) type n.
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.
val = value.
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.
val = val + 1.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = val
IMPORTING
OUTPUT = value
.
enddo.
endif.
endloop.
Thanks,
Susmitha