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

String - Characters from 5th position to 17th position - numeric

Former Member
0 Likes
956

All,

I have a string of characters and I need check if the Characters from 5th position to the 17th position should be all numeric.

Any ideas.

Meghna

1 ACCEPTED SOLUTION
Read only

SG141
Active Participant
0 Likes
794

Here's the sample code...

DATA: LS_STRING TYPE STRING.
DATA: LS_CHAR TYPE C LENGTH 12.

CONSTANTS: LS_VALUE(10) TYPE C VALUE '01234567890'.

ls_char = ls_string+5(12).

if ls_char CA ls_value ---> Checks if 5-17 characters have any numerics in them.
your code.
else.
your code.
endif.

Edited by: Karthik on Aug 17, 2009 10:58 PM

All,

I have a string of characters and I need check if the Characters from 5th position to the 17th position should be all numeric.

Any ideas.

Meghna

3 REPLIES 3
Read only

former_member194669
Active Contributor
0 Likes
793

Try this way


        call function 'NUMERIC_CHECK'
          exporting
            string_in  = v_text+5(12)
          importing
            string_out = v_text
            htype      = type.
        if type ne 'NUMC'.
          message e999  with ' Number is NOT numberic'.
        endif.

Please search before posting

Read only

SG141
Active Participant
0 Likes
795

Here's the sample code...

DATA: LS_STRING TYPE STRING.
DATA: LS_CHAR TYPE C LENGTH 12.

CONSTANTS: LS_VALUE(10) TYPE C VALUE '01234567890'.

ls_char = ls_string+5(12).

if ls_char CA ls_value ---> Checks if 5-17 characters have any numerics in them.
your code.
else.
your code.
endif.

Edited by: Karthik on Aug 17, 2009 10:58 PM

Read only

Former Member
0 Likes
794

Thanks Karthik.

Meghna