cancel
Showing results for 
Search instead for 
Did you mean: 

How to make ALV table invisible and Visible based on user actions?

Former Member
0 Kudos

Hello All,

I want to make ALV table invisible when there is no data in it. At the same time, when data is present I want ALV table to be visible. I have used the following method for that.

lv_value->if_salv_wd_table_settings~SET_VISIBLE( '01' ) in WDDOINIT.

lv_value->if_salv_wd_table_settings~SET_VISIBLE( '02' ) based on user ACTION.

Though the ALV table is not displayed initialy, its not getting displayed when the data is present.

Please help me regarding this.

Regards,

Yugesh A.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

u can declare one variable of type wdui_visibility and bind the view element of alv to variable.

if table exists data then pass '02' to variable if not pass '01'

Regards

Narendra

saket_abhyankar
Active Participant
0 Kudos

Hi

You can also proceed as follows:

1) Create attribute of type char1 in the context

2) Bind the visibility property of view container UI element ui element with this attribute (Click on the 'Binding' button next to 'visible' property of ui element. A popup will appear with context node details. Select the property created in first step)

3) In code, check the content of the node (to which ALV is bound).

If no record exists in the node

Set the value of attribute created in step 1 to ' ' (space) to make that ALV invisible

else

Set the value of attribute created in step 1 to 'X' to make it visible.

Regards,

Saket.

ChrisPaine
Active Contributor
0 Kudos

Hi,

rather than setting the table like this, why not set the visibility of the view container that you embedded the ALV component into?

Then you can be sure of when the visibility settings will be applied.

I'd recommend using the constants

cl_wd_uielement->e_visible-none

and

cl_wd_uielement->e_visible-visible

also. If for no other reason than to make your code more readable,