‎2009 Sep 05 8:42 AM
Hi experts,
I have a problem with comparision operator anyone can tell me how can i solve the problem.
i have a field in internal table for PF A/c No. and the content of the field like this:
ITAB-PFNO
MP/8129/199
MP/8129/43
MP/8129/1
MP/8129/42
MP/8129/36
NEW05.09.2009. <--- other character in tha data.
I want to move the last PFNO+8 into a new field. like this
ITAB-PFNO_NEW
199
43
1
42
36
0 <--- if other character from '0123456789' the value is 0.
I want to check that if itab-pfno8 value only from '0123456789' if any other character in the itab-pfno8 character
the itab-pfno_new = 0.
otherwise the last no in the itab-pfno_new.
because it is for sorting the data on pf no.
how can i do this????
‎2009 Sep 05 9:06 AM
Hi, NSTomar
Please test the following Sample Code it will help you to solve out your problem,
DATA: ctest TYPE string.
ctest = '12534575'. " This time all Number so will not Clear.
IF ctest CN '0123456789'.
CLEAR: ctest.
ENDIF.
WRITE: /'String = ', ctest.
ctest = '15.75'. " This time have (dot . ) so will Clear this
IF ctest CN '0123456789'.
CLEAR: ctest.
ENDIF.
WRITE: /'String = ', ctest.Faisal
‎2009 Sep 05 9:06 AM
Hi, NSTomar
Please test the following Sample Code it will help you to solve out your problem,
DATA: ctest TYPE string.
ctest = '12534575'. " This time all Number so will not Clear.
IF ctest CN '0123456789'.
CLEAR: ctest.
ENDIF.
WRITE: /'String = ', ctest.
ctest = '15.75'. " This time have (dot . ) so will Clear this
IF ctest CN '0123456789'.
CLEAR: ctest.
ENDIF.
WRITE: /'String = ', ctest.Faisal
‎2009 Sep 05 9:22 AM
Hi,
Try like this,
loop at itab.
if itab-pfno CA '/ '.
itab-pfno_new = itab-pfno+0(8).
else.
itab-pfno_new = '0'.
modify iitab.
endloop.
Make sure that the field ITAB-PFNO is declared with type STRING.
Regards,
Vikranth