Application Development 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: 

check..numeric and charcter fields.

Former Member
0 Kudos

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

andreas_mann3
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

andreas_mann3
Active Contributor
0 Kudos

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

Former Member
0 Kudos

use code like this -

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

**right justify.

else.

*left justify.

endif.