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

check..numeric and charcter fields.

Former Member
0 Likes
489

Hi,

iam checking the conditions for numeric and character.if the output is numeric then it can shift to right justify,else if it is charcter left justify.but the following code is not checking for charcter fields.

data:p_input type c.

data: pout type string.

data: htype like DD01V-DATATYPE.

if htype = 'CHAR'.

shift htype LEFT DELETING LEADING space.

else.

CALL FUNCTION 'NUMERIC_CHECK'

EXPORTING

STRING_IN = P_INPUT

IMPORTING

STRING_OUT = POUT

HTYPE = HTYPE.

SHIFT htype RIGHT DELETING TRAILING space.

endif.

plz help me..

thanks

1 ACCEPTED SOLUTION
Read only

andreas_mann3
Active Contributor
0 Likes
438

hi,

try sth like that:

parameters p_input(50).
DATA: pout TYPE string.
DATA: htype LIKE dd01v-datatype.

CALL FUNCTION 'NUMERIC_CHECK'
     EXPORTING
          string_in  = p_input
     IMPORTING
          string_out = pout
          htype      = htype.


IF htype = 'CHAR'.
  SHIFT pout LEFT DELETING LEADING space.
ELSE.
  SHIFT pout RIGHT DELETING TRAILING space.
ENDIF.

Andreas

3 REPLIES 3
Read only

Former Member
0 Likes
438

Hi,

Please initialise htype to 'CHAR'. Also, Populate pout and use shift pout LEFT DELETING LEADING space.

Eg: Move 'CHAR' TO HTYPE.

Move ' SKK' TO POUT.

And then, use shift pout LEFT DELETING LEADING space.

and not shift htype LEFT DELETING LEADING space.

Read only

andreas_mann3
Active Contributor
0 Likes
439

hi,

try sth like that:

parameters p_input(50).
DATA: pout TYPE string.
DATA: htype LIKE dd01v-datatype.

CALL FUNCTION 'NUMERIC_CHECK'
     EXPORTING
          string_in  = p_input
     IMPORTING
          string_out = pout
          htype      = htype.


IF htype = 'CHAR'.
  SHIFT pout LEFT DELETING LEADING space.
ELSE.
  SHIFT pout RIGHT DELETING TRAILING space.
ENDIF.

Andreas

Read only

Former Member
0 Likes
438

use code like this -

if input CN '0123456789' . " (not numc field)

**right justify.

else.

*left justify.

endif.