You can't determine on the basis of a sales order if it has been posted into the G/L or not because sales orders are NOT posted directly into G/L. In the most common SD flows, you always do an invoice step ( possible with a delivery step in between ) and it's the invoice document that is posted into FI.
So, you need to check the subsequent flow of a sales order (item) to know if it's invoiced or not. The problem is that 1 sales order might have been splitted across multiple invoices ( or vice versa multiple sales orders collected into 1 invoice )
Summary : There is no single field that will tell you if a sales order has been posted into FI or not. But if you can use a function instead, it's possible ( but not trivial )
Function structure : Is sales order FULLY posted or not ?
-read VBAP for retrieving all sales order items
-check rejection status of the sales order items
-for delivery related billing items ( = VBUP-FKSAA is blank ) : check if fully delivered ( status table VBUP-LIFSP ) . Check if all delivery documents fully invoiced ( VBUP-FKSTA ) . Check if all billing documents posted ( VBUK-BUCHK )
(read VBFA table for retrieve the document flow per item)
-for sales order related billing items ( VBUK-FKSAA is not blank) : check if fully invoiced ( status table VBUP-FKSTAA = 'C' ) . Check if all billing documents posted ( VBUK-BUCHK = 'C' )
(read VBFA table for retrieve the document flow per item)
You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
Add a comment