on 05-26-2010 10:19 AM
Hi Experts,
My requirement is to group the logical expressions in IF condition like the below
I tried it like
IF ( &NAST-KSCHL& = 'ZBE0' OR &NAST-KSCHL& = 'ZBEC' ) AND ( &VBDKR-SPRAS& <> 'F' )
code...
ELSEIF
Code....
ELSE
code...
ENDIF
But the system is showing the grouping in the IF condition is wrong. The problem is i am not supposed to break that AND condition and put it as another IF inside the first IF condition.
Pls provide your valuable inputs.
Thanks,
Srinivas
You may try something like this:
IF &NAST-KSCHL& = 'ZBE0' OR &NAST-KSCHL& = 'ZBEC'
DEFINE KSCHL_ZBE = 'X'
ELSE
DEFINE KSCHL_ZBE = ' '
ENDIF
IF KSCHL_ZBE = 'X' AND &VBDKR-SPRAS& NE 'F'
code...
ELSEIF
Code....
ELSE
code...
ENDIF
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As per my knowledge, you can't have brackets in IF condition in SAPSCRIPTS and also you can't continue it to second line.
I think you have to restructure your condition based on that.
IF ( &A& EQ '1' OR &A& EQ '2') AND ( &B& EQ '1' ).
ENDIF.
is same as
IF &A& EQ '1' OR &A& EQ '2'
IF &B& EQ '1' .
ENDIF.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Thanks for your valuable inputs.Sorry there was a mistake in the code which I have posted.Below is the correct statement
( &VBDKR-SPRAS& NE 'F' )
Jorge,
Thanks for pointing it out.
Lokesh,
Actually I am not supposed to split that logical condition , I want that to be a single conditional statement itself.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you having a customized print program for this script?
If yes you can also try to code these in print program itself and then bring the condition in the script editor..
May be something like that:
data: w_flag type flag,
w_flag_2 type flag.
IF ( NAST-KSCHL = 'ZBE0' OR NAST-KSCHL = 'ZBEC' ) AND ( VBDKR-SPRAS = 'F' )
w_flag = 'X'.
elseif <another condition>
w_flag_1 = 'X'.
endif.
and so on....
And call this w_flag and w_Flag_2 in script editor if the same way...
Edited by: Lokesh Tarey on May 26, 2010 1:04 PM
Hi,
Sometimes to play with sap script editor becomes very much difficult if you have scenario like as you mentioned..
Type this, and i hope it will work..
/: IF &NAST-KSCHL& = 'ZBE0' OR &NAST-KSCHL& = 'ZBEC'
/: IF &VBDKR-SPRAS& = 'F'
your code..
/: ENDIF
/: ELSEIF <LOGICAL EXP>
/: IF &VBDKR-SPRAS& = 'F'
your code..
/: ENDIF
/: ENDIF
Now please try to use one more IF statement, give the logical expression same as in ELSEIF
Although it is time consuming but sill you can try..
Edited by: Lokesh Tarey on May 26, 2010 12:30 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
check your code in ( &VBDKR-SPRAS& 'F' ) since it is wrong. It must be like this:
( &VBDKR-SPRAS& = 'F' )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.