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

chech date in sapscript

Former Member
0 Likes
816

Hi all,

I need to check a date in a sapscript in this way:

/E   HEADER_1
/:   IF &MXABK-TDATE& = '20060601'
/:       <code A>   
/:   ELSE.
/:       <code B>   
/:   ENDIF.

but it doesn't work.

(I hope I don't have to use a form routine for a check so simple).

Could you help me?

I thank you in advance.

Best regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
593

Hi Paolo,

Try to Use the below code in script.

/E HEADER_1

/: set edit mask : 'YYYYMMDD'.

/: IF &MXABK-TDATE& = '20060601'

/: <code A>

/: ELSE.

/: <code B>

/: ENDIF.

3 REPLIES 3
Read only

Former Member
0 Likes
593

Just write in the sapscript the value of MXABK-TDATE, this will show you the format it uses when doing the compare.Most probably you'll need to check it against '06/01/2006'

Read only

Former Member
0 Likes
594

Hi Paolo,

Try to Use the below code in script.

/E HEADER_1

/: set edit mask : 'YYYYMMDD'.

/: IF &MXABK-TDATE& = '20060601'

/: <code A>

/: ELSE.

/: <code B>

/: ENDIF.

Read only

Former Member
0 Likes
593

I suspect the date format that is getting passed from the program.

In SE71 transaction please activate debugger (Menu utilities ->Activate debugger) and debug the program.