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

Regarding amount field

Former Member
0 Likes
1,102

Hi folks,

I am developing a Extract report, which extracts the data into a output file. In the output file the max length of amount field is 13. presently, suppose if the amount value is 5000 the first nine characters are empty spaces and the last four characters are 5000. But my requirement is the first nine characters should be zero's and the last four characters should be 5000 (like 0000000005000). Could you pls sugest me how to acheive it....Thanks in advance..

Ram.

Hi folks,

I am developing a Extract report, which extracts the data into a output file. In the output file the max length of amount field is 13. presently, suppose if the amount value is 5000 the first nine characters are empty spaces and the last four characters are 5000. But my requirement is the first nine characters should be zero's and the last four characters should be 5000 (like 0000000005000). Could you pls sugest me how to acheive it....Thanks in advance..

Ram.

9 REPLIES 9
Read only

Former Member
0 Likes
1,070

Use FM :

CONVERSION_EXIT_ALPHA_INPUT

or pass your amount to a variable of type N.

Edited by: Srinivas Gurram Reddy on Apr 22, 2008 4:52 PM

Read only

Former Member
0 Likes
1,070

Hi,

You can use

Conversion_exit_alpha_input

CONVERSION_EXIT_ALPHA_INPUT - converts any number into a string fill with zeroes-right

example:

input = 123

output = 0000000000000...000000000000123

Regards,

Raj.

Read only

Former Member
0 Likes
1,070

Hi Ram,

Take one string and pass the amount into that string. Pass that string to FM which mentined above solutions. And pass the same string as output parameter for that FM. Now move that string value (Converteeed Amount) to your original variable.

Hope this helps you..

Regards,

Kumar.

Read only

Former Member
0 Likes
1,070

Hi,

See the fm CONVERSION_EXIT_ALPHA_INPUT.and read the documentation.

Refer

https://forums.sdn.sap.com/click.jspa?searchID=11015321&messageID=2626082

Regards

Kiran Sure

Read only

Former Member
0 Likes
1,070

Hi use this Function Module :

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = field

importing

output = lv_field.

Read only

Former Member
0 Likes
1,070

Hi,

Ram,

You can Use FM

CONVERSION_EXIT_ALPHA_INPUT

Edited by: Sunil Saini on Apr 22, 2008 1:30 PM

Read only

Former Member
0 Likes
1,070

Hi ,

Ram.

what u can do is u can move that Currency field into a Numc field of length 13 if you don't want Decimal places and if you want to keep decimal places as well then u can move it into a Character field of length 13 as shown in the below Code.

PARAMETERS:
  p_price LIKE vbak-netwr.

DATA:
  w_price(13) TYPE c,
  w_counter   TYPE i.

WRITE p_price To w_price.
Do.
  IF w_price+w_counter(1) EQ ''.
    w_price+w_counter(1) = '0'.
  ELSE.
    EXIT.
  ENDIF.
  ADD 1 TO w_counter.
ENDDO.

write:
  / w_price.

Regards,

Sunil

Read only

Former Member
0 Likes
1,070

v_aufnr = 5000.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = V_AUFNR

IMPORTING

OUTPUT = T_AUFNR.

write : / T_AUFNR.

output: 0000000005000.

close your thread.

Read only

Former Member
0 Likes
1,070

Hi,

Use the below code.

data: v_amt(13) value '5000',

v_amt1(13) type n.

unpack v_amt to v_amt1.

write:/ v_amt1.