Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Sapscript compare b/t string & number

Former Member
0 Kudos
236

Hi,

In sapscript, I write the below comparison but it doesn't understand:

<b>IF &PAGE& = &SAPSCRIPT-FORMPAGES&.</b>

with &PAGE& is of type character & &SAPSCRIPT-FORMPAGES& is an interger.

Can someone show me how to convert (date type) either of the above 2 values to make my comparison working?

Thanks!

10 REPLIES 10

Former Member
0 Kudos
103

Hi Timy,

Use IF &SY-PAGNO& = &SAPSCRIPT-FORMPAGES&.

Regards,

Satish

0 Kudos
103

Hi,

Thanks for your reply, but &SY-PAGNO& always returns 0.

0 Kudos
103

If you are trying to access current page number in &PAGE&, than you can use the

/: IF &TTXSY-PAGE& = &SAPSCRIPT-FORMPAGES&

Regards,

Naimesh Patel

0 Kudos
103

Hi,

Thanks for your reply but &TTXSY-PAGE& returns nothing.

The &PAGE& is already have the correct value but it is in string (character) instead of integer.

Former Member
0 Kudos
103

Timy,

Try this

&SYST-CPAGE& = &SAPSCRIPT-FORMPAGES&.

Regards,

Satish

0 Kudos
103

Satish,

&SYST-CPAGE& always returns 0 too. The value of &PAGE& is correct but it is in character (string) instead of integer.

I think what I have to do is to convert either of these 2 values to another corresponding type to make it comparable. But I don't know how.

Thanks anyway.

0 Kudos
103

Hi Timy,

Check this post, you have answer

Reward Points if this helps,

Satish

0 Kudos
103

Oh I got it, just compare like below:

/: IF &TTXSY-PAGE& = &SAPSCRIPT-FORMPAGES<b>(C)</b>&

0 Kudos
103

I think you can also do in this way

&PAGE& = &SAPSCRIPT-JOBPAGES&

Former Member
0 Kudos
103

The solution is very simple, as:

IF &PAGE& = &SAPSCRIPT-FORMPAGES(C)&.

Thanks for all reponders anyway!