Skip to Content

Identify button that call action

Hi all,

I've a action that was fired by two buttons, how to identify what button that call the action?

public void onActionTest(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionTest(ServerEvent)

???

//@@end

}

Regards

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2007 at 04:24 AM

    Hi

    Try to pass different parameter through different buttons,

    may be True from one

    False fro second

    then based on that you can find which button is pressed

    try the link for knowing more how to pass parameter through onAction

    onAction" target="_blank">http://help.sap.com/saphelp_nw04/helpdata/en/60/1f1f056f057d4d962375efd3c92ed0/frameset.htm">onAction Parameter

    Regards

    Abhijith YS

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2007 at 04:28 AM

    Hi,

    Write this code in the "<i>wdDoModifyView()</i>" method:

    //let's say the first button ID is btn1
    IWDButton buttonOne = (IWDButton) view.getElement("btn1");
    
    buttonOne.mappingOfOnAction().addParameter("commandID","btn1");
    
    //let's say the second button ID is btn2
    IWDButton buttonTwo = (IWDButton) view.getElement("btn2");
    
    buttonTwo.mappingOfOnAction().addParameter("commandID","btn2");

    Edit "<i>onActionTest</i>" event handler to add a new parameter to it. Call the new parameter "<i>commandID</i>" and it should be of type "<i>String</i>". Now this will look like:

    public void onActionTest(IWDCustomEvent wdEvent, String commandID){
    //here <b>commandID</b> contains the ID of the button which was clicked
    }

    Regards,

    Satyajit.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      If your IDE already contains the parameter mapping editor, you can do this inside the view designer. Right-click the button in the Outline view and select "Parameter Mapping" to open the editor.

      Armin

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2007 at 04:07 AM

    Hi,

    Most probably it won't be possible to determine this. You need to have a seperate action on button2 and button1.

    Regards,

    Murtuza

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.