This website is not affiliated with, sponsored by, or approved by SAP AG.

Text (number) formatting for output

Development SAPscript/ Smartforms

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Text (number) formatting for output

Postby goughandrew » Wed Feb 23, 2011 5:07 am

Hi All,

We use a table in SE16 to store some figures accross 3 columns. At run time we pull these figures in appropriate to the contract, so the figures vary from 000 to 100 as they are percentages. Currently i'm reading them in and outputting as &variable(Z)& to omit the leading Zero's, but the customer want's to see a '0' where there is nothing to pay (0%).

Is there a way to do this simply?, as if i remove the (Z) from the end of the variable output, I see 80% as 080% which isn't ideal, and 0% as 000%. I could loop through and replace any variable's that are INITIAL with a single '0', but how do i get around the leading zero's problem?

Thanks,



Andy
goughandrew
 
Posts: 2
Joined: Wed Feb 23, 2011 4:56 am

Re: Text (number) formatting for output

Postby goughandrew » Wed Feb 23, 2011 5:33 am

UPDATE:

Tried the following code:

IF fee IS INITIAL.
fee = '0'.
ELSE.
SHIFT fee LEFT DELETING LEADING '0'.
ENDIF.

Which gets me around the problem of leading 0's where the fee is populated with a number other than 0, however when it is 0, my output is 000 due to the field. Is there anything i can do short of conditionally outputting a static text if the variable is blank?
goughandrew
 
Posts: 2
Joined: Wed Feb 23, 2011 4:56 am


Return to SAPscript/Smartforms

Who is online

Users browsing this forum: No registered users and 3 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.