12-14-2007 1:19 PM
hi...
an urgent requirement...
i have an internal table, with rows containing characters of 70 length.
if i find continous 16 digits of numbers, i have to replace the numbers with space.
How am i supposed to do this?
The first row can be continued by next row record also.
So, how to check the contnuinty in the next record also.
for example...
Line 1--- thrirj1234
line 2 --- 45678thyeu
so, it has c first line and next line to is to be checked to c if it is starting wth numbers.
please do help me solve this issue..
Thank u
12-14-2007 1:47 PM
Credit card numbers?
Untested - but this could work:
DATA: rec(70),
t_tab LIKE STANDARD TABLE OF rec,
l_checkrec(85).
FIELD-SYMBOLS: <l_rec> LIKE rec,
<l_next_rec> LIKE rec.
DATA: l_index TYPE i,
l_checklen TYPE i,
l_pos TYPE i,
l_char TYPE c LENGTH 1,
l_num_length TYPE i,
l_start TYPE i,
l_len TYPE i.
LOOP AT t_tab ASSIGNING <l_rec>.
l_index = sy-tabix + 1.
READ TABLE t_tab ASSIGNING <l_next_rec> INDEX l_index.
IF <l_next_rec> IS ASSIGNED.
CONCATENATE <l_rec> <l_next_rec> INTO l_checkrec.
ELSE.
l_checkrec = <l_rec>.
ENDIF.
l_checklen = STRLEN( l_checkrec ).
DO l_checklen TIMES.
l_char = l_checkrec+l_pos(1).
IF l_char CA '0123456789'.
ADD 1 TO l_num_length.
ELSE.
CLEAR l_num_length.
ENDIF.
IF l_num_length EQ 16.
l_start = l_pos - 16.
IF l_pos LE 70.
CLEAR <l_rec>+l_start(16).
ELSE.
CLEAR <l_rec>+l_start.
l_len = l_pos - 70.
CLEAR <l_next_rec>(l_len).
ENDIF.
ENDIF.
ENDDO.
ENDLOOP.
As I say, untested - so you'll probably have to play with some of the numbers to get it exactly right, but I think the principle is obvious.
matt
12-14-2007 1:47 PM
Credit card numbers?
Untested - but this could work:
DATA: rec(70),
t_tab LIKE STANDARD TABLE OF rec,
l_checkrec(85).
FIELD-SYMBOLS: <l_rec> LIKE rec,
<l_next_rec> LIKE rec.
DATA: l_index TYPE i,
l_checklen TYPE i,
l_pos TYPE i,
l_char TYPE c LENGTH 1,
l_num_length TYPE i,
l_start TYPE i,
l_len TYPE i.
LOOP AT t_tab ASSIGNING <l_rec>.
l_index = sy-tabix + 1.
READ TABLE t_tab ASSIGNING <l_next_rec> INDEX l_index.
IF <l_next_rec> IS ASSIGNED.
CONCATENATE <l_rec> <l_next_rec> INTO l_checkrec.
ELSE.
l_checkrec = <l_rec>.
ENDIF.
l_checklen = STRLEN( l_checkrec ).
DO l_checklen TIMES.
l_char = l_checkrec+l_pos(1).
IF l_char CA '0123456789'.
ADD 1 TO l_num_length.
ELSE.
CLEAR l_num_length.
ENDIF.
IF l_num_length EQ 16.
l_start = l_pos - 16.
IF l_pos LE 70.
CLEAR <l_rec>+l_start(16).
ELSE.
CLEAR <l_rec>+l_start.
l_len = l_pos - 70.
CLEAR <l_next_rec>(l_len).
ENDIF.
ENDIF.
ENDDO.
ENDLOOP.
As I say, untested - so you'll probably have to play with some of the numbers to get it exactly right, but I think the principle is obvious.
matt