Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Display & run a Flex Application in NW7

Former Member
0 Kudos

Hi @ all,

i´ve developed a FlexApplication to read the Bex Analyser favourites to a Flextree an now im trying to display this application in our NW7 portal. The application is connected to SAP throu a BSP-application.

With clicking one node of the tree i want to open an sapWorkbook with, for example tcode RRMXP and a WBID = xyz.

How to manage this problem?

In flex i have the workbookID and the transactionCode, but how to send them to SAPSystem and after that opening a workbook with excel?

8 REPLIES 8

athavanraja
Active Contributor
0 Kudos

check my answer in this thread

Regards

Raja

0 Kudos

First of all: Thx for the fast reply.

The solution from the Link you have postet Durairaj works fine for opening just an ExcelSheet, but i need to open the Workbook with the SapBW options (all Bex Features). Like opening a workbook with the transaction RRMX / RRMXP

Do you have a solution for that problem too?

Former Member
0 Kudos

Hi Daniel,

You can Export content from flex application using JSP file on your N/W server also.

The Flow for this would be, collect the required content in HTML Table format string.

then pass this string as parameter to a JSP page which will open an excel sheet and copy your content to it.

You can also apply table formatting using usual html tags.

Plz find some code snippets for your reference :

Suppose on on click of node you have called for an method which is written in your ActionScript part of Flex Application.

viz. loadContentInExcel(para1,para2)

Definition for this method would be like :

private function loadContentInExcel(para1:String, para2:String):void {

			//Pass the htmltable in a variable so that it can be delivered
			//to the backend script
			var variables:URLVariables = new URLVariables(); 
			variables.htmltable	= convertContentToHTMLTable(para1,para2);
			
			//Setup a new request and make sure that we are 
			//sending the data through a post
			
			var u:URLRequest = new URLRequest("http://XXX.XX.X.XXX:YYYYY/Test_Excel/main.jsp");
			/* In Above Line Replace XXX.XX.X.XXX:YYYYY with <Host IP>:<Port>  */
			
			u.data = variables; //Pass the variables
			u.method = URLRequestMethod.POST; //Don't forget that we need to send as POST
			
			//Navigate to the script
            navigateToURL(u);
        }

private function convertContentToHTMLTable(para1:String, para2:String):String {
        	//Set default values
        	var font:String = 'ARIAL';
        	var size:String = '10';
        	var str:String = '';
        	var style:String = 'style="font-family:'+font+';font-size:'+size+'pt;"';				
        	
        	str = "<table border=1><tbody>";
        	str+="<tr width=\""+100+"\">";
        	str += "<td width=\""+100+"\" "+style+">"+"<B>"+"TransactionCode : "+"</B>"+"</td>";
        	str += "<td width=\""+100+"\" "+style+">"+para1+"</td>";
        	str += "</tr>";
        	str+="<tr width=\""+100+"\">";
        	str += "<td width=\""+100+"\" "+style+">"+"<B>"+"WorkbookID : "+"</B>"+"</td>";
        	str += "<td width=\""+100+"\" "+style+">"+para2+"</td>";
        	str += "</tr>";
        	str+="</tbody></table>";
        	
        	return str;
        }

In main.jsp page mention content type as application/vnd.ms-excel.

In body tag mention out.println(request.getParameter("htmltable").

Hope this will help you..

Regards,

Vivek

0 Kudos

Hi Vivek,

i´ve changed the variable names a little bit an implemented your FlexCode.

But what i have to do inside the jsp file? (sry i´m not very familiar with coding like that

out.println looks like java, but when i want to set in SE80 the <%@page language="java"%>, i get an error because java is not allowed.

A piece of code would help

0 Kudos

I have used JSP on my N/W server with code :

<%@ page language="java" %>
<html>
	<head>
<%@ page contentType="application/vnd.ms-excel"%>


		
	</head>
	<body>
	<%
		String l_htmltable = request.getParameter("htmltable");
		out.println(l_htmltable); 
	%>
	</body>
</html>

This may clear what we are excepting from JSP to do.

Regards,

Vivek

0 Kudos

wow, very fast answer.

Just to be on the save side:

I have uploaded my FlexApplication to an BSP Application an i start it with the FlexBuilder generated html. Both files are in the BSP.

No i created a new page in the BSP, named it "main.jsp" and put your jspCode inside.

When i want to compile the jsp: Error: Pageattribute "java" is no possbile. hmm....?

Is the jsp in the right place? When not, where i have to put it?

0 Kudos

Hi,

If you are using portal then you might be having SAP NWDI.

Create a Web Module in J2EE perspective and create this jsp file in Web Content.

Just deploy on your Server and that's set.

You can access with proper URL.

Regards,

Vivek

Former Member
0 Kudos

I´ve called my SAP Basis Portaladmin an he helped me to solve the problem.

What we´ve done:

- Create a BSP iView and added the FlexApplication to it.

- Created a transaction iView an added the parameters for the Links (tcode / wbid)

Now the BSP iView calls the transaction iView. The transaction iView calls my transaction withe the two params an display me the workbook

For a more detailed solution, contact me.

Thx for all replys