2009 Feb 14 9:56 PM
Hello,
can somebody tell what is the meaning and use of the DELETEVALUE in the bapi_coument_change2 ?
I use this bapi with VB2003 as an rfc call to change the description of the document info record and now i want to delete an old entry in the list of the original files of a document info record. If i want to use DELETEVALUE what other parameters do i have to fill so that the entry would be deleted.
Hope somby has an example.
2009 Feb 15 7:29 AM
Hi,
DELETEVALUE is to specify that you want to delete a particular file/link in the document info record structure.
To delete an original file
1. First of all retrieve all the document details using BAPI_DOCUMENT_GETDETAIL2. This returns details in structure DOCUMNETDATA and table DOCUMENT FILES
2. Using data from the structure DOCUMENTDATA and table DOCUMENTFILES from the above BAPI, populate structures DOCUMENT DATA and DOCUMENTFILES of BAPI_DOCUMENT_CHANGE2. In addition fill in DOCUMENT TYPE, DOCUMENT NUMBER, DOCUMENT PART, DOCUMENT VERSION . In the DOCUMENTDATAX structure, mark the fields WSAPPLICATION1, DOCFILE1, DATACARRIER1 to 'X' .
3. Call BAPI_TRANSACTION_COMMIT.
This has worked for me.
I also found a similar question in the forum.
Edited by: Shwetha Hegde on Feb 15, 2009 8:33 AM
Hi,
DELETEVALUE is to specify that you want to delete a particular file/link in the document info record structure.
To delete an original file
1. First of all retrieve all the document details using BAPI_DOCUMENT_GETDETAIL2. This returns details in structure DOCUMNETDATA and table DOCUMENT FILES
2. Using data from the structure DOCUMENTDATA and table DOCUMENTFILES from the above BAPI, populate structures DOCUMENT DATA and DOCUMENTFILES of BAPI_DOCUMENT_CHANGE2. In addition fill in DOCUMENT TYPE, DOCUMENT NUMBER, DOCUMENT PART, DOCUMENT VERSION . In the DOCUMENTDATAX structure, mark the fields WSAPPLICATION1, DOCFILE1, DATACARRIER1 to 'X' .
3. Call BAPI_TRANSACTION_COMMIT.
This has worked for me.
I also found a similar question in the forum.
Edited by: Shwetha Hegde on Feb 15, 2009 8:33 AM
2009 Feb 15 7:29 AM
Hi,
DELETEVALUE is to specify that you want to delete a particular file/link in the document info record structure.
To delete an original file
1. First of all retrieve all the document details using BAPI_DOCUMENT_GETDETAIL2. This returns details in structure DOCUMNETDATA and table DOCUMENT FILES
2. Using data from the structure DOCUMENTDATA and table DOCUMENTFILES from the above BAPI, populate structures DOCUMENT DATA and DOCUMENTFILES of BAPI_DOCUMENT_CHANGE2. In addition fill in DOCUMENT TYPE, DOCUMENT NUMBER, DOCUMENT PART, DOCUMENT VERSION . In the DOCUMENTDATAX structure, mark the fields WSAPPLICATION1, DOCFILE1, DATACARRIER1 to 'X' .
3. Call BAPI_TRANSACTION_COMMIT.
This has worked for me.
I also found a similar question in the forum.
Edited by: Shwetha Hegde on Feb 15, 2009 8:33 AM
2009 Feb 16 1:33 PM
Hello Shwetha,
thanks for your Reply. I hade also found this similar question and send an email to Cristoph. I asked him for a little example but he has no example anymore. I have take your advice and test with X at WASPPLICATION1, DOCFILE1 and DATACARRIER1 but nothing happens (the old entry still
exists). I am still searching for an example.
regards
Günter
2009 Feb 16 2:00 PM
Hi,
Check the following code :
1) First get the old_originals from the Bapi_document_getdetail2 and the it_old_originals was the output.
LOOP AT it_old_originals INTO wa_old_originals .
READ TABLE documentfiles WITH KEY docfile = wa_old_originals-docfile.
IF sy-subrc <> 0.
documentfiles = wa_old_originals.
documentfiles-deletevalue = 'X'.
APPEND documentfiles.
ELSE.
DELETE TABLE documentfiles.
ENDIF.
ENDLOOP.
2) Pass it to the bapi_document_change2
2009 Feb 16 3:25 PM
The example below is for deleting an original file from documentinfo . Im not aware of the implications of the RFC. call etc. The example below is to delete an original file from the document using BAPI_DOCUMENT_CHANGE2. Im assuming you have created a document through CV01N transaction.
DATA : lv_doctype TYPE bapi_doc_aux-doctype,
lv_docnumber TYPE bapi_doc_aux-docnumber,
lv_documentpart TYPE bapi_doc_aux-docpart,
lv_documentversion TYPE bapi_doc_aux-docversion,
lwa_documentdata TYPE bapi_doc_draw2,
lwa_datax TYPE bapi_doc_drawx2,
lwa_return TYPE bapiret2,
lt_docfiles TYPE STANDARD TABLE OF bapi_doc_files2,
lwa_docfiles TYPE bapi_doc_files2.
*For example sake Im assuming the following values below
lv_doctype = 'DRW'.
lv_docnumber = '0000000000000010000000023'.
lv_documentpart = '000'.
lv_documentversion = '00'.
*Get Document Details for the above doc number
CALL FUNCTION 'BAPI_DOCUMENT_GETDETAIL2'
EXPORTING
documenttype = lv_doctype
documentnumber = lv_docnumber
documentpart = lv_documentpart
documentversion = lv_documentversion
getactivefiles = 'X'
getdocdescriptions = 'X'
getdocfiles = 'X'
IMPORTING
documentdata = lwa_documentdata
return = lwa_return
TABLES
documentfiles = lt_docfiles.
*Indicate the fields which will be deleted namely the original file characteristics
lwa_datax-docfile1 = 'X'. "Mark this as 'X' only if this has data in lwa_documentdata-docfile1
lwa_datax-datacarrier1 = 'X'. "Mark this as 'X' only if this has data in lwa_documentdata-datacarrier1
lwa_datax-wsapplication1 = 'X'. "Mark this as 'X' only if this has data in lwa_documentdata-wsapplication1
You get back all the files in the structure lt_docfiles.
LOOP AT lt_docfiles INTO lwa_docfiles.
lwa_docfiles-deletevalue = 'X'. "Do the following for all files you want to delete
MODIFY lt_docfiles FROM lwa_docfiles INDEX sy-tabix TRANSPORTING deletevalue.
CLEAR : lwa_docfiles.
ENDLOOP.
CALL FUNCTION 'BAPI_DOCUMENT_CHANGE2'
EXPORTING
documenttype = lv_doctype
documentnumber = lv_docnumber
documentpart = lv_documentpart
documentversion = lv_documentversion
documentdata = lwa_documentdata "this is filled in above fm call no modification required
documentdatax = lwa_datax
IMPORTING
return = lwa_return
TABLES
documentfiles = lt_docfiles.
IF lwa_return-type NE 'E'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
.
Edited by: Shwetha Hegde on Feb 16, 2009 4:26 PM
2009 Feb 16 3:49 PM
Hello,
thanks a lot. I am testing. Fo ryour info: i created the Document Info record together with original file with
the bapi_document_create by a rfc call. That all works fine. But now the name of the original file, the path and so one.
The problem for me is, because i am not a real abap or sap programmer , i want to use the BAPIS in my RFC-VB programm, the use of the different parameters.
With your infos i will keep on trying.
günter
2009 Feb 16 4:38 PM
Ok...if you still face issues with this, you could give the data you used to create the document and I could try and figure out what might be causing the issue.
All the best!!
2009 Feb 17 5:47 PM
Hello ,
i have made a lot of tests. The result:
1. i asked with bapi_document_getdetail2 and get all information from the document_info_record.
2. i put some new data like Description to documentdata and and X to documentdatax
3. i start with bapi_document_changed2 and the description is changed : well done
In the same i start again, now:
1. I put to documentfiles
Documentnumer = 00000000000.....1999121
Documentpart = 000
Documenttype = "ZZ"
Documentversion = "00"
Description = "JJJJ"
Docfile = "JJJJ.TIF"
Docpath = "
serverdirectory" (in reality i use the real names ! only an example)
Sourcedatacarrier = "ZVTIF"
File_id = "DDF91............................." (32 charcters long)
Application_ID = "DDF91......................" (the same: 32 Characters)
Deletevalue = "X" Here i use the switch for deleting !!!!!!!!!
2. The bapi_document_changed2 runs with no error message, but nothing was done. The old existing
entry of the original tif file still exists. In sap nothing is recorded .
3. I do not use Deletevalue = "X" , all the other parameters are the same: result:
I get a second new ! entry in the list of the original documents. Now i have two
TIF-Files with the same name created !
The difference between the two entries are:
ORIGINALTYPE from the first is 1 and from the second 2 . This seems to be the counter of the
originals files.
So with the bapi bapi_document_change i can CREATE a new TIF-File entry but not DELETE
the old one ???
So what is wrong here ?
with regards
Günter
2009 Feb 18 6:31 AM
Hi,
From what you have explained, I can only conclude that the data you are passing in the structure documentfiles is correct because a new file is getting created if you dont put X against DELETEVALUE. This only means the data in the structures documentdata or documentdatax is wrong somewhere.
If you observe structure documentdata there are two similar sets of fields
namely docfile1 and docfile2,
wsapplication1 and wsapplication2 etc.
So check which one is getting populated in the documentdata. This is why BAPI_DOCUMENT_GETDETAIL2 is useful.
If docfile1 , wsapplication1, datacarrier1 is getting populated then according in documentdatax mark docfile1, wsapplication1 , datacarrier1 as X.
Let me know the exact data you are getting in the structure documentdata and table documentfiles after executing FM BAPI_DOCUME NT_GETDETAIL2. That would narrow down the problem
2009 Feb 18 4:39 PM
Hello Swetha,
first thank you for your help. It's help me not to give up.
Here i have the information from bapi_document_getdetail2
I created by hand with CV01N a new Documentinforecord 1999122 with the description
"Test 1999122 leer".
I added a new original with the
name HHH-ORIGINAL.TIF and the
description HHH-Description.
Docfile1 and Docfile2 are still empty. Is it possible that because we are using the KPRO switch that
the bapi_document_change2 will not work ? I think that Docfile1 and Docfile2 are the older version to store in former times a dwg and a dxf cad file. This was ,as far as i know ,the limit of maximal 2 original files. Then with the KPRO switch it was possible to store more then 2 originals.
Astonishing is, when i use bapi_document.change2 i get an entry into Docfile1 with the TIF filename.
But if i have more then one (for instance 3) i get only one entry at Docfile1.
When i delete all originalfiles by hand there is STILL the last entry in Docfile1 (very curious).
In the table DMS_DOC_FILES i found the entries of the TIF-Files.
Perhaps it exist a special rfc to delete the entry in this table (and also in DMS_PHIO2FILE ?)
Do you use also the KPRO switch ?
Example: new Dokucumentinforecord with one Original TIF File
Documentnumber "0000000000000000001999122"
Documentpart "000"
Documenttype "ZZ"
Documentversion "00"
Getactivefiles Nothing
Getclassification Nothing
Getcomponents Nothing
Getdocdescriptions Nothing
- results {Length=12} Object()
- (0) {MATERIALCREATE.BAPI_DOC_DRAW2} MATERIALCREATE.BAPI_DOC_DRAW2
Authoritygroup ""
Cadindicator ""
Cmfixed ""
Cmrelevance ""
Createdate "20090218"
Datacarrier1 ""
Datacarrier2 ""
Deleteindicator ""
Description "Test 1999122 leer"
Docfile1 ""
Docfile2 ""
Documentnumber "0000000000000000001999122"
Documentpart "000"
Documenttype "ZZ"
Documentversion "00"
Ecnumber ""
Filesize1 "000000000000"
Filesize2 "000000000000"
Item MATERIALCREATE.BAPI_DOC_FILES2
+ List {MATERIALCREATE.BAPI_DOC_FILES2Table} System.Collections.IList
Site Nothing System.ComponentModel.ISite
SortDirection Ascending System.ComponentModel.ListSortDirection
SortProperty Nothing System.ComponentModel.PropertyDescriptor
SupportsChangeNotification True
SupportsSearching True
SupportsSorting True
with regards
Günter
Edited by: Hans Günter Weishaupt on Feb 18, 2009 5:41 PM
Edited by: Hans Günter Weishaupt on Feb 18, 2009 6:05 PM
I have found the rfc SDOK_PHIOS_DELETE. Would that be a solution to delete ?
2009 Feb 20 7:45 AM
Hi...I did some debugging of transaction CV02N and came up with the FM
CVAPI_DOC_CHANGE. I was able to use this successfully to delete the originals :). Let me test it once more and update you on its usage. Hopefully this FM should an answer to your problems!!
2009 Feb 20 1:08 PM
Hello,
i have test SDOK_PHIOS_DELETE and it did not work. Thanks for your info. Try also to test this bapi.
2009 Feb 21 4:55 PM
Hi,
Try this way.
First get document details using CVAPI_DOC_GETDETAIL. You need to pass only document number, document type, doc version and doc part. Ensure flag PF_READ_KPRO = 'X'. You get the original file details in structure PT_FILES
Then in CVAPI_DOC_CHANGE do the following
pass document number, doc type , doc version , doc part and name of person in PS_DRAW.
Pass the details retrieved from PT_FILES to PT_FILES_X of this FM. For the file you want to delete make sure that updatevalue = 'D'. For the files you want to retain leave this field as blank. Make sure you pass all details such as LOID, FILEID etc which you would have retrieved in structure PT_FILES of FM CVAPI_DOC_GETDETAIL.
This FM should work for changing descriptions too.
2009 Feb 21 7:41 PM
Hello,
thank you !!! . i will try and let you know if it works.
Günter
2009 Feb 22 7:25 PM
Hello Shwetha Hegde ,
that was the solution ! I do not need to send the username. The entries of the original files are deleted with the 'D' as you wrote ! So that is the way if the option KPRO is switched on in the customizing.
Thank you very ! much for your great help !!!
Günter
Edited by: Hans Günter Weishaupt on Feb 22, 2009 8:34 PM
Hello, want to give you points but how ?
I found it !
Edited by: Hans Günter Weishaupt on Feb 22, 2009 8:40 PM
2009 Feb 23 8:45 AM
2015 Mar 02 6:33 AM
Hello Guys ,
i need to know where do i get the values of Document part and document version which we have to pass it to bapi CVAPI_DOC_GETDETAIL.
Regards
Faran
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |