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

preceeding zeroes in smartforms

Former Member
0 Likes
4,157


Hi All,

I am trying to print AUFNR field value in a smartform. My requirement is to have preceeding zeros to be printed. Currently it prints like 1234, but i want it to be printed like 0000001234. I have used the formatting option (F0), but it is not working. Any other suggestions would be helpful.

Thanks,

Ravi

1 ACCEPTED SOLUTION
Read only

former_member196651
Contributor
0 Likes
3,049

Hi Ravi,

R u sure that the field that you used to print process order is AUFNR itself. Put a break point before printing this field in a program line and check whether the field is containing value with preceding zeros. If not use the FM CONVERSION_EXIT_ALPHA_OUTPUT to get the field with the order no. with preceding zeros.

Regards,

Abijith


Hi All,

I am trying to print AUFNR field value in a smartform. My requirement is to have preceeding zeros to be printed. Currently it prints like 1234, but i want it to be printed like 0000001234. I have used the formatting option (F0), but it is not working. Any other suggestions would be helpful.

Thanks,

Ravi

12 REPLIES 12
Read only

naveenvishal
Contributor
0 Likes
3,049

Hi Ravi,

In Smartform when displaying variable:

Use &var(Z)&    " Z for supressing leading zeros

Hope this helps.

Regards,

Naveen

Read only

0 Likes
3,049

Hi Nvaeen,

Did you read my question? I want to have leading zeroes, not supressing.

Thanks,

Ravi

Read only

0 Likes
3,049

Hi Ravi,

Sorry i misunderstood.

You can you can use unpack statement in driver program like

unpack <var> to <var>.

Try it.

Regards,

Naveen

Read only

Former Member
0 Likes
3,049

Hi Ravi

Add a abap process in your smartform loop, call this FM 'CONVERSION_EXIT_ALPHA_INPUT'.

regards,

Archer

Read only

0 Likes
3,049

Hi Archer,

Did that too. It doesnt work.

Thanks,

Ravi

Read only

0 Likes
3,049

Archer ? but your name is right ?

Read only

former_member196651
Contributor
0 Likes
3,050

Hi Ravi,

R u sure that the field that you used to print process order is AUFNR itself. Put a break point before printing this field in a program line and check whether the field is containing value with preceding zeros. If not use the FM CONVERSION_EXIT_ALPHA_OUTPUT to get the field with the order no. with preceding zeros.

Regards,

Abijith

Read only

0 Likes
3,049

Hi Abhijith,

Yes, the field is of type AUFNR. I have used conversion exits, but it is not working.

Thanks,

Ravi Varma

Read only

0 Likes
3,049

Use &aufnr(K)&, (*) that will deactivate the conversion-exit ALPHA attached to AUFNR, this ALPHA conversion-exit will remove leading zeroes as soon as the field contains only numeric characters (**).

NB: Of course, that supposes that the field value is already correct and contains the leading zero, if, by accident, misfortune or mistake, the leading zero were previously removed, you should first regenerate correct value by reversing the conversion-exit with FM CONVERSION_EXIT_ALPHA_INPUT.

Regards,

Raymond

(*) Can be found in help.sap.com at Output Options for Field Contents.

(**) ALPHA Conversion Routine

Read only

0 Likes
3,049

Hi Abhijith,

    Use FM 'CONVERSION_EXIT_ALPHA_OUTPUT' for removing Leading Zero's in ABAP Code.

Thanks&Regards

Mahesh R

Read only

0 Likes
3,049

Nice Raymond!

An easy workaround could also be:

creating a global field type C

data: G_AUFNR(10).

then create an easy program line in routine before printing:

G_AUFNR = AUFNR.

and then in text box:

&G_AUFNR&

Read only

former_member196651
Contributor
0 Likes
3,049

Hi Ravi,

Have you checked that the field is containing values with preceding zeros. If so, then check the text field where you are printing it.

Regards,

Abijith