‎2015 Feb 24 1:32 PM
Hello experts,
i am a beginner with abap development and try to write a report that deletes materials, documents and document structures.
I just wrote a method that should delete documents. My Problem is, that the function module always returns that the document cannot be deleted, because it is used in a document structure. But I am sure that it isn't. My import structure is BAPI_DOC_AUX , just like the function module needs it.
Do you have any ideas where that comes from?
Thanks a lot.
method DELETE_DOCUMENTS.
DATA ls_success LIKE LINE OF it_success.
* deletes document from corresponding tables
CALL FUNCTION 'BAPI_DOCUMENT_DELETE_DIRECT'
EXPORTING
documenttype = is_doc-doctype
documentnumber = is_doc-docnumber
documentpart = is_doc-docpart
documentversion = is_doc-docversion
IMPORTING
RETURN = ls_success.
APPEND ls_success to et_success.
if ls_success-type eq 'S'.
* deletes document from the index table, too.
DELETE FROM zaif_plm_doc_idx "#EC CI_NOFIELD
WHERE documenttype = is_doc-doctype
AND documentnumber = is_doc-docnumber
AND documentpart = is_doc-docpart
AND documentversion = is_doc-docversion.
endif.
endmethod.
Message was edited by: Matthew Billingham - formatted code to be readable
‎2015 Feb 24 1:41 PM
When you post in this site, after you've posted read what you've written and ensure the formatting is good. I've removed the extra blank lines in the code for you this time - next time, I'll just reject your post.
‎2015 Feb 24 1:44 PM
‎2015 Feb 24 1:51 PM
‎2015 Feb 24 1:54 PM
No, I haven't. Do I have to use it?
Does this change anything, because the 'BAPI_DOCUMENT_DELETE_DIRECT' returns an "success"- message which says that the material is used in a bom.
‎2015 Feb 24 1:56 PM
Sorry, i haven't read correctly your issue, my answer is wrong...
‎2015 Feb 24 2:00 PM
‎2015 Feb 24 2:06 PM
Have you tried to identify the error(standard code raising message) by activating breakpoint at statement MESSAGE or RAISE ?