Skip to Content
avatar image
Former Member

How to use a MOD function in SAP design studio Script?

Hi Experts,

I am trying to achieve the below condition in sap design studio script .

Let take i have a variable "test". I have a condition like this

if (test MOD 4)==0{

Textbox.settext("Divisible");

}

else{

extbox.settext(" Not Divisible");

}

the above MOD function is throughing error .i used "%" this also.

Please help me.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jan 10, 2017 at 10:35 AM

    Checking the SAP Help at http://help.sap.com/businessobject/product_guides/AAD16/en/ds_16SP04_user_en.pdf - the MOD function is not supported. You will need to calculate it manually - a good sample to start with is Victor's reply in this thread https://archive.sap.com/discussions/thread/3602479

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 11, 2017 at 12:27 AM

    Hi Jose,

    You can simply define your own Mod function as a re-usable Global Script Function as follows:

    You can call it as follows: GLOBAL_SCRIPTS_1.MOD(7, 3);

    In this example the result would be 1.

    Regards,

    Mustafa.

    Add comment
    10|10000 characters needed characters exceeded