cancel
Showing results for 
Search instead for 
Did you mean: 

Accesing IViewController from ComponentController

Former Member
0 Kudos

Hi all!

I'm calling a BAPI from my component controller, and I'd like to fire an outboundplug (which is located in a view ) from this controller, depending on the result of the BAPI execution.... Is there any way to access the IWDViewController for firing this plug? I've accessed the IWDOutboundPlugInfo object, but I don't konw how to fire it....

Thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ,

Either you can call this BAPI parameter from the view and based on the return value.. you can navigate..

Or raise a event in Component controller.. handle the event in view.. in the event handler .. fire the plug..

U cant access Viewcontroller api here..

Regards

Bharathwaj

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos

Hi Eneko,

Another approach:

1) define interface:


package com.sap.sdn;

public interface ICallBack {
	public void start();
	public void successfulEnd();
	public void failedEnd(Exception e);
}

2) make ICallBack as parameter for method in controller and implement something like this:


  //@@begin javadoc:method()
  /** Declared method. */
  //@@end
  public void method( com.sap.sdn.ICallBack callback )
  {
    //@@begin method()
    try {
		callback.start();
		//do the logic
		callback.successfulEnd();
    }
    catch (Exception e)
    {
		callback.failedEnd(e);
    }
    //@@end
  }

3) In view controller pass inctanse of anonymous class:


  //@@begin javadoc:onActionClick(ServerEvent)
  /** Declared validating event handler. */
  //@@end
  public void onActionClick(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionClick(ServerEvent)
    
    wdThis.wdGetSDNController().method(new ICallBack(){
		public void start() {
		}
		
		public void successfulEnd() {
			wdThis.wdFirePlugOut();
		}
		
		public void failedEnd(Exception e) {
		}    	
    });
    //@@end
  }

Work fine for me ;-).

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

¡Thank you!

Well, I can´t fire the plug directly in my controller, so I'll search for another solution. Maksim' solution looks good, but it's very different from my initial idea, so I have to think about it.

Thank you indeed