Script to tell if document has an attachment in SAP
I would like to write a script to check if our MIRO and FB60 documents have an attachment. I would prefer a system report, but our IT group has not been able to provide this. I have reverted to writing a script that pulls up each invoice, opens up the attachment list window and then checks to see if there is an attachment. My script is not great because if there is no attachment, I don't know how to cleanly determine this. Right now I try to select the first attachment.
session.FindById("wnd/usr/cntlCONTAINER_0100/shellcont/shell").selectedRows = "0"
If there is no attachment, I get an error message. In Excel I set up the error handler to jump to a part of the macro that records "no attachment", if there isn't an error message I record "has attachment".
Is there a cleaner way to do this?
Also, I'm checking thousands of these documents and if there is a warning message at the bottom of a window when I pull up the document with FBV3 (document deleted etc) then my macro falls over. Any ideas on how to handle messages in a general way?