cancel
Showing results for 
Search instead for 
Did you mean: 

Version Document Info Record and File Management

Former Member
0 Kudos

Hi all!

want to edit DMS document info records (as in cv04n - add, del files) without deleting original DIR -> Version management of DIRs.

I use the following BAPI scenario:

- BAPI_DOCUMENT_GETACTVERSION (get the highest version of a DIR)

- BAPI_DOCUMENT_GETDETAIL2 (to get the object links of the DIR)

- BAPI_DOCUMENT_CREATENEWVRS2 (create a new version of the DIR, copyoriginals = X, object links are copied as well)

- again BAPI_DOCUMENT_GETACTVERSION (get this new version number)

- again BAPI_DOCUMENT_GETDETAIL2 to get the files of the new version DIR)

- to delete single files, i change the file record of the files table ( set deletevalue = X).

- then BAPI_DOCUMENT_CHANGE2 as suggested in a nother thread of mine by 2 community members.

the latest step runs for version = 00, but when having a version gt 00, the bapi_document_change2 returns : "original is already checked in and stored".

also i checked the ph_objid and lo_objid (the ids are the same for Version n and n+1), which might be the reason for the error mentioned above.

i can't find any solution.

thanks for replies in advance,

Christoph

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi all!

got the solution: - finally !!!

Problem:

you want to edit Document info records - using a new version of this DIR. in the new version it is possible to add and delete files.

Solution:

- CALL FUNCTION 'BAPI_DOCUMENT_GETACTVERSION'

and get the actual hightest version of the DIR

- ls_objtype-OBJECTTYPE = '*'.

append ls_objtype to myobjectlinks. to be able to copy all the objectlinks of the DIR.

- lv_dokvr_new = lv_dokvr_ref + 1. - increment the DIR version number

- CALL FUNCTION 'BAPI_DOCUMENT_CREATENEWVRS2 to create a new version of the DIR.

- * get again the actual version

CALL FUNCTION 'BAPI_DOCUMENT_GETACTVERSION'

- * get files of the new version

CALL FUNCTION 'BAPI_DOCUMENT_GETDETAIL2'

- * set the delete flag for those you want to delete in the table documentfiles.

- CALL FUNCTION 'BAPI_DOCUMENT_CHANGE2'

      • IMPORTANT ***

!!! transfer O N L Y the files you want to delete O R transfer all files but C L E A R the STORAGE_CATEGORY field !!!

any questions? feel free to ask...

Former Member
0 Kudos

Hi Christoph,

BAPI_DOCUMENT_CREATENEWVRS2 delivers a new version (gt 00)

- your latest step ( BAPI_DOCUMENT_CHANGE2 ) must run for this new version gt 00.

Regards

Volker

Former Member
0 Kudos

i create new version with this bapi create_newvrs2, of course. for the new version the bapi_document_change2 doesnt work somehow.

Former Member
0 Kudos

I think, you need only first 3 steps. Then a new version is created and stored. Last three steps are not neccessary.

Former Member
0 Kudos

the thing is: the original DIR should stay the same but is not correct. It should be changed in a new version. Therefore i create a new version of the orig. DIR. Then add and delete of files can be done. So i need the change2 bapi i think.

Former Member
0 Kudos

BAPI BAPI_DOCUMENT_GETDETAIL2 delivers a table documentfiles.

For files you want to delete set field 'deletevalue' to 'X' in this table.

Then call BAPI_DOCUMENT_CHANGE2.

Former Member
0 Kudos

Hi!

that is exactly what I'm doing. But when i call the bapi, the return structure is set: "Original has already been checked in and stored."

I think the problem is located in the combination of the BAPI_DOCUMENT_CREATENEWVRS2 and BAPI_DOCUMENT_CHANGE2.

It seems that the files are not really copied by the first bapi. but in the cv04n, the new version is editable and files can be deleted. (???)

Former Member
0 Kudos

Try to check out the file you want to delete using BAPI BAPI_DOCUMENT_CHECKOUTSET2.

After this set the deletion flag.

Then BAPI_DOCUMENT_CHANGE2.

Former Member
0 Kudos

Hi Volker, thanks for the hint, but the step checkout_set seems to be unnecessary for this. To delete files, its enough to use bapi_getdetail2 and change2. checkout_set doesn't have any positive effect on this problem.

regards,

Christoph

Former Member
0 Kudos

seems i found a solution:

checkoutset2 in combination with BAPI_DOCUMENT_CHECKIN_REPLACE2

I'll give it a try.