Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Hiding a table column for a particular condition

Hello,

I have defined a table (flowed) with 7 columns. I want to hide the 6th column (type Decimal field) completely if a condition is True. This condition is passed to the Form from an ABAP program as an import parameter of the Form Interface.

I've written a FormCalc Script on that particular column cell which is:

if ( $.rawValue == null or $.rawValue == "" ) then
  $.presence = "hidden";
endif

This works fine except the column header is still displayed on the form as a result the format of the table has gone wrong and it looks weird.

Last column header "Advertised" should be shifted left to replace the 6th column header - As you can see the values of the 6th column are hidden but the column header is still displayed. I was unable to put any script on the column header as it is a type Text field.

Has anyone had a similar problem like this in the past? I know I can use Alternatives->True/False in the form context but I don't want to go there if there is something simple which I'm missing. Any ideas?

Thanks!

Sougata.

Tags:
Former Member
Former Member replied

Continued to have the same problem that Formcalc script did not work from page 2 onwards.

The right way to go about this is to create an Alternative in the Context of the data table then set the Alternate Condition via a variable which is set at the Code Initialization event of the form Interface. Within the Alternative we can then Deactivate the required columns within the True & False condition.

The approach to insert client side scripting on a table column header in order to hide it is incorrect and thus should be avoided.

Note that steps 2 & 3 of the above post should be avoided - Step 1 is however required to make the Alternative work.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question