04-08-2013 1:55 AM
Hi all,
I used this following select stament:
wa_t001l_lgobe-sign = 'I'.
wa_t001l_lgobe-option = 'CP'.
* wa_t001l_lgobe-low = lv_ps
CONCATENATE '*' lv_psloc '*' INTO wa_t001l_lgobe-low.
APPEND wa_t001l_lgobe TO r_t001l_lgobe.
SELECT SINGLE lgort
FROM t001l
INTO lv_lgort
WHERE werks = p_werks
AND lgobe IN r_t001l_lgobe.
IF sy-subrc = 0.
ENDIF.
r_t001l_lgobe = *AA- 123*
The sy-subrc returns 4. The select stament cannot seems to find strings with spaces in between. Anyone knows what is wrong here?
04-09-2013 2:43 AM
Hi all,
Apparently, the problem lies with the string itself which contains non-breaking space.
That is why the SELECT statement cannot match with the string.
Have to replace all occurences of the special char with space.
call method cl_abap_conv_ince=>uccp
exporting
uccp =
'000D'
receiving
char = lv_rep.
loop at r_t001l_lgobe into wa_t001l_lgobe.
replace all occurances of wa_t001l_lgobe-low with ' '.
replace all occurances of wa_t001l_lgobe-high with ' '.
modify r_t001l_lgobe from wa_t001l_lgobe transporting low high.
clear wa_t001l_lgobe.
endloop.
04-08-2013 5:03 AM
Hi Siong,
Can you mention what lv_psloc contains?
Also you can write it as below:
SELECT LGORT
FROM T001L
INTO TABLE IT_LGORT
WHERE WERKS = P_WERKS.
IF SY-SUBRC EQ 0.
SORT IT_LGORT BY LGORT.
DELETE IT_LGORT WHERE LGORT NP '*LV_PSLOC*'.
ENDIF.
I think in ranges only EQ and BT works but not anything other than this. Also WERKS can contain many LGORT of pattern '*lv_psloc*' right? Why do you want to get it into a variable?
Hope this helps.
04-08-2013 5:41 AM
Hi,
Instead of * try using % in the concatenate statement..
Regards,
ramesh.
04-08-2013 6:23 AM
Hi,
your code seems correct. Are you sure that the combination of werks and lgobe exist? Are take care that P_WERKS has an value?
Btw. SELECT SINGLE should be only used if you have the full table key in the WHERE clause. In your case the better alternative is:
SELECT LGORT
FROM T001L UP TO 1 ROWS
...
ENDSELECT.
Regards,
Dirk
04-08-2013 6:46 AM
Hi,
When you are using CP, what is the need of appending * to lv_psloc..
wa_t001l_lgobe-sign = 'I'.
wa_t001l_lgobe-option = 'CP'.
wa_t001l_lgobe-low = lv_psloc should suffice.
or try with Like statment
concatenate '%' lv_psloc '%' into lv_psloc.
SELECT SINGLE lgort
FROM t001l
INTO lv_lgort
WHERE werks = p_werks
AND lgobe like lv_psloc.
IF sy-subrc = 0.
ENDIF.
Regards,
Swarna
04-08-2013 7:17 AM
HI Siong,
i checked your code on different table and it is working fine ..............check whether that record is present in database. try to check the value is same in database...
thanks and regards,
narayan
04-08-2013 7:57 AM
Hi,
As in where clause you have taken WERKS as parameter that is why it treating as mandatory field,
change it to select option with no intervals.
I think this would work in your case.
Reward points if Useful.
04-09-2013 2:43 AM
Hi all,
Apparently, the problem lies with the string itself which contains non-breaking space.
That is why the SELECT statement cannot match with the string.
Have to replace all occurences of the special char with space.
call method cl_abap_conv_ince=>uccp
exporting
uccp =
'000D'
receiving
char = lv_rep.
loop at r_t001l_lgobe into wa_t001l_lgobe.
replace all occurances of wa_t001l_lgobe-low with ' '.
replace all occurances of wa_t001l_lgobe-high with ' '.
modify r_t001l_lgobe from wa_t001l_lgobe transporting low high.
clear wa_t001l_lgobe.
endloop.