Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

comparision operator problem.

Former Member
0 Likes
423

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????

1 ACCEPTED SOLUTION
Read only

faisalatsap
Active Contributor
0 Likes
391

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

2 REPLIES 2
Read only

faisalatsap
Active Contributor
0 Likes
392

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

Read only

Former Member
0 Likes
391

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