cancel
Showing results for 
Search instead for 
Did you mean: 

De-activate a toolbarbutton in SALV_WD_TABLE

matteo_montalto
Contributor
0 Kudos

Hi all gurus,

I need to remove the button Print Version from the toolbar of WD SALV_WD_TABLE, view VIEW_TABLE.

I found out this sketch of code in SCN, looking for a solution:

DATA:

        lr_if_controller  TYPE REF TO iwci_salv_wd_table,

        lr_cmdl           TYPE REF TO cl_salv_wd_config_table.

* get reference to the ALV model

  lr_if_controller = wd_this->wd_cpifc_alv( ). "supposed your reference is called alv

  lr_cmdl = lr_if_controller->get_model( ).

* disable print button

  lr_cmdl->if_salv_wd_std_functions~set_pdf_allowed( abap_false ).

The problem is that in the view VIEW_TABLE, under the property tab, I can see the entry I attached on the post.

Basically,"Component Use" field is empty.

So, how should I get the ref. to the view controller interface?

lr_if_controller = wd_this->wd_cpifc... ?

Could anyone help me? Thanks

Accepted Solutions (1)

Accepted Solutions (1)

former_member210266
Active Participant
0 Kudos

Hi Matteo

I think you forgot to add the interface controller of the ALV in the Properties tab.You can add it.

Hope I got your problem right.

Regards

Swati

matteo_montalto
Contributor
0 Kudos

Hello Swati and thanks for your support,

The screenshot is taken from the standard SALV_WD_TABLE.... is there the interface controller needed?
In the meantime, I've seen from the Web page right-click on an ALV button that there's a sort of "stack" on embedded views/windows. Here it is:

So I tried enhancing the WD POWL_TABLE_COMP , specifically the view TABLE_DATA; I wrote the above code and I get a dump at

lr_cmdl = lr_if_controller->get_model( ).

The error is:

"Data no longer available when SALV_WD_TABLE GET_MODEL called "

Googling a bit, it seems the problem is related to a missing binding between contexts ... but since all the application and WD Components are standard, I'd prefer not to modify any std. behaviour.


former_member210266
Active Participant
0 Kudos

Yes, the interface controller is needed. As SALV_WD_TABLE is  a used c omponent, so in order to use its methods like get_model, you need to first get the reference of the interface controller by

  lr_if_controller = wd_this->wd_cpifc_alv( ). "supposed your reference is called alv

And when you add the interface controller  to the properties tab of the controller, a method gets created automatically namely wd_cpifc_<component usage name> in the controller to fetch the interface controller reference. Then using the reference, you can use any interface methods you want.

I hope its clear.


matteo_montalto
Contributor
0 Kudos

Quite clear, thanks. The problem relies not in the wd_cpifc_alv( ) call, which returns correctly a reference to iwci_salv_wd_table object.

The problem is the get_model( ) call which fails with the above cited error.

I tried to follow in debug that method call, the problem arises here:

"check application data is available

   if me->r_data_controller->is_supplied( ) ne abap_true.

     "terminate processing, since it makes no sense

     raise exception type cx_salv_wd_nc_program_error_ui

       exporting

         textid = cx_salv_wd_nc_program_error_ui=>data_invalid

         object = 'SALV_WD_TABLE'

         key    = 'GET_MODEL'.

   endif.

Here, r_data_controller is NOT supplied, then the exception.

As I read in other threads, the problem seems related to a missing binding between DATA node in interfacecontroller for the ALV and a Context  ( in componentController or in view?).

However, since no DATA node exists on both COMPONENTCONTROLLER and VIEW, I created it via enhancement from interfaceController's one via "Copy and map" feature from se80.

But nothing changed

former_member210266
Active Participant
0 Kudos

Since you are using an ALV, then there must be some data to be displayed in the ALV that you might have stored in the form of Context node.Now, the standard procedure is to have a node which stores you data with cardinality 0.n (its not necessary that the node name should be DATA) , and then map it to the DATA node of the ALV component in the component usage of the ALV component. Its called the reverse mapping. You can see the clear steps in some tutorial if you want. May be the problem is because of this missing step.

kutjohn
Active Participant
0 Kudos

Hi,

You need to bind the DATA node of the interface controller to the node of the context that you need to display in the ALV table.

This is the DATA node that you should bind with the desired node in your component controller context or view context.

Make sure that the node that you are binding has the cardinality as 0-n

Answers (2)

Answers (2)

former_member217546
Participant
0 Kudos

Hi,

I think you are finding the Component Use in the view of component of SALV_WD_TABLE.This is standard one.Please check in your component-view whether you incorporated component and interface component of SALV_WD_TABLE.

Former Member
0 Kudos

Hi Matteo,

I can see in the screen shot taht you forget to add the interface controller of the ALV in the component usage of view. So there wont exist method wd_cpifc_<alv used comp> in your view controller. Please also share the interface controller and your problem will be solved.

Regards,

Vishu Agarwal