AX 2012 R3 for Retail – Clear Statement Greyed Out

It may be possible that when you attempt to post a statement, you run into a posting error.  There could be multiple reasons why this fails such as tax rounding is higher than your posting rounding threshold.  You simply want to fix the issue and re-post the statement.  But after fixing the issue at hand, you find that the Clear statement button is greyed out.  You are now stuck because you need to bring in the change you just made so that the posting is successful, now what do you do?

Let’s first discuss what is occurring in this scenario.  When a statement posting fails, the expectation would be that the statement postings are rolled back and the statement returns to its original calculated state.  What is actually occurring is that the statement stops where it is and doesn’t completely roll back.  As hinted in the screenshot above, a “Posting date” was assigned to the statement that was being used to post Sales Orders.  Some of those Sales Orders may have already been created and are still linked to the statements transactions. 

What is now happening is that when you load the statement form, a check is performed to see which buttons should be enabled (\Forms\RetailStatementTable\RetailStatementClear:clicked).  The specific code for this scenario looks like this:
RetailStatementClear.enabled(statementTable.calculatedDate != dateNull()
&& statementTable.postingDate == dateNull());

Since the statementTable.postingDate has a date of 5/1/2015, the RetailStatementClear button is disabled.  To enable the button again, there are two scenarios:

1. Install the KB below to resolve the issue, but this is normally applicable to future statement posting failures only.  Try reposting the statement after installing this KB to see if it rolls back properly.
     KB 2996213 – A Retail statement that includes transactions that contain blank dimensions cannot be posted and a sales order is generated without an invoice.

2. If after installing the KB and the re-post still doesn’t roll back for this particular statement, you can simply clear out the Posting Date field in the RETAILSTATEMENTTABLE.  Reload the form and the clear statement should be available.  After making any necessary changes, post the statement again.  This statement post should recognize that sales orders were already created for some of the transactions and finish the posting job where it left off.  As a precaution, I always recommend performing this in test first to ensure that your posting occurs as expected.

Here are two statements you can run in SSMS to locate and clear out the Posting Date for a specific statement:
select POSTINGDATE, * from RETAILSTATEMENTTABLE where STATEMENTID = ‘SSEATTLE000060’
update RETAILSTATEMENTTABLE set POSTINGDATE = ” where STATEMENTID = ‘SSEATTLE000060’