cancel
Showing results for 
Search instead for 
Did you mean: 

Web Dynpro java implementation code

gill367
Active Contributor
0 Kudos

Could anybody of you please explain the code written in java for a simple web dynpro application.

I am referring to the code written in the implementation part of a view.

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Sarbjeet

Please check this link

It gives Tutorials & Samples for Web Dynpro Java

https://www.sdn.sap.com/irj/sdn/nw-ui?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d

Regards

Ruturaj

Former Member
0 Kudos

Hi,

As in above posts, those are Callback methods provided by the WebDynpro Framework. You can use them as you needed or you can have your implemented methods which can be triggered by any action (button etc. UI) in your view. It is better that you mention your intention/requirement in thread. Such that it will be easy for anybody to provide you solution.

Regards

Raghu

Former Member
0 Kudos

Hi Sarabjeet,

Please check the following wiki:

https://www.sdn.sap.com/irj/scn/wiki?path=/display/wdjava/methods%252bpresent%252bin%252bthe%252bvie...

It contains the standard explanation for the methods in view and component controller.

Hope it helps.

Regards.

Rajat

Former Member
0 Kudos

In the above code

Method wdInit() -> The code inside this method executed first of loading or execution of you application.

This method is used to write the code if you want to pre populate your screens with some values.

Method public void wdDoExit() -> This Method is called just before you click on exit button.

So mainly this method is used to do some clean up process before you exit the application

Method public static void wdDoModifyView -> This Method is uesd if you want to modify the View at run time.

For example if you want to change some UI at run time then this method can be used.

//@@begin others

IF you want to have some global variables or objects you can write the code between These tags.

//@@end

Method public void onActionGoNext -> These are methods created on click of some button.

So you can define user define actions in this method

Regards

Narendra

Former Member
0 Kudos

Hi Sarbjeet,

1) wdDoInit() - for initilaization (called when view activated)

2) wdDoExit() - for exit (can do tasks on closing of view)

3) wdDoModifyView() - for dynamic programming (dynamic UI Elements, etc)

Kind Regards,

Nitin

Former Member
0 Kudos

Hi Sarbjeet,

public void wdDoInit()
  {
    //@@begin wdDoInit()
    

      	
    //@@end
  }

  //@@begin javadoc:wdDoExit()
  /** Hook method called to clean up controller. */
  //@@end
  public void wdDoExit()
  {
    //@@begin wdDoExit()
    //@@end
  }

  //@@begin javadoc:wdDoModifyView
  /**
   * Hook method called to modify a view just before rendering.
   * This method conceptually belongs to the view itself, not to the
   * controller (cf. MVC pattern).
   * It is made static to discourage a way of programming that
   * routinely stores references to UI elements in instance fields
   * for access by the view controller's event handlers, and so on.
   * The Web Dynpro programming model recommends that UI elements can
   * only be accessed by code executed within the call to this hook method.
   *
   * @param wdThis Generated private interface of the view's controller, as
   *        provided by Web Dynpro. Provides access to the view controller's
   *        outgoing controller usages, etc.
   * @param wdContext Generated interface of the view's context, as provided
   *        by Web Dynpro. Provides access to the view's data.
   * @param view The view's generic API, as provided by Web Dynpro.
   *        Provides access to UI elements.
   * @param firstTime Indicates whether the hook is called for the first time
   *        during the lifetime of the view.
   */
  //@@end
  public static void wdDoModifyView(IPrivateTestTaxonomyView wdThis, IPrivateTestTaxonomyView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
  {
    //@@begin wdDoModifyView
    //@@end
  }

  //@@begin javadoc:onActionSelect(ServerEvent)
  /** Declared validating event handler. */
  //@@end
  public void onActionSelect(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionSelect(ServerEvent)
    //@@end
  }

  //@@begin javadoc:onActionGoNext(ServerEvent)
  /** Declared validating event handler. */
  //@@end
  public void onActionGoNext(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionGoNext(ServerEvent)
    try{
//    Date date = wdContext.currentContextElement().getVa_Date();
//    wdComponentAPI.getMessageManager().reportSuccess("Date is" +date.getTime());
	}catch(Exception ex){
		
	}
    //@@end
  }

  /*
   * The following code section can be used for any Java code that is 
   * not to be visible to other controllers/views or that contains constructs
   * currently not supported directly by Web Dynpro (such as inner classes or
   * member variables etc.). </p>
   *
   * Note: The content of this section is in no way managed/controlled
   * by the Web Dynpro Designtime or the Web Dynpro Runtime. 
   */
  //@@begin others
  //@@end
}