2007 Apr 30 11:54 AM
Hi all,
I have a requirement in that i have to append zeors to the left of a character variable which is having length 10. While using shift statement the default character is space, then i tried with the 'IN BYTE MODE' option but there the representation is different,Each byte is represented as two characters.Is there any easy way to append zeros to a character variable using any of the ABAP keywords.
Thanks in Advance,
Shaju
Hi all,
I have a requirement in that i have to append zeors to the left of a character variable which is having length 10. While using shift statement the default character is space, then i tried with the 'IN BYTE MODE' option but there the representation is different,Each byte is represented as two characters.Is there any easy way to append zeros to a character variable using any of the ABAP keywords.
Thanks in Advance,
Shaju
2007 Apr 30 11:59 AM
2007 Apr 30 12:09 PM
Hi,
It is not working.
Sometimes the character field can have Alphanumeric data.
I want to append zeros even if the field has alphanumeric data like C123
This FM will append zeros only if the field has numeric value like 123.
waiting for ur reply,
Regards,
Shaju
2007 Apr 30 12:24 PM
You can do something like this
REPORT ychatest.
DATA : v_char(10) VALUE 'C1234',
v_len TYPE i.
v_len = STRLEN( v_char ).
v_len = 10 - v_len.
DO v_len TIMES.
CONCATENATE '0' v_char INTO v_char.
ENDDO.
WRITE : / v_char.
2007 Apr 30 12:28 PM
Hi,
Thanks for ur info
I am looking for an ABAP keyword which gives the same result.
Is there any such keyword.
Thanks,
Shaju
2007 Apr 30 12:32 PM
2007 Apr 30 12:46 PM
Hi,
Since it contains alphanumeric character the UNPACK statement leads to a
runtime short dump.
Any alternate solution ?
Regards,
Shaju
2007 Apr 30 12:50 PM
can this help u
REPORT ychatest.
DATA : v_char(10) VALUE 'C1234',
WRITE : v_char TO v_char RIGHT-JUSTIFIED.
TRANSLATE v_char USING ' 0'.
WRITE: / v_char.
2007 Apr 30 12:58 PM
2007 Apr 30 1:12 PM
I doubt that you can do via a single statement but with the combination of below two statements would resolve your issue.
lets say your value is in lalpha(10).
concatenate '0000000000' & lalpha into ltemp.
write ltemp to lapha using edit mask 'RR__________'.
Regards
Anurag
2007 Apr 30 12:03 PM
Hi Shaju
CONVERSION_EXIT_ALPHA_INPUT This function module is used to append leading zeroes...
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wf_version
IMPORTING
output = wf_version.
Example:
input = 123
output = 0000000000000...000000000000123
Hope this resolves your query.
<b>Reward all the helpful answers.</b>
Regards
2007 Apr 30 12:06 PM
1. Open the perticular field in SE11.
2. Find the domein
3. Go to the definition tab
4. If there is a convertion routine, double click that
5. You will find a list of conversion routine there. Among them use the conversion for output.
Ex:
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_anlkl
IMPORTING
output = l_anlkl.Here the output l_anlkl will have zeros appended with it.
If there is no conversion routine you have to write code for appending zeros.
2007 Apr 30 12:53 PM
use like this
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_lifnr
IMPORTING
output = wa_lifnr.
Regards,
Venkat
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |