cancel
Showing results for 
Search instead for 
Did you mean: 

condition not reached in SAPScript code (was: "SAP Script")

Former Member
0 Kudos

Hi Experts,

I want to compare system date(month) to next month in sap script. For this i wrote following code in text element of main window:--

/E DATA

/: IF &SY-DATUM+4(2)& EQ '04'

AS APRIL

/: ELSE

AS Not a Valid Month

/: ENDIF

bt wen i execute my report it will display ELSE condition message.

Can anyone plz solve my prob?

Thanks

Sanchita

Moderator message: please use more descriptive subject lines for your posts.

Edited by: Thomas Zloch on Apr 6, 2011 10:26 AM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

check the sy-datum value when it reaches the below code in debugging in the form,then you come to know what is the issue

/E DATA

/: IF &SY-DATUM+4(2)& EQ '04'

AS APRIL

/: ELSE

AS Not a Valid Month

/: ENDIF

may be the issue is SY-DATUM doesnt contain the date value in CCYYMMDD format it may be different format.

ThomasZloch
Active Contributor
0 Kudos

may be the issue is SY-DATUM doesnt contain the date value in CCYYMMDD format it may be different format.

This would be worse than the Y2K bug!

Thomas

Former Member
0 Kudos

Hi,

Try debugging the same and see what data it is comparing.

In SE71, put the form name and in menu options 'Utlilities' select 'Activate debugger' and execute the form.

Else try like below.

IF &SY-DATUM&+4(2) EQ '04'.

Former Member
0 Kudos

Hi,

No it is not give right answer. Can anyone plz help me.

thanks

Former Member
0 Kudos

Hi,

SAPSCRIPT is not ABAP.

please try following:

Please replace 'EQ' with '='.

Reagrds,

Christian