there is a idoc which is posted from a legacy system to R/3 system and it is changing the standard order, it processed perfectly.
But after that another IDOC is posted with the same data, and it failed .
Can any one tell me the reason why it happened so?
As the data in both the IDOC is same then why it failed on seond time.
Are you trying to post it to the same sales order or to a different order?
If you are trying to post it to the same order, then it will surely fail.
For eg: Consider that your 1st IDOC will update the availability check of the line items. It will update the schedule line dates in the line items. The IDOC posting prog will 1st check for the order / item status. If schedule lines are not updated, then it will post it & update the doc.
Then again when you get the 2nd IDOC for the same order, prog will again check for the status. Since it is already updated with the schedule line dates, it will not post it again into the same order. It will fail as the order is already updated.
Same is the case with delivery. If an IDOC posts & updates PGI, the 2nd IDOC will fail coz the delivery is already PGI'ed.
So try posting it into another SO.