cancel
Showing results for 
Search instead for 
Did you mean: 

How to Delete an Attached Document via code?

former_member574468
Participant
0 Kudos

Hi all,

I ve created one document.

Within the Document I ve attached Some PDF files. Among those files i want to delete some files through code....

How to do that?

can anyone help me to comeout from this issue?

Regards,

Vimal.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Vimal,

Use t-code CV02n i.e. chnage document and delete or add the document and save.

for deletion use the buttons below attachment.Right side first is for deletion and then 4th from right to browse and upload.

I hope this will resolve your query.

Regards,

Ravindra

former_member574468
Participant
0 Kudos

Hi....

I want to delete the files using code.....

Former Member
0 Kudos

for selective deletion, use bapi_document_change2, pass deletevalue = X for the file in DOCUMENTFILES table

former_member574468
Participant
0 Kudos

Hi...

It is working. But if i delete the file for that particular Document thro code using BAPI_DOCUMENT_CHANGE2 Func.Module, It should delete the same in CV04N also. But it is not happening now....

Plz help me to comeout from this....

christoph_hopf
Advisor
Advisor
0 Kudos

Hi,

Could you please explain the behavior in CV04N a bit more detailed. Because this is only the document search and here normally no original files should be deleted from the document info records.

If you want to delete the whole document info record you can use BAPI Document.DeleteDirect. This BAPI will delete the whole document info record from your database table DRAW and afterwards this document info record won't be found with transaction CV04N anymore.

Best regards,

Christoph

former_member574468
Participant
0 Kudos

Hi,

My Scenario is to add or delete file into CV02N via code...

Now i can able to add the file thro code.

But i m unable to delete it.....

Suggest me the steps, how to delete a particular file (not all) thro code.

Thanks in Advance,

Vimal.....

Makal
Active Contributor
0 Kudos

Suggest me the steps, how to delete a particular file (not all) thro code.

Dear Vimal

Follow these steps:

1. Go to CV02N, enter all the details pertaining to your DIR

2. Open the DIR

3. In the next screen, Under Originals tab, you'll see document(s) checked-in.

4. Right click on the document, select delete

OR

Click on the document you want to delete, & click on the delete button.

5. Save the DIR.

That's all. Remember this action would remove original from the DMS server.

~Amaresh Makal

former_member574468
Participant
0 Kudos

Hi....

Ur Steps are right....

But i clearly mentioned that i want to delete an attached file through ABAP code. Not manually....

Makal
Active Contributor
0 Kudos

But i clearly mentioned that i want to delete an attached file through ABAP code. Not manually...

Please post this question in ABAP forum. This could be better answered there.

Regards

Amaresh Makal

christoph_hopf
Advisor
Advisor
0 Kudos

Hi Vimal,

if you want to remove the original in CV02N through ABAP coding, then I think you can only implement BADI DOCUMENT_MAIN01 (method AFTER_READ_DATA) or DOCUMENT_FILES01 (method AFTER_ASSIGN_FILE) where you need to implement your own coding to delete the previous existing original file.

The only further possible solution would be to delete the original manually.

Best regards,

Christoph

former_member574468
Participant
0 Kudos

Hi...

Can u tell me what and all are required to delete the attachment in AFTER_READ_DATA?

Can u Explain me with Details Steps?

dhinesh_thirugnanam
Active Participant
0 Kudos

Hi,

Can I know the steps to delete the documents(orginals) in DMS thro code.Is there any BAPI?Simultaneously it should affect the table drao.