cancel
Showing results for 
Search instead for 
Did you mean: 

Transfer HTML template's input value to javascript variable

Former Member
0 Kudos

Hi,

I would like to execute SAP transaction as a new window in IAC objet which is composed of template and MODULE POOL.

I transferred personnel number to javascript function using `PERNR-PERNR`. But without PAI, I can't transfer changed value. For now user must hit enter to transfer another value since PBO and PAI. Is there any way not to hit enter key ?

For example, I know general web form supports this function. But I need to use search help at this input value. That's why I can't use form and input clause.

And I know SAP support ~searchhelp function. That does not look good to user.

To sum up, Problem is to transfer HTML template's SAP input value to javascript value. I transfer value `PERNR-PERNR` for now.

What I would like to transfer is the webguiform's value instead of `PERNR-PERNR` like webguiform.PERNR-PERNR[1].value.

This value "webguiform.PERNR-PERNR[1].value" comes up when I see template's source.

Thanks in advance.

Template source as follows:

`include(~service="system", ~language="", ~theme="dm", ~name="TemplateLibraryDHTML.html")`

`SAP_TopInclude()`

`function WebPathPrefix()

if (strncmp(wgateURL(), "/cgi-bin", 😎 == 0)

return("cgi-bin")

else

return("scripts");

end;

end;`

<html>

<head>

`SAP_PageTitle()`

`SAP_Stylesheet()`

`SAP_JavaScript()`

<style>.{font-size: 12pt;}</style>

<script language="JavaScript">

function new_win(){

var w_address ;

w_address = "http://`HTTP_HOST`/`WebPathPrefix()`/wgate/webgui/!?transaction=ZRXHR432_EP&~OkCode=EXEC&PERNR-PERNR=" + "`PERNR-PERNR`" ;

w_address = w_address + "&client=`write(client)`&language=`write(language)`" ;

win_prop = "left=0, top=0, height=600, width=800, status=no, menubar=no, resizable=yes, fullsize=yes, channelmode=no, scrollbars=yes";

window.open(w_address,'',win_prop);

};

</SCRIPT>

</head>

<body `SAP_BodyAttributes()` onload="`SAP_OnloadJavaScript()`">

`SAP_BodyContentBegin()`

`SAP_FormBegin()`

`SAP_DynproLayerBegin(002,001,010,001)`

`SAP_Button("EXEC", <b>onclick="new_win();")`</b>

`SAP_DynproLayerEnd()`

`SAP_DynproLayerBegin(004,004,015,001)`

`SAP_Label("PERNR-PERNR")`

`SAP_DynproLayerEnd()`

`SAP_DynproLayerBegin(024,004,015,001)`

`SAP_Inputfield("PERNR-PERNR")`

`SAP_DynproLayerEnd()`

`SAP_FormEnd()`

`SAP_BodyContentEnd()`

</body>

</html>

Message was edited by: Sunki Bae

Message was edited by: Sunki Bae

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hiya,

I can't see why this shouldn't work. However, I think the problem might be that you are using the SAP include templates for your styling (ie SAP_BUTTON), because these will automatically trigger the PAI for you.

Have you tried developing a template in Classic style for this to prove if it works?

Regards,

Michael

Former Member
0 Kudos

Thanks for your reply !

I've been using Tempalte as a classic way like <input type="text" value="`PERNR-PERNR`">.

What I am curious is SAP TEMPLATE STYLE can cover this scripting or not.

When the page is generated dynamically,

it shows " webguiform.PERNR-PERNR[1].value " .

So I would like to know this variable is usable or not.

Thanks in advance.

Former Member
0 Kudos

> Thanks for your reply !

> I've been using Tempalte as a classic way like <input

> type="text" value="`PERNR-PERNR`">.

>

and did you manage to get it working?

> What I am curious is SAP TEMPLATE STYLE can cover

> this scripting or not.

> When the page is generated dynamically,

> it shows " webguiform.PERNR-PERNR[1].value " .

> So I would like to know this variable is usable or

> not.

>

I assume you mean if you can pick up webguiform.PERNR-PERNR[1].value as a DOM object.

Can't you just simply call a JS function in an event that fires when you submit your FORM, then passes it to your JS variables and then launches it in a new window. However, you need to think what you do with the ITS session that you have left, as on the R/3 side the transaction is still displaying something different.

But I am still not 100% sure if I understood what you mean. Do you maybe have some more coding examples?

Regards,

Michael

Former Member
0 Kudos

Yes I would like to catch DOM object value.

I tried to catch webguiform.PERNR-PERNR[1].value , but it did not work.

That is full source code. I just need to pass value to a new window. I don't care previous session.

Thanks