cancel
Showing results for 
Search instead for 
Did you mean: 

Value transfer from Javascript variable to HTML Business Dynpro field

Former Member
0 Kudos

Hi there,

i am working with ITS, Version 6200.1019 on an 4.6C Backend. We have running several selfwritten services there.

At least i have no idea to solve the following problem:

On one Frame (subscreen) i put out a list of characteristics with short text via steploop. To give the user more information, a hyperlink on the short text may open a window with the belonging long text.

So far so good.

I'll define a function to open a window in JavaScript, cause set the dimensions of window an keep of the toolbars and so on.

<script type="text/javascript">

var zahl;

function New (value) {

MeinFenster = window.open("`wgateURL(~OkCode="=SHLXT", G_WERT.name=value)`", "window", "width=250,height=150,scrollbars");

MeinFenster.focus();

}

</script>

Inside my form i've the steploop:

`repeat with j from 1 to LINES.value`

<a href="javascript:New(`j.value`)">`Characteristic[j].value`</a>

`end`

But i can't get the right Value to the Dynpro. I try also to give the j.value as an parameter back to the function. This will be the index of my internal table so that i would get the right information.

I get the index value to the parameter, but not this parameter into my HTML Business. The value of G_WERT always is initial.

How can i fill the Dynpro field with the right value inside the URL HTML Business Expression?

Thank you for your response and help

Thorsten Tappe

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Thorsten,

First, you don't have to use the ".value" attribute to get the value of a variable. Just "LINES" will do.

Second, the ".name" attribute is read-only, you should not be able to change it or set it.

Third, it is a good idea to specify the end index with a "Characteristic.dim", if "Characteristic" is indeed your array. This way you don't need to keep "LINES" variable synchronized with "Characteristic" array size.

Forth, the real answer. It is not possible to use JavaScript variables in BusinessHTML statements because BHTML is processed on the server, long before JavaScript variables get their values.

But nevertheless, you can pass the information to the ITS from JavaScript. Just keep in mind that BHTML is already executed in your JavaScript code. So, in your example please do the following:

MeinFenster = window.open("`wgateURL(~OkCode="=SHLXT")`&G_WERT=" & value, "window", "width=250,height=150,scrollbars");

I hope this will solve your problem.

Thank you for using the ITS!

Kind regards,

Alexander Pohoyda

SAP AG, ITS Development Team

Former Member
0 Kudos

Hi Alexander,

Thanks for your advice. At least i would not work. But i solve the problem on another way. I'll transfer the row_count over the javaScript Function variable and run inside the javaScript Function the loop again untill the to values (transfered value and new row_count ) equal.

Now i've all my fields and their values for transporting to the newWindow.

Kind Regards

Thorsten Tappe

Answers (1)

Answers (1)

gregorw
Active Contributor
0 Kudos

Hi Thorsten,

could you provide the HTML Sourcecode which is generated by your program?

Regards

Gregor

Former Member
0 Kudos

Hi Gergor,

thank you for your reply. The main problem cause in the transfer of the selected value by clicking the hyperlink of the short text. Anyway the variable zahl contains the correct index of the table.

See my commentary inside the JavaScript function definition which describes the problem at that point.

And now,

here comes the whole source code of the template:












`include(~service="ymvk", ~theme="99", ~language="", ~name="yosmvk_8000.html")`
var zahl;
function NeuFenster (zahl) {

MeinFenster = window.open("`wgateURL(~OkCode="=SHLXT", G_LLINDEX.name=2)
// this results allway in displays the 2. row of the table
// want to put something like:
// MeinFenster = window.open("`wgateURL(~OkCode="=SHLXT", G_LLINDEX.name=zahl)
// But it would'nt work, because the JavaScript variable zahl is not known as a HTML Business variable or field
// G_LLINDEX is inside the R/3 Application a global
// variable type sy-tabix.

`", "Zweitfenster", "width=250,height=150,scrollbars");

MeinFenster.focus();

}





<!-- Fehlermeldung -

-


`if (~messageLine != "")`







`'~messageLine'`


`end`

<!-- Statusanzeige -

-


















`if (G_MWERT.value !="")`

`else`

`end`


`#1510m_Titel`
 

  `#1510m_merkmal`

 

`G_ATBEZ.value`

  ( `G_MERKMAL.value` / `G_MWERT.value` )

 

`G_ATBEZ.value`

  ( `G_MERKMAL.value` )

<!-- Funktionen -

-










`if (G_SHOW.value =="X")`



`if (G_MHIER.value !="")`



`else`

`end`


`if (G_MHIER.value =="X")`
`if (G_E.value !="0")`

`end`
`end`

`end`

<!-- Merkmalwerte -

-















<!<td>`'%#AUTOTEXT008'.label`</td>>

<a href="javascript:NeuFenster(`j.value`)">`MERKMALWERTE-ATWTB[j].value`</a>










`end`

 `MERKMALWERTE-PRICE[j].value`  

`MERKMALWERTE-ZU_AB[j].value`

`MERKMALWERTE-YVBEL[j].value`





**********************************************************

If the transport into the Dynpro field works correct, the R/3 puts the new window with the Long text.

Hopefully this may help You to get help me,

Regards

Thorsten

gregorw
Active Contributor
0 Kudos

Hi Thorsten,

perhaps Alexander's answer has helped you already. But could you provide me the source which is created by ITS out of the source you've posted. I want to see how the values are filled.

Regards

Gregor