cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove extra zeros in form printing

Former Member
0 Kudos

Dear Guru / experts,

I have created a Structure in SE11, where MATNR is CHAR 18. Now when I am printing this field (MATNR) on smart form, it show value 000000000030000670 instead of 30000670.

I want to print 30000670. please suggest.

Thanks in Advance.

DSC

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Use condense statement in smartforms in program lines node or write your code in initialization.

Regards

Praveen

Former Member
0 Kudos

Dear Mr. Kemmer & Praveen,

I am inserting the field in TABLE - TEXT in Smartform. like: &WA-MATNR&.

If I Write it &WA-MATNR(K)&. the system print it same (&WA-MATNR(K)&).

Mr. Praveen, How can we condense. please elaborate.

DSC

brad_bohn
Active Contributor
0 Kudos

Mr. Praveen, How can we condense. please elaborate.

Don't use that approach - it's not necessary. Florian already gave you the solution...

Former Member
0 Kudos

Mr. Brad,

OK, But I am new and on learning stage. My problem is that:

I am inserting the field in TABLE - TEXT in Smartform. like: &WA-MATNR&

If I Write it &WA-MATNR(K)&. the system printing it same &WA-MATNR(K)&

What should I do? Help Me.

DSC

brad_bohn
Active Contributor
0 Kudos

Don't type the text literally, use the 'insert field' button...

Former Member
0 Kudos

Thanks Mr. Brad,

For clearing my doubts. Now it is working fine. But, only one issue is there: the Space / Gap. system is printing -

MAT. COD: <GAP of 10 Digits> 30000670 instead of MAT. Cod: 30000670

It means system still considering the space of zeros. How can we remove that space. please tell me.

DSC

Edited by: Devendra Singh Chauhan on Dec 16, 2010 8:09 AM

brad_bohn
Active Contributor
0 Kudos

Space compression is done with the 'C' option. You should Google the 'SAPScript Made Easy' guide and review the formatting options in chapter 7.

Don't use the CONVERSION_EXIT_ALPHA_INPUT or SHIFT as the subsequent others suggested - those are other wrong approaches (unnecessary hacks) for form development.

Former Member
0 Kudos

Dear Mr. Brad,

can you explain with example. Suppose I am printing field &WA-MATNR(Z)& as you suggested.

what changes i have to made.

with thanks.

DSC

0 Kudos

Hi,

Add program lines just before you print the MATNR.

Put code as follows:

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

INPUT = lv_matnr

IMPORTING

OUTPUT = lv_matnr

and now print it.

It will work.

Hope, you know how to add program lines and specify input parameters and output paramaeters.

Regards,

Antim

Edited by: Antim Parmar on Dec 17, 2010 12:54 PM

brad_bohn
Active Contributor
0 Kudos

@Antim: It may 'work', but as I've already pointed-out to the other inexperienced posters here, it's not the correct approach. Why use a code hack when SAP has already provided formatting options for this? You also used the wrong conversion exit for materials...

@DSC: You should not need the space compression format option - '(Z)' by itself works fine for me but try using '(ZC)' instead

Answers (3)

Answers (3)

Former Member
0 Kudos

This is why moderators get grey. When I first saw this, I thought about sending it to the Test and Playground forum, but for some reason didn't.

And now it's too late.

Rob

;-((

brad_bohn
Active Contributor
0 Kudos

Ha! So there are limits to your powers?

Former Member
0 Kudos

>

> Ha! So there are limits to your powers?

Don't be ridiculous.

But apparently there are limits to my foresight.

Rob

Former Member
0 Kudos

Dear Mr. Brad,

Thanks again. Problem solved.

Points has been assigned.

DSC

0 Kudos

Dear Dev,

You can use the Function "CONVERSION_EXIT_ALPHA_OUTPUT" to truncate the zeros and then you can use it in th smartform to print.

Regards,

Ejas

Former Member
0 Kudos

Hi Dev,

To delete leading spaces use the below statement.

SHIFT <yourfield> LEFT DELETING LEADING space.

Regards,

Shirisha

Former Member
0 Kudos

&MATNR(Z)& or &MATNR(K)&

Edited by: Florian Kemmer on Dec 15, 2010 2:37 PM

Former Member
0 Kudos

hi..

Just Add (ZC) with the field.