cancel
Showing results for 
Search instead for 
Did you mean: 

Change the color of a table field in interactive form

Former Member
0 Kudos

hi all,

I have a view in which there is a interactiveform form1 with a table1 in it.

I wanna to know how to make the field displayed with different color according to their value.

And how to make value = 0 not displayed.

I know there is a method fillcolor, but where should I call this method?

In wdInit? How can I access the object Form1 with java code?

Could somebody give me a idea?

Thanks a lot

Yimin

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Reema thanks for your reply.

but I work in web dynpro java , not abap.

former_member189058
Active Contributor
0 Kudos

The code that I have given you is on the interactive form... in FormCalc language. This has nothing to do with WEb Dynpro ABAP or JAVA...

You may use this code irrespective of whether you are working in ABAP or JAVA.

Just open the interactive form, select the required UI element and write the given script in the script editor.

Select the initialize event.

Regards,

Reema.

former_member189058
Active Contributor
0 Kudos

Hi yimin,

Open the form in transaction SFP.

Select the datarow of the table from the heirarchy palette.

Write the foll script in the initialize event of the datarow of the table.

Language FormCalc

For Color:


if ($.field1.rawValue == "A") then
  $.border.fill.color = "220,220,220"
elseif ($.field1.rawValue == "B") then
  $.border.fill.color = "120,120,120"
endif

In order to hide a row if column value is 0


if ($.field1.rawValue == 0) then
  $.presence = "hidden"
  $.relevant = "-print"
endif

Regards,

Reema.

former_member189058
Active Contributor
0 Kudos

You can also write the code in javascript:


if ($.field1.rawValue == "A")
{
  $.border.fill.color = "220,220,220";
}
if ($.field1.rawValue == "B")
{
  $.border.fill.color = "120,120,120";
}

I am not much aware of javascript

I am not aware whether the Equal to operator is == or just =

Reema.