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

adding leading zeroes

Former Member
0 Likes
792

Hi i have a variable of type packed decimal whose value is 1.1. I move this value into a variable of type char length 6 and when i display, it displays 1.1, i want it to be displayed as 0001.1 How can i do that?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
735

Hi

Pass the decimal value to variable quant type char6

quan1 type char4

quan2 type char2.

split quan at '.' into quan1 quan2.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = quan1

IMPORTING

OUTPUT = quan1.

concatenate quan1 quan2 into quant separated by '.'.

This should solve it

Message was edited by: Dominic Pappaly

6 REPLIES 6
Read only

Former Member
0 Likes
735

Hi Kantheri,

<b>Use TYPE N variable and assign packed decimals value to this.</b>

DATA V_PDEC TYPE P DECIMALS 1 VALUE '1.1'.

DATA V_LNUM(4) TYPE N.

V_LNUM = V_PDEC.

WRITE:/ V_LNUM. <b>--->0001</b>

Thanks,

Vinay

Read only

0 Likes
735

Hi ,

you can use his FM

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = lv_var

IMPORTING

OUTPUT = lv_var

.

Regards,

Sumit.

Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
735

Hi,

Use the F.M <b>CONVERSION_EXIT_ALPHA_INPUT</b>

cheers,

Simha.

Read only

Former Member
0 Likes
735

use <b> type n</b> instead of char.

Read only

Former Member
0 Likes
736

Hi

Pass the decimal value to variable quant type char6

quan1 type char4

quan2 type char2.

split quan at '.' into quan1 quan2.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = quan1

IMPORTING

OUTPUT = quan1.

concatenate quan1 quan2 into quant separated by '.'.

This should solve it

Message was edited by: Dominic Pappaly

Read only

Former Member
0 Likes
735

HI,

USE THE FUNCTION MODULE 'CONVERSION_EXIT_ALPHA_INPUT'

DHARMESH