cancel
Showing results for 
Search instead for 
Did you mean: 

JavaScript III - window.open()

Former Member
0 Kudos

Hi,

Can somebody share a sample program for the following scenario -

Pass values and display values in a new window, basically using the function window.open(); Appreciate it.

Regards,

V M.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi VM,

Here is the sample program for your scenario -

1. Pass values through URL

window.open ("http://" + Servername + "/xyz/abc.htm?"var1"-"var2"-"+var3,"","width=300,height=200");

hyphen symbol("-") is a separator for the values of var1, var2 and var3.

2. From parent window

opener.document.Appletname.getGridObject().getSelectedCellValue();

Regards,

Anil

Former Member
0 Kudos

Does the applet have to be in the parent window or the pop-up window? Thanks.

Regards,

V M.

Former Member
0 Kudos

If you are passing a value via the URL (ie, http://<servername>/mypage.irpt?MYURLPARAM=somevalue)

then on the popup irpt page, just reference the "somevalue" in squrily braces ( )

Former Member
0 Kudos

My popup window shows up but its not displaying the values. Can somebody tell me what might be wrong? I have the following set up in my JavaScript -

Parent -

function JCOCall1(f){

var Confirmation = f.txtCode1.value;

window.open("ProductionOrderConfirmations-2.htm?"+Confirmation,"new");

}

Popup -

function JCOCall(){

document.GetDataApplet1.getQueryObject().setParam(1, "{Confirmation}");

if(document.GetDataApplet1.executeCommand()) {

document.frmConfirmation.SAPSuccess1.value = document.GetDataApplet1.getFirstValue("OperationQuantity")

document.frmConfirmation.SAPSuccess2.value = document.GetDataApplet1.getFirstValue("QuantityConfirmed")

document.frmConfirmation.SAPSuccess3.value = document.GetDataApplet1.getFirstValue("QuantityScrapped")

}

}

Thanks,

V M.

Former Member
0 Kudos

You can't use the {} within JS blocks.

Instead assign the value in a hidden form field, then reference that form field value in JS.

<input type="hidden" value="" id="hdnValue">

....

document.GetDataApplet1.getQueryObject().setParam(1, document.getElementById('hdnValue').value);

Former Member
0 Kudos

Also make sure the pages are IRPT as Ryan's mentioned in his previous post.

I see you have a .htm out there.

Former Member
0 Kudos

I got this to work now. It works if the pop-up window is an .irpt file and not when I use the .htm extension. Any thoughts? Thanks.

Regards,

V M.

Former Member
0 Kudos

[...|http://help.sap.com/saphelp_xmii115/helpdata/en/Advanced_Topics/Report_Generation.htm]

0 Kudos

Christian,

Thanks for posting the link. I couldn't remember where the irpt definition was contained.

Mike

Former Member
0 Kudos

This works ok now.

Former Member
0 Kudos

here is some details for the web scripting:

DataQuery getQueryObject()

Obtains a reference to the underlying query object that supplies data to the applet. Once a reference is obtained, its properties can be manipulated.

void refresh()

Updates the query to the current time and redraws the applet.

void setPropertyValue(String propertyName, String newValue)

Sets a named value that can be accessed by any applet during the browser session. Once the browser is closed, the value is no longer available. This can be used to create properties that can be passed between Web pages. For example, if you select a batch on one Web page, a new Web page with a detailed list of the materials consumed in the batch could appear. The batch number could be placed in a session parameter on the main page and picked up by the dialog box. These properties can also be used to pass values to SAP xApp Manufacturing Integration and Intelligence (SAP xMII) reports.

String getPropertyValue(String propertyName)

Gets a named value that was set using the setPropertyValue method. This value can be used to set the applet.

void showDetail()

Displays an HTML page in which the raw data associated with the current applet is displayed in a table.

void showHelp()

Displays the applet help.

void saveAsCSVFile()

Initiates a transfer of the raw data associated with the current chart to a local CSV file.

void showXMLDetail()

Displays an HTML page that contains an XML view of the raw data associated with the current applet.

void showDetailUsingGet()

Displays an HTML page in which the raw data associated with the current applet using HTML Get is displayed in a table.

String saveImage()

Gets the URL reference to the GIF representation of the image displayed by the applet; it is only supported by iGrid, iChart, and iSPCChart.

void showStatistics()

Displays an HTML page that contains the statistical metrics associated with the chart. It is only available when the underlying query is from a Tag connector.

void showCurrent()

Displays an HTML page that contains the values associated with the chart. It is only available when the underlying query is from a Tag connector.

boolean getSelectionEventEnabled()

void setSelectionEventEnabled(boolean newValue)

Gets and sets the property that enables a selection event on an applet. This method enables or disables the event through Web page scripting.

boolean getUpdateEventEnabled()

void setUpdateEventEnabled(boolean newValue)

Gets and sets the property that enables an update event on an applet. This method enables or disables the event through Web page scripting. You can use it to synchronize the scrolling of multiple applets.

Object createColor(String strColor)

Controls colors at runtime. The value of the strColor parameter can be a color name or an HTML color string in the format #RRGGBB. The returned color object can be assigned to a color property in an applet.

String colorToString(Color cColor)

Controls colors at runtime. A color property of an applet property can be converted to a string and used in HTML.

String encodeURLItem(String strItem)

Takes a string as an input and the URL encodes the string so it can be passed over the URL command line. The returned string has spaces and other unrecognized attributes replaced with URL codes.

String formatDate(String strDate, String fromFormat, String toFormat)

Reformats date/time strings. The parameters include the incoming date/time string, the incoming format (so the string can be properly parsed), and the outgoing format. The resulting date/time string is returned.

String formatNumber(double dValue, String sFormat)

Returns a string for the value in the specified format.

Former Member
0 Kudos

hi, v m

i suppose ur case a in the xmii, and if it is

so u can just code like this:


 YourApplet.setPropertyValue("value",var);

and when window.open() is executed, u can get the value like this:


YourApplet.getPropertyValue(var);

have a nice day

Former Member
0 Kudos

Hi,

If you are working on an xMII session, you can first set the values as sessions variables from parent window and then fetch them back on the new window.

Else if, you just want to pass it through javascript, you can add the values as the url parameters. For example, the url in window.open() would look like something like this -

http://localhost/MyPage.html?variable1=value1&variable2=value2

Hope it helps.

Regards,

Ankit Jain.