Application Development 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: 

How do I suppress zero values & also maintain the field len in SAP Script?

Former Member
0 Kudos
398

Hi,

I am working on SAP Script.

How do I suppress zero values & at the same time maintain the field length?

Eg:

&wa_itab-d_amt(I)& (say length of d_amt is 16) would suppress the initial value. but the field length is not maintained.

How do I achieve this?

Thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
196

Have you tried with

&wa_itab-d_amt(16I)&

if it is not working then try like this

/: if &wa_itab-d_amt(C)& eq '0.00'

/ &space(16)&

/: else

&wa_itab-d_amt(16)&

/: endif

7 REPLIES 7

Former Member
0 Kudos
196

Hi,

Use Avoid preceding Zeros option.

like: &wa_itab-d_amt(Z)&

and put the value into other and then use Left or Right justified options.

Regards,

Rama.

0 Kudos
196

I think you have not understood my question.

My question is that I would like to suppress not just leading zeros but even if the value is 0.00. I can achieve this by using (I).

Secondly, I would like to maintain the field length as well, ie: if I suppress the value 0.00 using (I), I shld be able to maintain the length of the column as well.

Former Member
0 Kudos
196

why would you want to maintain field length? its not neccessary for anything.

0 Kudos
196

Hi Florien,

I am using this for a tabular report.

So if a row column has value say 123456.78 and the next row has the value say 0.00 and i suppress initial value using (I), the width of the second line is smaller and hence the columns alignment is lost.

How do i handle this?

Former Member
0 Kudos
197

Have you tried with

&wa_itab-d_amt(16I)&

if it is not working then try like this

/: if &wa_itab-d_amt(C)& eq '0.00'

/ &space(16)&

/: else

&wa_itab-d_amt(16)&

/: endif

Former Member
0 Kudos
196

well if it´s about positioning and formatting, then i hope you dont work with spaces

well just work with tabulators.

every paragraph format can have its own tabulators, so define yourself a paragraph format with enough tabulators for you output and use ,, between your variables you wish to output.

you dont have to take care anymore for field length then unless they are too long.

e.G. i have paragraph format A1

i have defined 2 tabulatros.

first one at 2 characters left alignment,

second one at 15 characters left alignment.

so in SAP script

/: define &test& = 'hello'

/: define &test2& = 'world'

A1 &test&,,&test2&

would give you


  hello        world

if &test& would be longer than 13 characters (15 - 2) then you got a problem since he wants to print &test2& at character 15 but well there he isnt ready with printing &test&, so the second tab will be ignored an the &test2& will be printed right after &test& is finished just separated by a space.

0 Kudos
196

Hi Florian,

Can u tell me the size of a character in pixels?

Say if i use font 10 and font 8, will the tabulators give the same result in both cases?