cancel
Showing results for 
Search instead for 
Did you mean: 

ALV + webdynpro

Former Member
0 Kudos

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,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

this remainds me the saying "There are many ways to reach Rome".

I have done something like this.

in your component create a handler method to handle the ALV lead selection .

You have the context which you bind to the DATA node of ALV. So within the event handler method fetch the Attributes you need from your context node.

In my case it is very simple to code.

Former Member
0 Kudos

Thanks for the input, but I'm not quite getting there...

I just need some code that gets the selected data from the alv, and then to show that data and process it further (put it in a table for example)

anyone who can help me..I'm a bit stuck...

Former Member
0 Kudos

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.

Former Member
0 Kudos

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