2009 Feb 12 2:58 PM
Hi,
I have a two feilds with data type char with 6 digits and data type char with 10 digits.
i want first feild value assing to 2nd feild
ex: feild1(6) type char value 000368.
feild2(10) type char.
feild2 = feild1
out put for feild2 should be 0000000368 (10 digits)
as per my requirement i want to check no of digit in the feild1 and based on it prifix zeros to feild1 value before assinging the value to feild2.
please help me out the code on the above requiremtn.
2009 Feb 12 3:10 PM
DATA:
field1(6) TYPE c VALUE '000368',
field2(10) TYPE c.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = field1
IMPORTING
output = field2.
WRITE field2.
2009 Feb 12 3:00 PM
Hi,
Use type N this will resolve the issue
ex:
data:feild1(6) type c value 000368,
feild2(10) type n.
feild2 = feild1.
write :feild2.
This will resolve the issue.
regards,
Gurpreet
2009 Feb 12 3:10 PM
DATA:
field1(6) TYPE c VALUE '000368',
field2(10) TYPE c.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = field1
IMPORTING
output = field2.
WRITE field2.
2009 Feb 12 3:15 PM
Hi ,
You can define the second field as type n and length 10 to resolve that problem.
Regards
Pinaki
2009 Feb 12 3:49 PM
Those two feilds are standard feilds, so i can't change the properites of those two feilds.
Please help me that is there any statement in ABAP to prefix zero values of the value
ex: 1234
0001234 like that.
2009 Feb 12 3:51 PM
2009 Feb 12 3:57 PM
Hi,
Check this Function Module. This will resolve your issue
HRPBSNO_FORMAT_ZERO.
Move Field1 to Field2.
Now pass '10' to Left(Parameter in the function module).
Pass Field2 to STR (Changing parameter in the function module).
You'll get what you want.
Enjoy,
Prashanth