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

conversion in abap

Former Member
0 Likes
870

Hi all,

Happy Holi...

I have requirment like

user has to give his intrnal ordernumber as an input which is 12 digits number. But the acutal internal oreder number is lessthatn 12 digits . so whenever the user enter lessthan 12dgits then that number should be leftjustified and zeros(0)padded right

ex:

000001800920 (Order number for IO 1800920, with leading 0)

Thanks in Advance

Ravi

7 REPLIES 7
Read only

Former Member
0 Likes
787

DATA ionr(12) TYPE N.

ionr = '12334'.

Now use variable <b>ionr</b>.

In this variable zeros will be padded to the left.

Message was edited by: Wenceslaus G

Read only

Former Member
0 Likes
787

hi Ravi ,

use

<b>CONVERSION_EXIT_ALPHA_INPUT</b> which converts any number into a string fill with zeroes, with the number at the extreme right ..

a sample..

parameters : num(10)  type c .
data :  str(10) type  c.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input         = num
 IMPORTING
   OUTPUT        = str
          .

write : str.

regards

satesh

Read only

0 Likes
787

hi Charan ,

use <b>CONVERSION_EXIT_ALPHA_INPUT</b>

hope this helps

Regards,

Santosh P

Read only

Former Member
0 Likes
787

Hi Charan,

use this FM CONVERSION_EXIT_ALPHA_INPUT

Regards,

GSR.

Read only

Former Member
0 Likes
787

Hai Ravi,

CONVERSION_EXIT_ALPHA_INPUT converts any number into a string fill with zeroes, with the number at the extreme right

Example:

input = 123

output = 0000000000000...000000000000123

CONVERSION_EXIT_ALPHA_OUTPUT converts any number with zeroes right into a simple integer

Example:

input = 00000000000123

output = 123

Regards,

Srikanth.

reward points if helpful.

Read only

athavanraja
Active Contributor
0 Likes
787

i guess its selection screen field. in such a case simply refet to the internal oder number talbe field.

parameters: iord type AUFNR .

The system will automatically take care of converting it

Regards

Raja

Read only

Former Member
0 Likes
787

HI

YOU CAN DEFINE THE ORDER NUMBER WITH ANY VARIABLE OF TYPE 'N' WITH LENGTH 12. SO THAT IF THE NO.OF DIGITS IS LESS THAN 12 ZEROS WILL BE PADDED TO THE LEFT.

<u>DATA ORD_NO(12) TYPE N.</u>

THIS WILL BE ENOUGH. NOW USE THIS ORD_NO

IF THIS WORKS OUT FOR YOU PLEASE REWARD POINTS

REGARDS

ANOOP

Message was edited by: ANOOP R.S