2007 Apr 24 11:00 AM
Dear All,
Please I need your help. This is quite confusing. My condition is quite simple, but I just don't know why it still gets through even though it did not satisfy the parameters. Below is the sample condition.
IF p0001-btrtl = '1000' OR p0001-btrtl BETWEEN '2000' AND '2999'.
IF p0001-kostl in p_rccode.
MOVE p0001-kostl TO stab-kostl.
move: 1 to ok1.
ENDIF.
ELSEIF p0001-btrtl in p_btrtl.
move: 1 to ok1.
concatenate '0000000' p0001-btrtl into stab-kostl.
condense stab-kostl.
ENDIF.
The problem here is that p0001-btrtl's value is '210', but still the program gets through the 1st condition. Please, can anyone explain why this is happening. Hope you could help me with my dilemma. Thank you so much.
2007 Apr 24 11:04 AM
HI Anna,
In alphabetic sequence 210 falls in between 2000 ans 3000.
You can use a numeric field to get the required result.
<b>data: v_numc(4) type n.
v_numc = p0001-btrtl.</b>
IF p0001-btrtl = '1000' OR <b>v_numc</b> BETWEEN '2000' AND '2999'.
IF p0001-kostl in p_rccode.
MOVE p0001-kostl TO stab-kostl.
move: 1 to ok1.
ENDIF.
ELSEIF p0001-btrtl in p_btrtl.
move: 1 to ok1.
concatenate '0000000' p0001-btrtl into stab-kostl.
condense stab-kostl.
ENDIF.
Regards,
ravi
P.S: check this sample program to demonstrate the same
data: v_char(4) type n value '210'.
if v_char between '2000' and '3000'.
Write:/ 'Lies'.
else.
write:/ 'Doesnt fall'.
endif.
output: 'Doesnt fall'
Dear All,
Please I need your help. This is quite confusing. My condition is quite simple, but I just don't know why it still gets through even though it did not satisfy the parameters. Below is the sample condition.
IF p0001-btrtl = '1000' OR p0001-btrtl BETWEEN '2000' AND '2999'.
IF p0001-kostl in p_rccode.
MOVE p0001-kostl TO stab-kostl.
move: 1 to ok1.
ENDIF.
ELSEIF p0001-btrtl in p_btrtl.
move: 1 to ok1.
concatenate '0000000' p0001-btrtl into stab-kostl.
condense stab-kostl.
ENDIF.
The problem here is that p0001-btrtl's value is '210', but still the program gets through the 1st condition. Please, can anyone explain why this is happening. Hope you could help me with my dilemma. Thank you so much.
2007 Apr 24 11:04 AM
Hi,
Change your code in a way
IF ( p0001-btrtl = '1000' ) OR ( p0001-btrtl BETWEEN '2000' AND '2999' ).
IF p0001-kostl in p_rccode.
MOVE p0001-kostl TO stab-kostl.
move: 1 to ok1.
ENDIF.
ELSEIF p0001-btrtl in p_btrtl.
move: 1 to ok1.
concatenate '0000000' p0001-btrtl into stab-kostl.
condense stab-kostl.
ENDIF.
Reward if it is helpful
Regards,
Sangeetha.A
2007 Apr 24 11:04 AM
HI Anna,
In alphabetic sequence 210 falls in between 2000 ans 3000.
You can use a numeric field to get the required result.
<b>data: v_numc(4) type n.
v_numc = p0001-btrtl.</b>
IF p0001-btrtl = '1000' OR <b>v_numc</b> BETWEEN '2000' AND '2999'.
IF p0001-kostl in p_rccode.
MOVE p0001-kostl TO stab-kostl.
move: 1 to ok1.
ENDIF.
ELSEIF p0001-btrtl in p_btrtl.
move: 1 to ok1.
concatenate '0000000' p0001-btrtl into stab-kostl.
condense stab-kostl.
ENDIF.
Regards,
ravi
P.S: check this sample program to demonstrate the same
data: v_char(4) type n value '210'.
if v_char between '2000' and '3000'.
Write:/ 'Lies'.
else.
write:/ 'Doesnt fall'.
endif.
output: 'Doesnt fall'
2007 Apr 24 11:14 AM
Hi,
p0001-btrtl is a char4 element so,
if the value in p0001-btrtl is '210_' , where '_' is a space is normal that abap
consider this string inside '2000' and '2999', because you are not comparing
numbers, but characters.
If the value in p0001-btrtl is '_210' then ...i don't know !!!
Best Regards,
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |