‎2009 Sep 26 6:35 PM
Hi
I have a table where I got data in upper and lower case (like "TeSt".
My selection must find this entry if the selct-options contain:
TE*
te*
*ST
etc.
In my program I select all my data in an internal table.
Then the text field (TeSt) from the internal table is converted into a local field in upper-case .
But how do I get the the right data?
I have tried this, but it is not a succes...
LOOP at ITAB
lv_firm = ITAB-company.
lv_strln = STRLEN( lv_firm ).
DO lv_strln TIMES.
TRANSLATE lv_ITAB+lv_count(1) TO UPPER CASE .
ADD 1 TO lv_count.
ENDDO.
IF lv_firm IN r_firm.
CONTINUE.
ELSE.
DELETE ITAB.
ENDIF.
ENDLOOP.
‎2009 Sep 26 7:01 PM
Hi,
You dont have to convert the field to uppercase character by character. You can directly use the translate command on the whole field. If r_firm is the select-options, convert even those to upper case
data: v_firm(10) type c.
SELECT-OPTIONS: r_firm for v_firm.
loop at r_firm.
TRANSLATE r_firm-low TO UPPER CASE .
modify r_firm.
endloop.
LOOP at ITAB
TRANSLATE ITAB-company TO UPPER CASE .
IF NOT ITAB-comapny IN r_firm.
DELETE ITAB.
ENDIF.
ENDLOOP.
Regards,
Vikranth
‎2009 Sep 26 7:01 PM
Hi,
You dont have to convert the field to uppercase character by character. You can directly use the translate command on the whole field. If r_firm is the select-options, convert even those to upper case
data: v_firm(10) type c.
SELECT-OPTIONS: r_firm for v_firm.
loop at r_firm.
TRANSLATE r_firm-low TO UPPER CASE .
modify r_firm.
endloop.
LOOP at ITAB
TRANSLATE ITAB-company TO UPPER CASE .
IF NOT ITAB-comapny IN r_firm.
DELETE ITAB.
ENDIF.
ENDLOOP.
Regards,
Vikranth
‎2009 Sep 26 7:29 PM
Thanks for the reply - My range was wrong... (the option should be CP).
Anyway I could use your optimized code thanks
‎2009 Sep 27 7:57 AM
DATA v_field(10) TYPE c.
SELECT-OPTIONS s_field FOR v_field LOWER CASE.
START-OF-SELECTION.
SELECT FIELD1
FROM DATA_TABLE
INTO TABLE IT_TAB
WHERE FIELD1 IN s_field.the keywords 'LOWER CASE' to set select-option upper and lower sensitive.
‎2009 Sep 26 7:27 PM
Hi,
<li> I tried with the below sample program by giving matnr 100* , *100.
<li>You do not need to worry about your case you mentioned TE* te* *ST. It automatically converts to capital letters.
Try this way.
Thanks
Venkat.O
REPORT ZTEST_NOTEPAD.
TABLES:MARC.
DATA: IT_MARC TYPE STANDARD TABLE OF MARC WITH HEADER LINE.
SELECT-OPTIONS: S_MATNR FOR MARC-MATNR.
START-OF-SELECTION.
SELECT * FROM MARC INTO TABLE IT_MARC WHERE MATNR IN S_MATNR.
LOOP AT IT_MARC.
LOOP AT S_MATNR.
IF MARC-MATNR CP S_MATNR-LOW.
WRITE:/ IT_MARC-MATNR.
ENDIF.
ENDLOOP.
ENDLOOP.