Skip to Content
0
May 17, 2013 at 09:32 AM

Parameter passing for actions binded to custom WD elements

40 Views

Hi all gurus,

this should be a basic question but I'm not able to find any explicit documentation on the argument, so I decided to start a thread in order to get things a bit clear... hope you will support me with suggestions and eventually, links to useful docs.

Shortly; I created via dynamic programming two different buttons:

DATA add_to_bid_button TYPE REF TO cl_wd_toolbar_button.

DATA add_to_Bid_choice TYPE REF TO CL_WD_TOOLBAR_BTN_CHOICE.

These buttons have substancially the same meaning; the first is shown when the possible choice is *exactly *one; otherwise, if more choices are determined at runtime, the toolbar button choice one is shown.

Both these buttons are binded to a custom action, say, "FOO": it has an unique parameter which is WDEVENT, TYPE REF TO CL_WD_CUSTOM_ELEMENT.

Now; I'd like to add to the event's parameters two entry, and specifically:


SELECTION , which will be of type /sapsrm/t_cll_wd_soco_workarea

BIDNUMBER, which will be a CHAR10.

The problem is that I don't know how to add these two additional params at runtime and "bind" them to the buttons.

Starting from the simple CL_WD_TOOLBAR_BUTTON; I create it in this way

add_to_Bid_button = cl_wd_toolbar_button=>new_toolbar_button( text = 'Add to Bid' id = 'ADD_TO_BID'

bind_visible = 'ADD_TO_BID_ENABLE'

bind_enabled = 'ADD_TO_BID_ENABLE'

ON_ACTION = 'FOO').


There's however no option to specify that FOO has additional parameters.

For what concerns the button choice, I add dinamically a menù action item for each entry:

CALL METHOD CL_WD_MENU_ACTION_ITEM=>NEW_MENU_ACTION_ITEM

EXPORTING

* BIND_DISABLED_IMAGE_SOURCE =

* BIND_ENABLED =

* BIND_IMAGE_SOURCE =

* BIND_NEEDS_MORE_INFO =

* BIND_START_SECTION =

* BIND_TEXT =

* BIND_TEXT_DIRECTION =

* BIND_VISIBLE =

* DISABLED_IMAGE_SOURCE =

* ENABLED = 'X'

* HOTKEY = E_HOTKEY-NONE

ID = item

* IMAGE_SOURCE =

* NEEDS_MORE_INFO =

ON_ACTION = 'FOO'

* START_SECTION =

TEXT = itemlabel

* TEXT_DIRECTION = E_TEXT_DIRECTION-INHERIT

* VIEW =

* VISIBLE = 'X'

RECEIVING

CONTROL = choice.

.

CALL METHOD ADD_TO_BID_CHOICE->ADD_CHOICE

EXPORTING

* INDEX =

THE_CHOICE = choice

.

Same as before, I can't find a way to specify that each possible chose should trigger FOO with two additional parameters.

So, how can I specify that WDEVENT should contain two additional params? And how to set them dynamically at runtime?

Thanks for your attention and support.