2014 Jun 27 3:47 PM
Hi All,
I have a calue Communication in the internal table .
When i use READ TABLE it into wa where name = 'Comm%' is not working.
How to use a substring for read table?
Thanks
Vijay
2014 Jun 27 4:00 PM
2014 Jun 27 4:58 PM
Hello Gowtham,
Are you trying to ready first 4 characters of name filed in read statement.
Try like below
READ TABLE it into wa where name+0(4) = 'Comm'. or
delete it where name+0(4) NE Comm'.
Thanks
2014 Jun 27 5:18 PM
2014 Jun 27 5:20 PM
Hello Gowtham
My mistake , I gave incorrect syntax. use 'with key'
READ TABLE it into wa with key name+0(4) = 'Comm'.
2014 Jun 27 5:25 PM
Hi Vijay,
String Comparison won't work in Read statement, instead of that, we can use the same in Loop statement as shown below.
REPORT zread_internal_table.
"Structure Declaration
TYPES: BEGIN OF ty_makt,
matnr TYPE matnr,
maktx TYPE maktx,
END OF ty_makt.
"Data Declaration
DATA: it_makt TYPE TABLE OF ty_makt, "Internal Table
wa_makt TYPE ty_makt. "Work Area
"Retrive the Records from Database Tabble
SELECT matnr
maktx
FROM makt
INTO TABLE it_makt
UP TO 10 ROWS.
"Compare String
LOOP AT it_makt INTO wa_makt WHERE maktx CA '%this%'.
"Write Statment
WRITE wa_makt-maktx.
"Exit from the Loop after 1st Record Read from Internal Table
EXIT.
ENDLOOP.
Regards
Rajkumar Narasimman
2014 Jun 30 8:03 AM
Try this:
READ TABLE itab WITH KEY low(4) = 'COMM' INTO l_val.
2014 Jul 14 4:15 PM
Thanks for reply.. I found out that since READ can read a single value , we cannot use sub strings for READ .
Thanks
Vijay