Skip to Content
avatar image
Former Member

ALV + webdynpro

Hey all,

I made a simple Web Dynpro application that does the following:

//example: User gives in name of a xbox-game, clicks on search and then he gets the info in an ALV table...

This works all fine.

.but I would like the user to be able to click on the game he wants (in the alv table) and that he can order this..

so I want to know what the user selected in the alv-table and use this information...

I have searched a lot, but haven't find anything that I understand or can use...

Maybe other ideas to make a sort of a product-ordering-program? (simple,little version....)

Hope someone can help me...

Kind Regards,

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 08, 2010 at 03:25 PM

    Can be done in 2 ways:

    a) You create a button( function ) on ALV toolbar named as Order, and when user selects the ALV row and click on Order button required functionality is triggered

    b) Other way could be to create a button " Order" in each row of a ALV ( Button Column ), and then on press of button do the user action.

    I would prefer option 1, to implement this, you can read the lead selected element from the context node bound to ALV ( check the method of interface if_wd_context_node ), to create button on ALV you have to write a code something like this

    *-----create details button for ALV
      LR_FUNCTION_SETTINGS->IF_SALV_WD_FUNCTION_SETTINGS~CREATE_FUNCTION(
        EXPORTING
          ID     = 'BTN_DISPLAY_DET'
        RECEIVING
          VALUE  = display_function ).
    
    * set button and tool tip text
      LV_BUTTON_TEXT = WD_ASSIST->IF_WD_COMPONENT_ASSISTANCE~GET_TEXT( '007' ).
    
      CREATE OBJECT lo_own_button.
      lo_own_button->set_text( LV_BUTTON_TEXT ).
    
      LV_BUTTON_Tooltip = WD_ASSIST->IF_WD_COMPONENT_ASSISTANCE~GET_TEXT( '008' ).
      CALL METHOD LO_OWN_BUTTON->SET_TOOLTIP
        EXPORTING
          VALUE = LV_BUTTON_Tooltip.
    
      display_function->set_editor( lo_own_button  ).

    data declaration are as follows:

    DATA: display_function TYPE REF TO CL_SALV_WD_FUNCTION,

    lo_own_button TYPE REF TO cl_salv_wd_fe_button.

    Once you have created you own button you can create an event handler for ON_FUNCTION event of ALV and based on the button ID r_param->id, you can write the respective code in the block for that button id.

    Hope this helps

    Regards

    Manas Dua

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 08, 2010 at 06:00 PM

    Hi,

    Refer to the below links which will be useful-

    http://divulgesap.com/blog.php?p=Njc=

    http://divulgesap.com/blog.php?p=NzI=

    Hope it helps.

    Cheers,

    Ravikiran

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 09, 2010 at 07:05 AM

    you can create the corresponding column as link to action

    like

    lo_cmp_usage = wd_this->wd_cpuse_alv_isr( ).

    IF lo_cmp_usage->has_active_component( ) IS INITIAL.

    lo_cmp_usage->create_component( ).

    ENDIF.

    lo_interfacecontroller = wd_this->wd_cpifc_alv_isr( ).

    lv_value = lo_interfacecontroller->get_model(

    ).

    *------get object of column to set as link to action

    CALL METHOD lv_value->if_salv_wd_column_settings~get_column

    EXPORTING

    id = 'DOC_NUM'

    RECEIVING

    value = l_column.

    CREATE OBJECT lr_link1.

    CALL METHOD lr_link1->set_text_fieldname

    EXPORTING

    value = 'DOC_NUM'.

    CALL METHOD l_column->set_cell_editor

    EXPORTING

    value = lr_link1.

    *-------hide column chck

    CALL METHOD lv_value->if_salv_wd_column_settings~delete_column

    EXPORTING

    id = 'CHCK'.

    and then create a methode in you view to handle on_click evend of alv

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      To get the selected row from ALV, just use the code wizard( CTRL + F7 ) to read the context node which is bound to that ALV, method get_static_attributes of if_wd_context_node will be generated which will give you attributes corresponding to the selected row of ALV.