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 of zero

Former Member
0 Likes
1,388

Hi,

I want the function module which can convert the field leading zero. The data type is CURR of the field.

For example I have one internal table itab_mara in which VERBR field I have to convrt this field.

suppose this is 100.79. Then the output should be 00010079.

It should remove the . with space and fill the zero.Total no of digits should be 8 after conversion.

Thanks.

Hi,

I want the function module which can convert the field leading zero. The data type is CURR of the field.

For example I have one internal table itab_mara in which VERBR field I have to convrt this field.

suppose this is 100.79. Then the output should be 00010079.

It should remove the . with space and fill the zero.Total no of digits should be 8 after conversion.

Thanks.

6 REPLIES 6
Read only

Former Member
0 Likes
1,137

Hi,

CONVERSION_EXIT_ALPHA_INPUT converts any number into a string fill with zeroes, with the number at the extreme right

Example:

input = 123

output = 0000000000000...000000000000123

CONVERSION_EXIT_ALPHA_OUTPUT converts any number with zeroes right into a simple integer

Example:

input = 00000000000123

output = 123

Please reward if useful.

Read only

Former Member
0 Likes
1,137

hi sandeep,

do this way:

data: num(8) type numc.

num = v_valu * 100.

write: num.

Regards,

Ravi Kanth Talagana

Read only

Former Member
0 Likes
1,137

Hi,

You can use Unpack command also.

Data : temp(10) value '123'.

unpack temp into temp.

write : temp. "123 converted into 0000000123.

thanks.

Read only

mahaboob_pathan
Contributor
0 Likes
1,137

hi,

use this FM. it will append Zero's to left of the value.

take u r amount in one varialbe and pass to this FM.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = v_refno

IMPORTING

output = v_refno.

Read only

Former Member
0 Likes
1,137

Hi,

Try the code below:


 DATA : amt type MAXBT VALUE '0.50',
       str(20) type c.

CALL FUNCTION 'HRGPBS_HER_FORMAT_AMOUNT'
  EXPORTING
    p_amount                 = amt
    p_currency               = 'USD'
    p_required_format        = '00000000'
* IMPORTING
*   P_ERROR                  =
*   P_ERROR_AMOUNT           =
*   P_ERROR_CURRENCY         =
*   P_ERROR_OVERFLOW         =
  changing
    p_formatted_amount       = str
          .


WRITE : str . 

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
1,137

Hi,

DATA: V_AMT TYPE P DECIMALS 2.

DATA: V_NUM(8) TYPE N.

V_AMT = '100.79'.

V_AMT = 100 * V_AMT.

WRITE:/ V_AMT.

MOVE V_AMT TO V_NUM.

WRITE:/ V_NUM.