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

No of Digits in the feild

Former Member
0 Kudos
636

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Kudos
609
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.
6 REPLIES 6
Read only

Former Member
0 Kudos
609

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

Read only

Former Member
0 Kudos
610
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.
Read only

Former Member
0 Kudos
609

Hi ,

You can define the second field as type n and length 10 to resolve that problem.

Regards

Pinaki

Read only

0 Kudos
609

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.

Read only

0 Kudos
609

Have you tried the function module I posted above?

Read only

0 Kudos
609

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