2008 Apr 22 12:14 PM
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.
2008 Apr 22 12:17 PM
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
2008 Apr 22 12:18 PM
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.
2008 Apr 22 12:23 PM
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.
2008 Apr 22 12:24 PM
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
2008 Apr 22 12:27 PM
Hi use this Function Module :
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = field
importing
output = lv_field.
2008 Apr 22 12:27 PM
Hi,
Ram,
You can Use FM
CONVERSION_EXIT_ALPHA_INPUT
Edited by: Sunil Saini on Apr 22, 2008 1:30 PM
2008 Apr 22 12:28 PM
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
2008 Apr 22 12:34 PM
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.
2008 Apr 22 12:39 PM
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.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |