Application Development and Automation 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: 
Read only

sapscript if statement

Former Member
0 Likes
598

hi,

may i know why the if statement doesn't work in sapscript?

IF &BSID-BUDAT& GE &RF140-DATU1&

xxxx

ELSE

yyyy

ENDIF

(where &BSID-BUDAT& = 07.01.2008 and &RF140-DATU1& = 01.03.2008)

actually march is greater than january but it still able to perform xxxx.

it should perform yyyy and not xxxx.

can have the advice?

thanks

rgds

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
515

Dear,

you have to do this in order to resove the problem.

create a variable say z_status in your program not in script.

then in program write this.

data: z_staus type C.

if bsid-budat GE rf140-datu1.

clear z_status.

z_status = 'Y'.

else.

clear z_status.

endif.

now in sapscript.

IF z_staus eq 'Y'.

xxxx

ELSE

yyyy

ENDIF

reward if useful.

Amit Singla

4 REPLIES 4
Read only

Former Member
0 Likes
515

check whether you have given '/:' in the tag column where if, else

and endif are written.

Syntax:

/: IF &var& = ‘char val’

/: ENDIF

Read only

0 Likes
515

hi,

this is the basic requirement. I did that of course.

but the IF statement cannot work.

Any Helps?

thanks

rgds

Read only

Former Member
0 Likes
515

Hi,

just see this:

/:IF &BSID-BUDAT& GE &RF140-DATU1&

*xxxx

/ELSE

*yyyy

/:ENDIF

use like this.

Regards,

If helpful reward with points(Don't forget).

Read only

Former Member
0 Likes
516

Dear,

you have to do this in order to resove the problem.

create a variable say z_status in your program not in script.

then in program write this.

data: z_staus type C.

if bsid-budat GE rf140-datu1.

clear z_status.

z_status = 'Y'.

else.

clear z_status.

endif.

now in sapscript.

IF z_staus eq 'Y'.

xxxx

ELSE

yyyy

ENDIF

reward if useful.

Amit Singla