cancel
Showing results for 
Search instead for 
Did you mean: 

comparing values in scripts

Former Member
0 Kudos

Hi Gurus,

I have defined a variable in my script as

Define &N& = ' '.

So here Variable N is automatically converted into CHAR format.

I am passing this variable in my SUBROUTINE in the script.

I get an integer value inside the SUBROUTINE .

When i transport this value back to the script it gets converted to CHAR format.

Now In the script If i use

IF N > '1'.

write 'sucess'.

ENDIF.

It does not function properly.

Could anyone please help me solving this issue.

I mean after getting an integer value in the subroutine i need to use that value as an integer in the script so that i could easily compare two integer values inside my SCRIPT.

Please help me.

Regards,

Roshan Lilaram Wadhwani.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

SAPscript is only interested in character format, so to get round the problem use your subroutine to set a flag based on the condition.

In your script

/: DEFINE &FLAG& = ' '

So in your subroutine

IF N > '1'.

FLAG = 'X'.

ENDIF.

Then back in your form

IF &FLAG& = 'X'.

write 'sucess'.

ENDIF

Regards,

Nick

Former Member
0 Kudos

Thanks a lot Nick, Sometimes some of the easiest things don't click.

Regards,

Roshan Lilaram Wadhwani.

Answers (1)

Answers (1)

Former Member
0 Kudos

Try

IF &N&  GT  '1'.
write 'sucess'.
ENDIF.

Regards

Aneesh.