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

Conversion

Former Member
0 Likes
884

Hi Experts,

in MBEW there is field STPRS type CURR size is 11 and decimals is 2 whose value is suppose 10.00

Now i want to populate this value into a data object D1 which is of type C and size is 10.

My question i want the output as 0000010.00 i.e. spaces shld be added with leading zero's. how this can b achieved. I tried like this.

DATA: lv_stprs(10) type p decimals 2,

D1(10) type c.

lv_stprs = w_mbew-stprs. "where gs_mbew-stprs contains value 10.00

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = lv_stprs

IMPORTING

OUTPUT = D1

.

its giving some runtime error.

plz help me

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
777

DATA: lv_stprs(10) type n,

D1(10) type c.

lv_stprs = w_mbew-stprs. "where gs_mbew-stprs contains value 10.00

6 REPLIES 6
Read only

Former Member
0 Likes
778

DATA: lv_stprs(10) type n,

D1(10) type c.

lv_stprs = w_mbew-stprs. "where gs_mbew-stprs contains value 10.00

Read only

0 Likes
777

but it is taking the value as 0000000010 instead of 10.00

Read only

0 Likes
777

DATA: lv_stprs(10) type n,

D1(10) type c.

lv_stprs = w_mbew-stprs.

concatenate lv_stprs+3(10) '.' '00' into D1.

Read only

0 Likes
777

Hi

DATA: X TYPE P DECIMALS 3 VALUE '1.267', 
      Y TYPE F            VALUE '125.456E2'. 

WRITE: /X DECIMALS 0,  "output: 1 
       /X DECIMALS 2,  "output: 1.27

Similarly

DATA: v_waers LIKE tcurr-waers VALUE 'USD'.
USD for three decimals.
WRITE x currency v_waers.

Read only

Former Member
0 Likes
777

Hi,

declare DATA: lv_stprs type STPRS.

sometimes if the length is exceeded then it will give the error.

Regards

Shiva

Read only

Former Member
0 Likes
777

Abdul,

DATA: lv_stprs(10),

d1(10) .

lv_stprs = 10.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = lv_stprs

IMPORTING

OUTPUT = D1.

concatenate d1+3(7) '.00' into D1.

Now it will work .

Pls. mark if useful