cancel
Showing results for 
Search instead for 
Did you mean: 

SAPScript code error

Former Member
0 Kudos

Hi All!

I want to write the next code in a SAPScript form and I receive the marked error.

/: IF ((&MSEG-XAUTO& NE 'X' AND &MSEG-BWART NE '309') OR

<b>AND, OR or end of condition expected </b>

= (&MSEG-XAUTO& EQ 'X' AND &MSEG-BWART EQ '309')) .

The tag column is the error?

Thank you for your answer.

Best regards,

Florina

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

/: IF ((&MSEG-XAUTO& NE 'X' AND &MSEG-BWART NE '309') OR

= (&MSEG-XAUTO& EQ 'X' AND &MSEG-BWART EQ '309')) .

Here u r keeping = ( extended line ) but it will not work if u r using IF statement.

Do like this , it solves u r problem

in menu bar of text elements click EDIT -> page left/right there u write this

(&MSEG-XAUTO& EQ 'X' AND &MSEG-BWART EQ '309')) .

then it will work

Former Member
0 Kudos

Hi Sreekanth!

Done. But still don't work...meaning the line with MSEG-XAUTO=X is not printed. The result are blank pages.

Thanks for your answer.

Florina C

Former Member
0 Kudos

Does anybody know if is true that I can't print this items?

If it is possible to print them i will still search a solution. Otherwise....

Thank you.

0 Kudos

Dear Florina,

i am also facing the same issue in sap script. can any one please provide some inputs on this.

i am using the following if condition.

IF &L_CTR1& > 5 AND IF &L_CTR1& <= 10.

comment information to be printed.

endif.

0 Kudos

Its also giving the error in text checking as below:

AND, OR or end of condition expected in sap script editor

Regards,

satheesh N

Florian
Active Contributor
0 Kudos

Hi Satheesh,

IF &L_CTR1& > 5 AND IF &L_CTR1& <= 10.

The red marked is wrong, this will work:

IF &L_CTR1& > 5 AND &L_CTR1& <= 10.

~Florian

0 Kudos


Hi,

Still the control is not going inside the IF condition after changing the same.

find the below source code after correction.

Also i changed the L_CTR1 data type to N.

IF &L_CTR1& > 5 AND &L_CTR1& <= 10.

BOX XPOS '0' CM YPOS '8' LN WIDTH '1' CM HEIGHT '10' LN FRAME 10 TW

BOX XPOS '1' CM YPOS '8' LN WIDTH '0.5' CM HEIGHT '10' LN FRAME 10 TW

BOX XPOS '1.5' CM YPOS '8' LN WIDTH '2' CM HEIGHT '10' LN FRAME 10 TW

BOX XPOS '3.5' CM YPOS '8' LN WIDTH '4.5' CM HEIGHT '10' LN FRAME 10 TW

BOX XPOS '8' CM YPOS '8' LN WIDTH '1' CM HEIGHT '10' LN FRAME 10 TW

BOX XPOS '9' CM YPOS '8' LN WIDTH '0.5' CM HEIGHT '10' LN FRAME 10 TW

BOX XPOS '9.5' CM YPOS '8' LN WIDTH '2' CM HEIGHT '10' LN FRAME 10 TW

BOX XPOS '11.5' CM YPOS '8' LN WIDTH '2' CM HEIGHT '10' LN FRAME 10 TW

BOX XPOS '13.5' CM YPOS '8' LN WIDTH '3.5' CM HEIGHT '10' LN FRAME 10 TW

BOX XPOS '17' CM YPOS '8' LN WIDTH '3' CM HEIGHT '10' LN FRAME 10 TW

BOX XPOS '20' CM YPOS '8' LN WIDTH '7' CM HEIGHT '10' LN FRAME 10 TW

,,Itm ,,PK,,Account,,Account Short text  ,,BusA,,S,,Cost Ctr  ,,Order,,

Assignment,,Amount,,Text

&SYST-ULINE(142)&

ENDIF.

Regards,

Satheesh

Florian
Active Contributor
0 Kudos

Hi Satheesh,

Try to put the values in '

IF &L_CTR1& > '5' AND &L_CTR1& <= '10'

dot at the end is not necessary and of Course you need the /:, but I'm sure, that is correct anyway.

~Florian

0 Kudos

Hi Florian,

yes, it worked out.

Thanks a lot.

Former Member
0 Kudos

i think u forgot

/: endif.

santhosh

Former Member
0 Kudos

Thanks Santosh.

I have the ENDIF. I copy all the code:

/: IF ((&MSEG-XAUTO& NE 'X' AND &MSEG-BWART NE '309') OR

= (&MSEG-XAUTO& EQ 'X' AND &MSEG-BWART EQ '309')) .

M

L &MSEG-MATNR&

M

L &MSEG-CHARG&

/: IF &MSEG-MATNR+4(7)& EQ '0000-00'.

M &EKPO-TXZ01& &MABDR-MAKTX(30)&

/: ELSE.

M &MABDR-MAKTX(30)&

/: ENDIF.

/* Boxã: &BOXA& / &GEST&

M

L &MSEG-LGORT&/&MABDR-LGPBE&

/*

/* &MABDR-LGPBE&

/: IF &MSEG-KDPOS& NE '000000'.

M &MSEG-KDAUF&/ &MSEG-KDPOS&

/: ENDIF.

/: IF &MSEG-LIFNR& EQ SPACE.

L &FURNIZOR&

/: ELSE.

M &mseg-lifnr&

/: ENDIF.

/* ECHIV.LA:

M &ECHIV&

/* &EINA-IDNLF&

/* &CODFRZ&

/: ENDIF.

Florina

Former Member
0 Kudos

I'm not sure about this, but have you tried putting a space between your parenthesis and your variables?

sridhar_k1
Active Contributor
0 Kudos

IF command in sapscript does not support bracketed conditions and all conditions should be in one line.

= in second line does not add the condition to the IF condition.

If the first line is full, right click in the editor and select Page Left/Right to enter remaining condition.

Regards

Sridhar

Former Member
0 Kudos

Thanks.

I do all this and I still get the error message:

/: IF ( ( &MSEG-XAUTO& NE 'X' AND &MSEG-BWART NE '309' ) OR ( &MSEG-XAUTO& EQ 'X' AND &MSEG-BWART EQ '309' ) ) .

AND, OR or end of condition expected

Any suggestion?

Florina

Former Member
0 Kudos

I changed the code and I don't receive anymore the error message. But I still can't print the label for the position which is create automatically in MSEG (for the movement type 309 I have to print the label for the new material, the one with MSEG-XAUTO='X').

Do you know why?

Florina

sridhar_k1
Active Contributor
0 Kudos

Did you remove brackets ( ) from IF command also?

change the condition to:

/: IF &MSEG-XAUTO& NE 'X' AND &MSEG-BWART NE '309'

/: DEFINE &FLAG& = 'X'

/: ELSEIF &MSEG-XAUTO& EQ 'X' AND &MSEG-BWART EQ '309'

/: DEFINE &FLAG& = 'X'

/: ENDIF

/: IF &FLAG& = 'X'

..... Print the fields....

/: ENDIF

Regards

Sridhar

Message was edited by: Sridhar K

Former Member
0 Kudos

Sridhar,

I removed the brackets and the compilation of the texts and definitions for my form was executed successfully. The form is activated. But, when I want to print preview the form for a transfer with movement type 309, the pages are white...

May be that the records automatically generated in MSEG (XAUTO='X') can not be printed?

Florina