cancel
Showing results for 
Search instead for 
Did you mean: 

LinkToAction and External Window

Former Member
0 Kudos

Hi

In my application I have many LinkToActions. When user clicks on any of these actions , respective external window should open. I passed parameters between first view and external window view also.

But I found that , first time LinkToAction is working and if user clicks any of LinkToActions for second time no window is displayed.I guess action is disabled.

Even no expection is displayed. Can any one suggest me solution for this.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Write this code on LinktoAction,

IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow("http://www.google.co.in","Google",false);

window.open();

Otherwise do these,

1)Insert LinktoURL UI element

2)Goto Properties of that UI element,set Reference = http://google.co.in

Surely it works,

Regards,

Suresh.T

Former Member
0 Kudos

Please post your code.

Armin

Former Member
0 Kudos

I have 2 applications in same project with 2 different windows and views. All LinkToActions are set in view1(first View).When user clicks on any LinkToAction links user will be able to see respective external window(2nd window).This external window is in 2nd application(2nd component) of same webdynpro project.

Problem is when user clicks on first time(any of Links in first view) respective window is opened. But if user tries to select any of links for second time action is automatically disabled.If I refresh whole browser again I am able to see actions of LinkToAction UI elements.

When try to use external URL like www.gogole.com in action(instead of window in another component) , its perfect and all LInkToActions are working properly without refresh.

My DoModify Code in first view


 public static void wdDoModifyView(IPrivateCalview wdThis, IPrivateCalview.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
  {
    //@@begin wdDoModifyView
//Passing Parameters to Popup window using LinkToAction
		
	if(!firstTime)
	{	view.resetView();	
		
	}
		try{
		IPrivateCalview.IOutputElement row = wdContext.currentOutputElement();
			IWDLinkToAction linkToAction =
				(IWDLinkToAction) view.getElement("ShipmentLinkToAction");
			linkToAction.mappingOfOnAction().addSourceMapping(
				"nodeElement",
				"row");
				
			IWDLinkToAction ProcessOrderlinkToAction =
				(IWDLinkToAction) view.getElement("ProcessOrderLinkToAction");
			ProcessOrderlinkToAction.mappingOfOnAction().addSourceMapping(
				"nodeElement",
				"row");

			IWDLinkToAction ReceiptlinkToAction =
				(IWDLinkToAction) view.getElement("ReceiptLinkToAction");
			ReceiptlinkToAction.mappingOfOnAction().addSourceMapping(
				"nodeElement",
				"row");

			IWDLinkToAction TankTransferlinkToAction =
				(IWDLinkToAction) view.getElement("TankTransferLinkToAction");
			TankTransferlinkToAction.mappingOfOnAction().addSourceMapping(
				"nodeElement",
				"row");
		}
		catch(Exception e)
		{
			wdThis.wdGetAPI().getComponent().getMessageManager().reportException(e.getLocalizedMessage(), false);
		}

		//** End of Passing Parameters to Popup window using LinkToAction

    //@@end
  }

Action in First View. Similarly there are 2 more actions.


 public void onActionSelectShipmentImage(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.calenderdashboardapp.wdp.IPrivateCalview.IZsummaryElement row )
  {
    //@@begin onActionSelectShipmentImage(ServerEvent)

		//Setting Action parameters to Current Context on Clicking of Shipment Image
		//These elements are mapped into PopUp window

		wdContext.currentContextElement().setSlotNo(row.getZslotno());
		wdContext.currentContextElement().setTime(row.getZtime());
		wdContext.currentContextElement().setType("SH");

		wdThis.ExternalWindow();
		
    //@@end
  }


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

		//	Get component's message manager
		IWDMessageManager messageMgr = wdComponentAPI.getMessageManager();
		//	Get name of deployable object this component belongs to
		String deployableObjectName =
			wdComponentAPI.getDeployableObjectPart().getDeployableObjectName();
		Map urlParameters = new HashMap();
		//	get URL parameter value entered by user, stored in context attribute
		//	‘UrlParamValue’
			
		urlParameters.put(
			"SlotNo",
			wdContext.currentContextElement().getSlotNo());

		urlParameters.put("Time", wdContext.currentContextElement().getTime());

		urlParameters.put("Type", wdContext.currentContextElement().getType());

		try {
			//	Get deployable object part of target application.
			//	Precondition: assume, that other application belongs to the same
			//	Web Dynpro Project (Deployable Object)
			WDDeployableObjectPart deployableObjectPart =
				WDDeployableObject.getDeployableObjectPart(
					deployableObjectName,
					"Details",
					WDDeployableObjectPartType.APPLICATION);
			//	Get target URL based on deployable object part and URL parameters
			
			// Sending parameters to external window
			
			String urlToTargetApp =
				WDURLGenerator.getApplicationURL(
					deployableObjectPart,
					urlParameters);
		
			//	Fire exit plug to target URL via IPublic-API of used interface view
			//	controller
			wdThis
				.wdGetCalenderDashBoardCompInterfaceViewController()
				.wdFirePlugCalenderExit(urlToTargetApp);

			IWDWindow window =
				wdComponentAPI.getWindowManager().createExternalWindow(
					urlToTargetApp,
					"Details",
					true);

				window.setWindowSize(500, 250);
							window.setWindowPosition(400, 300);
							window.setTitle("Details Window");
			window.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
						window.removeWindowFeature(WDWindowFeature.MENU_BAR);
						window.removeWindowFeature(WDWindowFeature.STATUS_BAR);
						window.removeWindowFeature(WDWindowFeature.TOOL_BAR);
						
			
			window.open();


		} catch (WDURLException e) {
			messageMgr.reportException(e.getLocalizedMessage(), false);
		} catch (WDDeploymentException ex) {
			messageMgr.reportException(ex.getLocalizedMessage(), false);
		}


    //@@end
  }

Former Member
0 Kudos

Hi

Can any one have a look at my code and suggest me the solution. My observation is when linkToAction is clicked on main view external window is opened but LinkTo Action are not working for second time.

If code is required to analyse I can email them.

former_member751941
Active Contributor
0 Kudos

Hi Radhakrishna,

Mail it.

Regards,

Mithu

Former Member
0 Kudos

Thanks for response. I mailed you my complete code.Please check your mail.

Former Member
0 Kudos

Hi,

Try removing the view.resetView().

Resets the view's layout (i.e. its tree of view elements) to the initial state

declared at design time.

That is, all dynamic modifications to the view layout are thrown away and

the view returns to the state it was in when it was initialised.

Regards

Ayyapparaj