Code: Alles auswählen.
CALL FUNCTION 'BAPI_DOCUMENT_CREATEFROMSRC2'
EXPORTING
refdocumenttype = <doc_key>-documenttype
refdocumentnumber = <doc_key>-documentnumber
refdocumentpart = <doc_key>-documentpart
refdocumentversion = <doc_key>-documentversion
newdocumentnumber = ls_doc_key_ippe-doc_number
newdocumentpart = ls_doc_key_ippe-doc_part
newdocumentversion = ls_doc_key_ippe-doc_vers
copyoriginals = 'X'
copydocbom = 'X'
IMPORTING
doctype = ls_doc_key_ippe-doc_type
docnumber = ls_doc_key_ippe-doc_number
docpart = ls_doc_key_ippe-doc_part
docversion = ls_doc_key_ippe-doc_vers
return = ls_return
TABLES
copyobjectlinks = lt_links.
Ich würde es gerne mal mit Deinem Beispielcoding probieren. In diesem Sinne gebe ich hiermit BescheidHaubi hat geschrieben: Ansonsten wäre noch die Möglichkeit, die Originale mittels FuBa CV120_KPRO_CHECKOUT_TO_TABLE zu lesen und mit FuBa CVAPI_DOC_CHECKIN an den neuen DIS anzuhängen. Wenn Du dazu Beispielcoding brauchst sag Bescheid.
Code: Alles auswählen.
DATA:
lt_data TYPE dms_tbl_file,
lt_components TYPE STANDARD TABLE OF sdokcomprp,
lt_bad_objects TYPE STANDARD TABLE OF sdokerrkey,
ls_phio_id TYPE sdokobject,
lt_content TYPE dms_tbl_drao.
CALL FUNCTION 'CV120_KPRO_MASTER_DATA_GET'
EXPORTING
pf_dokar = l_dokar_old
pf_doknr = l_doknr_old
pf_dokvr = l_dokvr_old
pf_doktl = l_doktl_old
TABLES
ptx_data = lt_data.
DATA(lv_phio) = lt_data[ 1 ]-tbl_phios[ 1 ]-ph_objid.
APPEND INITIAL LINE TO lt_components ASSIGNING FIELD-SYMBOL(<ls_component>).
<ls_component>-class = 'DMS_PCD1'.
<ls_component>-objid = lv_phio.
CALL FUNCTION 'SDOK_PHIOS_FILE_PROPERTIES_GET'
TABLES
components = lt_components
bad_objects = lt_bad_objects.
READ TABLE lt_components INTO s_component INDEX 1.
ls_phio_id-class = 'DMS_PCD1'.
ls_phio_id-objid = lv_phio.
CALL FUNCTION 'CV120_KPRO_CHECKOUT_TO_TABLE'
EXPORTING
ps_phio_id = ls_phio_id
TABLES
ptx_content = lt_content.
Code: Alles auswählen.
DATA:
ls_original TYPE cvapi_doc_file,
lt_original TYPE cvapi_tbl_doc_files,
ls_api_control TYPE cvapi_api_control,
ls_message TYPE messages.
ls_original-appnr = '1'.
ls_original-dappl = <hier korrekten Wert setzen>.
ls_original-storage_cat = <Hier Ablagekategorie ergänzen>.
ls_original-filename = <Dateiname>.
ls_original-active_version = abap_true.
ls_original-checked_in = abap_true.
APPEND ls_original TO lt_original.
ls_api_control-commit_flag = abap_true.
ls_api_control-no_update_task = abap_true.
ls_api_control-save_flag = abap_true.
ls_api_control-api_mode = abap_true.
ls_api_control-bapi_flag = abap_true.
LOOP AT lt_content ASSIGNING FIELD-SYMBOL(<ls_content>). " Den CONTENT hatten wir im Step 1 ausgelesen...
<ls_content>-dokar = s_draw-dokar.
<ls_content>-doknr = s_draw-doknr.
<ls_content>-dokvr = s_draw-dokvr.
<ls_content>-doktl = s_draw-doktl.
<ls_content>-appnr = '1'.
<ls_content>-zaehl = sy-tabix.
<ls_content>-orln = s_component-file_size.
<ls_content>-orbkl = 2550.
ENDLOOP.
CALL FUNCTION 'CVAPI_DOC_CHECKIN'
EXPORTING
pf_dokar =l_dokar_new
pf_doknr = l_doknr_new
pf_dokvr = l_dokvr_new
pf_doktl = l_doktl_new
ps_api_control = ls_api_control
pf_replace = abap_true
pf_content_provide = 'TBL'
IMPORTING
psx_message = ls_message
TABLES
pt_files_x = lt_original
pt_content = lt_content.
Die Geister, die ich rief....Haubi hat geschrieben:Oha, das hatte ich befürchtet...
Das sollte so reichen, vielen Dank dafürHaubi hat geschrieben: Workstation-Applikation, Ablagekategorie etc. kannst Du ggf. aus dem Original zum Quell-DIS bekommen, das sollten z.B. die Document-BAPIs liefern.
Ist jetzt ein wenig wirr zusammenkopiert aus einer Klasse, die grundsätzliche Idee sollte aber klar sein. Falls nicht: bitte melden...