on 09-27-2011 6:19 PM
Hi Expert ,
how to set buttons on cell inactive on condition in webdynpro alv
Hi Abhi,
I have done it , but i want to set po line item number as button text,using set_text method i am not able to do that is there any other method ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhi,
LOOP at gt_ekpo into gs_ekpo.
if gs_ekpo-ebelp > '20'.
CALL METHOD LR_BUTTON->SET_ENABLED_FIELDNAME
EXPORTING
VALUE = 'EBELN'
.
CALL METHOD LR_BUTTON->SET_ENABLED
EXPORTING
VALUE = ABAP_False
.
ELSEIF gs_ekpo-ebelp < '20'.
CALL METHOD LR_BUTTON->SET_ENABLED_FIELDNAME
EXPORTING
VALUE = 'EBELN'
.
CALL METHOD LR_BUTTON->SET_ENABLED
EXPORTING
VALUE = ABAP_true
.
ENDIF.
ENDLOOP.
LO_ND_EKPO->bind_table( gt_ekpo ).
this is my code it is right ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you have to create a new attribute BUTTON_ENABLE first
SET_ENABLED_FIELDNAME should be called in WDDOINIT and only once.
This is how you fill your data.
LOOP at gt_ekpo into gs_ekpo.
if gs_ekpo-ebelp > '20'.
gs_ekpo-button_enable = abap_true. " to enable the button
ELSEIF gs_ekpo-ebelp < '.
gs_ekpo-button_enable = abap_false. " to disable the button
ENDIF.
MODIFY gt_ekpo from gs_ekpo index sy-tabix.
ENDLOOP.
LO_ND_EKPO->bind_table( gt_ekpo ).
Hi Abhi,
Can you explain me more how to that .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1. create an attribute in the node which is mapped to the ALV ( BUTTON_ENABLE of TYPE WDY_BOOLEAN )
2. Code to create a button in the ALV cell
data: lr_cmp_usage type ref to if_wd_component_usage.
data: lr_intf_ctrl type ref to iwci_salv_wd_table.
data: lr_model type ref to cl_salv_wd_config_table.
data: lr_column type ref to cl_salv_wd_column.
data: lr_button type ref to cl_salv_wd_uie_button.
lr_cmp_usage = wd_this->wd_cpuse_alv( ). " ALV is component usage name
if lr_cmp_usage->has_active_component( ) is initial.
lr_cmp_usage->create_component( ).
endif.
lr_intf_ctrl = wd_this->wd_cpifc_alv( ).
lr_model = lr_intf_ctrl->get_model( ).
Create column for the button
lr_column = lr_model->IF_SALV_WD_COLUMN_SETTINGS~CREATE_COLUMN( 'BUTTON' ).
create button UI element and set as editor to the new column
CREATE OBJECT lr_button.
lr_button->set_text( 'Button Text' ).
lr_button->SET_ENABLED_FIELDNAME( 'BUTTON_ENABLE' ).
lr_column->set_cell_editor( lr_button ).
3. Your table which is mapped to the ALV have the new attribute created in step 1 BUTTON_ENABLE
Set its value to ABAP_TRUE to enable the button for that particular row
Set its value to ABAP_FALSE to disable the button for that particular row.
Abhi
Create an attribute in the node which is binded to the ALV ( BUTTON_ENABLE of type WDY_BOOLEAN )
use method SET_ENABLED_FIELDNAME of CL_SALV_WD_UIE_BUTTON to bind the attribute to the enable property of the button.
The button will be enabled or disabled based on the value in the attribute at runtime.
Abhi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.