Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

IF statement in Sapscript

Hi Guys,

I am using IF statements in my sapscript , but am getting an error -- "AND, OR or end of condition expected" . I have pasted my code below. Any suggestions in this regard would be helpful.

/: IF ( &BSEG-BELNR& EQ &BKPF-BELNR& )

/: IF ( &BSEG-KOART& = 'D' )

/: IF ( &BKPF-BLART& = 'KR' )

M3 ,,&BKPF-BELNR&,,&BKPF-XBLNR&,,&BKPF-BLDAT&,,&BSEG-SGTXT(25)&

= ,,&BSEG-DMBTR&,,&BKPF-HWAER&

/: IF STRLEN(&BSEG-SGTXT&) GT 25

M3 ,,,,,,,,&BSEG-SGTXT+25&

/: ENDIF

/: PERFORM CAL_TOTAL IN PROGRAM ZFR_PYTADV1

/: USING &BSEG-DMBTR&

/: CHANGING &W_TOTAL&

/: ENDPERFORM

/: ELSEIF ( &BKPF-BLART& = 'RE' )

M3 ,,&BKPF-BELNR&,,&BKPF-XBLNR&,,&BKPF-BLDAT&,,&BSEG-SGTXT(25)&

= ,,&BSEG-DMBTR&,,&BKPF-HWAER&

/: IF STRLEN( &BSEG-SGTXT& ) GT 25

M3 ,,,,,,,,&BSEG-SGTXT+25&

/: ENDIF

/: PERFORM CAL_TOTAL IN PROGRAM ZFR_PYTADV1

/: USING &BSEG-DMBTR&

/: CHANGING &W_TOTAL&

/: ENDPERFORM

/: ENDIF

/: ENDIF

/: ENDIF

regards

Nishant

Tags:
Former Member
replied

Hi Nishant,

it is because of <b>Brackets</b> it is giving that error.you should have to write the separate code inorder to avoid the Brackets.

i did it at my end.

it is not giving any errors..

/:    IF  A = 10 .      
/:   IF  A  = 'D' .     
/:   IF A = 'KR' .      
/:                      
/:    IF A GT 25.       
/:    ENDIF             
/:   ELSEIF A = 2       
          
/:    IF A GT 25.       
/:    ENDIF.            
/:   ENDIF.             
/:   ENDIF.             
/:   ENDIF 

Regards

vijay

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question