‎2008 Apr 02 3:33 AM
Hi,
In a case statement having the code sample below,
CAse v_xausz.
when '1'.
p_xausz = '2'.
when others.
p_xausz = '1'.
endcase.
if upon entering this case, v_xausz is blank, will it process the when others statement?
Thanks!
‎2008 Apr 02 3:34 AM
‎2008 Apr 02 3:34 AM
‎2008 Apr 02 3:40 AM
I was also assuming that that must be the case, however it failed me.
We have that codes inside a window in a sapscript. and we used the below codes to put value to v_xausz.
p_xausz in this case is blank upon entering the FM.
CALL FUNCTION 'TEXT_SYMBOL_SETVALUE'
EXPORTING
name = v_xausz
value = p_xausz
value_length = 15
EXCEPTIONS
OTHERS = 1.
‎2008 Apr 02 3:42 AM
Hi Mark, Can you check the data type of the variable, is it to be treated as text or integer?
‎2008 Apr 02 3:44 AM
Hi Eswar,
the variable is treated as a text....
v_xausz is defaulted as &xausz&...
Thanks a lot!
‎2008 Apr 02 3:48 AM
To test, can you try changing as below and see if it can make any difference:
CASE v_xausz.
WHEN '1'.
p_xausz = '2'.
WHEN space.
p_xausz = '1'.
WHEN others.
p_xausz = '1'.
ENDCASE.
‎2008 Apr 02 4:12 AM
Thanks Eswar!
Does this mean that the space value is not covered under the when others condition?
Thanks a lot!
‎2008 Apr 02 4:23 AM
Normally it should work, but am just wondering if there is any problem w.r.t conversion and comparision. I do remember data type plays an important role. When we have data type criteria the length can be considered as well. Btw, how did the system react when you have specified SPACE in case statement?
‎2008 Apr 02 4:35 AM
Hi Eswar,
It still didnt worked...
/: WHEN ' '.
/: IF &V_GLSPLT& EQ 'X'.
HL STATEMENT &v_indicator&
/: ELSE.
LF ,,STATEMENT
/: ENDIF.
I added the above codes in the case statement inside a variable window in the sapscript... but it still not working...
‎2008 Apr 02 4:44 AM
Do you think the problem lies with this FM?
CALL FUNCTION 'TEXT_SYMBOL_SETVALUE'
EXPORTING
name = v_xausz
value = p_xausz
value_length = 15
EXCEPTIONS
OTHERS = 1.
Will it assign a value to v_xausz even if p_xausz is blank?
Thanks a lot for your time! Really appreaciate it...
‎2008 Apr 02 3:38 AM
hi,
yes it works.............if not then try
CAse v_xausz.
when '1'.
p_xausz = '2'.
when others.
p_xausz = '1'.
when space .
p_xausz = '1'.
endcase.
regards,
pankaj
‎2008 Apr 02 3:39 AM