Skip to Content
author's profile photo
Former Member

ALV with user-defined buttons on toolbar in wd abap

Hi All,

I have to create an alv with user defined buttons in wd abap on its toolbar.Could any one tell me in detail about it or provide me with any tutorial based on it.

Thanking you all in advance.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    Sep 17, 2008 at 05:37 AM

    DATA: LR_CMP_USAGE TYPE REF TO IF_WD_COMPONENT_USAGE.

    DATA: LR_INTF_ALV TYPE REF TO IWCI_SALV_WD_TABLE.

    LR_CMP_USAGE = WD_THIS->WD_CPUSE_ALV( ).

    IF LR_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) EQ ABAP_FALSE.

    LR_CMP_USAGE->CREATE_COMPONENT( ).

    ENDIF.

    LR_INTF_ALV = WD_THIS->WD_CPIFC_ALV( ).

    WD_THIS->M_MODEL = LR_INTF_ALV->GET_MODEL( ).

    DATA: LR_FUNCTION TYPE REF TO CL_SALV_WD_FUNCTION.

    LR_FUNCTION =

    WD_THIS->M_MODEL->IF_SALV_WD_FUNCTION_SETTINGS~CREATE_FUNCTION(

    ID = 'ISSUE' ).

    DATA: LR_BUTTON TYPE REF TO CL_SALV_WD_FE_BUTTON.

    CREATE OBJECT LR_BUTTON.

    LR_BUTTON->SET_TEXT( 'Issue/Receive' ).

    LR_FUNCTION->SET_EDITOR( LR_BUTTON ).

    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/101df93f-4b5c-2910-14aa-9eb0338c2110

    Abhi

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Sep 17, 2008 at 07:02 AM

    Hi,

    Please check this code.

    *ALV Component usage
    data: l_ref_cmp_usage type ref to if_wd_component_usage.
    
    l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).
    if l_ref_cmp_usage->has_active_component( ) is initial.
      l_ref_cmp_usage->create_component( ).
    endif.
    
    *Call Get_model() of Interface Controller to set changes to the output
    *table
    
    data: l_ref_interfacecontroller type ref to iwci_salv_wd_table .
    l_ref_interfacecontroller =   wd_this->wd_cpifc_alv( ).
      data:
        l_value type ref to cl_salv_wd_config_table.
    
      l_value = l_ref_interfacecontroller->get_model(
      ).
    
    
    *Add buttons to Toolbar
    data:lr_function type ref to cl_salv_wd_function,
         lr_toggle_button type ref to cl_salv_wd_fe_button,
         lref_toggle_button type ref to cl_salv_wd_fe_a_button.
    
    
    lr_function = l_value>if_salv_wd_function_settings~create_function( id
    = 'SAVE' ).
    
     create object lr_toggle_button.
     lref_toggle_button ?= lr_toggle_button.
    
     lr_toggle_button->set_text( 'Save' ).
     lr_function->set_editor( value = lr_toggle_button  ).

    thanks

    suman

    Add comment
    10|10000 characters needed characters exceeded