cancel
Showing results for 
Search instead for 
Did you mean: 

SFP Replacing 0 with Spaces

Former Member
0 Kudos

Hi,

I have fields in a table in a form created using SFP. When these fields have 0 or 0.0 I do not want to print any values, I just want a space to print. I've tried numerous attempts using PATTERN without any success. The fields in the interface defines these fields numeric and/or decimal.

Any help would be appreciated.

Helen

Accepted Solutions (1)

Accepted Solutions (1)

koolspy_ultimate
Active Contributor
0 Kudos

try this code

temp = your field


Replace all Occurrences of '0.0' in temp with space.

Former Member
0 Kudos

Hi,

Take a variable of type c with length same as your original variable (If original variable have 10 charactes and two decimal with sign then declare new vriable text_new of type char13).

Note : this TEXT_NEW should be declared in global definition of smartform type char13.

Now take a program logic just befor this text being printed and assign value to this new variable and in program logic write a condition

clear text_new.
text_new = original_value   " assigned original value
 if text_new is initial.
 text_new = space.
endif.

Now print this new variable.

It should definitly resolve your issue.

Please try and confirm.

Regards,

Umang Mehta

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

first you do the coding as below

Replace all Occurrences of '0.0' in <variable> with space.

then

Before writing in the form you assign that value to character field

then from that character field you write into the form(text field)

Former Member
0 Kudos

I was hoping to find a solution in the form itself using FormScript of Java Script. I ended up defining the field as char and clearing prior to moving it to the table or moving in the numeric value if GE 0.

Thank you for all the good suggestions.

Former Member
0 Kudos

Both of these solutions work if I'm working with ABAP only but the value after it is replaced with spaces is passed to a form which is developed using SAP SFP Adobe LiveCycle. Once the value is passed to the form I think the form by way of how the field is defined is changing the values to zeros instad of spaces. I believe I have to use PATTERN or FormCalc in tcode SFP to change the field from zero to spaces.

I did a test in my form and used the following FormCalc function to replace the value in a field and it works.

$record.MISCFIELDS.WS_TESTFIELD = Replace($data.data.MISCFIELDS.WS_TESTFIELD, "DOG", "COW")

I think the issue with the field I'm having a problem with is the fact that it is a field within a table. If someone can provide guidence on how to use PATTERN or the syntax for the above statement when trying to reference a value in a table I think that would solve my problem.

Regards,

Helen

Former Member
0 Kudos

Hi,

The field you are defining in SFP to display numeric value, must be having some data type.

You change the data type as type character as I think it is of type numeric and hence at the time of form printing, it is taking initial value as 0, if you will take a variable with character type then will take initial value as space.

Please check and confirm.

Regards,

Umang Mehta