cancel
Showing results for 
Search instead for 
Did you mean: 

JavaScript code

Former Member
0 Kudos

Hi All,

I have a function on JavaScript and it doesn't work. Do you have any idea?

data.#variables[0].abweichungSummen - (JavaScript, client)

function abweichungSummen(sPar1, sPar2, sPar3){

if ( sPar1 != sPar2 + sPar3 ){

return sVar1 = "1" }

else {

return sVar1 = "0" }

}

// *****************************************************************

Now I call it in my Sub form

var curp = $layout.page(this);

var sErgebnis = abweichungSummen(G_SUMME_NETTO_GES, SUM_AKT_MON, SUM_KOR_MON);

if ( sErgebnis == "1" ){ this.presence == "hidden" }

Accepted Solutions (0)

Answers (1)

Answers (1)

prajeshdesai
Contributor
0 Kudos

Yes it's not gone a work, because if you create function on event then it's visibility is limited to that event only.

So if you want to add global function, follow below steps:

Step 1). Right click in Hierarchy window and Insert Script Object. (Ex, jsGlobal)

Step 2). Define your fuction in that created script object.

Step 3). Call function in your event using ScriptObjectName.fuctionName. (Ex. jsGlobal.abweichungSummen).

Hope this helps.

Former Member
0 Kudos

Ok, but it doesn't work yet.

function abweichungSummen(sPar1, sPar2, sPar3){

var sVar1;

if ( sPar1 != sPar2 + sPar3 ){

  sVar1 = "hidden";

  return sVar1;

}

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

I call the function in event initialize

var sErgebnis;

sErgebnis == abSum.abweichungSummen(G_SUMME_NETTO_GES, SUM_AKT_MON, SUM_KOR_MON);

this.presence == sErgebnis;

prajeshdesai
Contributor
0 Kudos

Again some problem, Try this way,

Right click and Insert Script Object

When you add script object it should look like below,

Then call it just like below,


var retVal = jsGlobal.abweichungSummen(5,2,2);

Don't know why you are using == (double equal to).

Also make sure that you are having valu in your parameters G_SUMME_NETTO_GES, SUM_AKT_MON, SUM_KOR_MON.

Hope this helps..