Skip to Content

How to maintain Linked SAP Object in DMS?

Hi All,

I want to know How to maintain Linked SAP Object in DMS?

is there any tutorial for that? I want to create a new one.

thanks in advance

Best Regards,

Felix

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Mar 17 at 02:34 AM

    Hi Felix,

    Object links are maintained for Document type in DC10. SEe below image.

    Further to add custom objct type, below are steps

    •Define Object type in DMS : Control Data-> Maintain Key Fields

    •Maintain Screen for Object Link : Sepcify the screen ( if it is custom specify no as 50 , auth -1 , so that screen 1500 is called of SAPLCV130 program which further calls the defined subscreen)

    •Define the object type in “Define Document Types”à Define object links , with the screen no defined above •If it is a custom object type ; you will need to create a new screen in module pool program Cv130 & cv140 ; follow below link implementing badi document_obj

    https://help.sap.com/erp2005_ehp_02/helpdata/en/cb/e5e4535dd4414de10000000a174cb4/frameset.htm

    BR,

    Rini

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 19 at 07:18 AM

    Hi Felix,

    First you need to know creation of DIR(Document info record). Then you need to define the characteristics. finally you need to link your file or attachment to DIR.

    Find some code below to create DIR.

    DATA :
    ls_doc_change TYPE bapi_doc_drawx2,
    ls_characteristicvalues TYPE bapi_characteristic_values,
    lt_characteristicvalues TYPE tt_bapi_characteristic_values.
    *
    CLEAR : ev_docnumber ,es_dir_dtls, es_return.
    *
    ***Getting the project no.
    READ TABLE xt_characteristicvalues ASSIGNING FIELD-SYMBOL(<ls_characteristicvalues>) WITH KEY charname = c_xg_001.
    IF sy-subrc IS INITIAL.
    MOVE <ls_characteristicvalues> TO ls_characteristicvalues.
    APPEND ls_characteristicvalues TO lt_characteristicvalues.
    CLEAR : ls_characteristicvalues.
    ENDIF.
    ***Removing project no from rest characteristics
    DELETE xt_characteristicvalues WHERE charname = c_xg_001.

    IF iv_flag EQ 1 OR iv_flag EQ 3 OR iv_flag EQ 4.
    * Create document info record based on the importing parameters for non cbe forms
    IF is_form_identifier-cbe_form EQ space.
    CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
    EXPORTING
    documentdata = is_doc
    pf_http_dest = c_http_dest
    pf_ftp_dest = c_ftp_dest
    IMPORTING
    documenttype = es_dir_dtls-dokar
    documentnumber = es_dir_dtls-doknr
    documentpart = es_dir_dtls-doktl
    documentversion = es_dir_dtls-dokvr
    return = es_return
    TABLES
    characteristicvalues = lt_characteristicvalues[]
    classallocations = xt_classallocations[]
    documentdescriptions = xt_documentdescriptions[]
    objectlinks = xt_objectlinks[]
    documentfiles = xt_documentfiles[].
    ELSE.
    * Create document info record based on the importing parameters for cbe forms
    DATA(ls_doc) = is_doc.
    ls_doc-username = sy-uname.
    ls_doc-createdate = sy-datum.
    ls_doc-authoritygroup = space.
    *
    CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
    EXPORTING
    documentdata = ls_doc
    pf_http_dest = c_http_dest
    pf_ftp_dest = c_ftp_dest
    IMPORTING
    documenttype = es_dir_dtls-dokar
    documentnumber = es_dir_dtls-doknr
    documentpart = es_dir_dtls-doktl
    documentversion = es_dir_dtls-dokvr
    return = es_return
    TABLES
    characteristicvalues = lt_characteristicvalues[]
    classallocations = xt_classallocations[]
    documentdescriptions = xt_documentdescriptions[]
    objectlinks = xt_objectlinks[].
    IF es_return-type NA c_msg_error_abort.
    * Execute BAPI to perform commit
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    WAIT UP TO 1 SECONDS.
    *
    LOOP AT xt_documentfiles ASSIGNING FIELD-SYMBOL(<ls_documentfiles>).
    <ls_documentfiles>-documenttype = es_dir_dtls-dokar.
    <ls_documentfiles>-documentnumber = es_dir_dtls-doknr.
    <ls_documentfiles>-documentpart = es_dir_dtls-doktl.
    <ls_documentfiles>-documentversion = es_dir_dtls-dokvr.
    ENDLOOP.
    UNASSIGN <ls_documentfiles>.
    CLEAR : es_return.
    * Checkin the document files
    CALL FUNCTION 'BAPI_DOCUMENT_CHECKIN2'
    EXPORTING
    documenttype = es_dir_dtls-dokar
    documentnumber = es_dir_dtls-doknr
    documentpart = es_dir_dtls-doktl
    documentversion = es_dir_dtls-dokvr
    IMPORTING
    return = es_return
    TABLES
    documentfiles = xt_documentfiles[].
    ENDIF.
    ENDIF.
    *
    IF es_return-type CA c_msg_error_abort.
    * Execute external Rollback using BAPI
    CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
    ELSE.
    IF iv_docutype = c_doctype_u. " 'U'.
    ev_docnumber = es_dir_dtls-doknr.
    ENDIF.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    WAIT UP TO 1 SECONDS.
    ***Updating the rest characteristics
    CLEAR : ls_doc.
    ls_doc-documenttype = es_dir_dtls-dokar.
    ls_doc-documentversion = es_dir_dtls-dokvr.
    ls_doc-documentpart = es_dir_dtls-doktl.
    ls_doc-documentnumber = es_dir_dtls-doknr.
    CALL FUNCTION 'BAPI_DOCUMENT_CHANGE2'
    EXPORTING
    documenttype = es_dir_dtls-dokar
    documentnumber = es_dir_dtls-doknr
    documentpart = es_dir_dtls-doktl
    documentversion = es_dir_dtls-dokvr
    documentdata = ls_doc
    documentdatax = ls_doc_change
    IMPORTING
    return = es_return
    TABLES
    classallocations = xt_classallocations[]
    characteristicvalues = xt_characteristicvalues[].
    IF es_return-type CA c_error_abort.
    CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
    ELSE.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    WAIT UP TO 1 SECONDS.
    ENDIF.
    *
    * Update structure for INSPECTION/EXPEDITING
    IF is_form_identifier-ei_ins_rprt_po = abap_true OR
    is_form_identifier-ei_exp_rprt_po = abap_true.
    xs_eirptdms-c_doc_num = es_dir_dtls-doknr.
    xs_eirptdms-c_doc_typ = es_dir_dtls-dokar.
    xs_eirptdms-c_doc_ver = es_dir_dtls-dokvr.
    xs_eirptdms-c_doc_par = es_dir_dtls-doktl.
    ENDIF.

    * Update the external numbers for the DIR
    IF es_dir_dtls-doknr IS NOT INITIAL.
    CALL METHOD update_ext_number
    EXPORTING
    iv_doctype = es_dir_dtls-dokar
    iv_docno = es_dir_dtls-doknr
    iv_docpart = es_dir_dtls-doktl
    iv_docver = es_dir_dtls-dokvr.
    ENDIF.

    * Do COMMIT and change the status
    IF is_form_identifier-rem_exp_po = abap_true OR
    is_form_identifier-rem_opp_po = abap_true OR
    is_form_identifier-rem_ari_po = abap_true OR
    is_form_identifier-rem_itp_po = abap_true OR
    is_form_identifier-rem_msr_po = abap_true OR
    is_form_identifier-rem_del_po = abap_true OR
    is_form_identifier-rem_subitem_po = abap_true OR
    is_form_identifier-urg_del_po = abap_true OR
    is_form_identifier-ei_pim_po = abap_true OR
    is_form_identifier-ei_ari_po = abap_true OR
    is_form_identifier-ei_opp_po = abap_true OR
    is_form_identifier-ei_ins_rprt_po = abap_true OR
    is_form_identifier-ei_exp_rprt_po = abap_true OR
    is_form_identifier-ei_waiver_po = abap_true OR
    is_form_identifier-ei_anncmnt_po = abap_true OR
    is_form_identifier-rem_rfq = abap_true OR
    is_form_identifier-urging_rfq = abap_true OR
    is_form_identifier-cbe_form = abap_true OR
    is_form_identifier-po_form_priced = abap_true OR "
    is_form_identifier-po_form_unpriced = abap_true OR
    is_form_identifier-inq_rfq = abap_true OR
    is_form_identifier-contract_form = abap_true.
    *
    * Set status of DIR to FC
    CALL METHOD set_status
    EXPORTING
    iv_documenttype = es_dir_dtls-dokar
    iv_documentnumber = es_dir_dtls-doknr
    iv_documentpart = es_dir_dtls-doktl
    iv_documentversion = es_dir_dtls-dokvr.
    ENDIF.
    ENDIF.
    *
    ELSE.
    * Create new version of the DIR
    CLEAR es_return.
    IF is_form_identifier-cbe_form NE abap_true.
    * NON CBE forms
    CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
    EXPORTING
    documentdata = is_doc
    pf_http_dest = c_http_dest
    pf_ftp_dest = c_ftp_dest
    IMPORTING
    documenttype = es_dir_dtls-dokar
    documentnumber = es_dir_dtls-doknr
    documentpart = es_dir_dtls-doktl
    documentversion = es_dir_dtls-dokvr
    return = es_return
    TABLES
    characteristicvalues = lt_characteristicvalues[]
    classallocations = xt_classallocations[]
    documentdescriptions = xt_documentdescriptions[]
    objectlinks = xt_objectlinks[]
    documentfiles = xt_documentfiles[].
    ELSE.
    * CBE forms
    ls_doc = is_doc.
    ls_doc-username = sy-uname.
    ls_doc-createdate = sy-datum.
    ls_doc-authoritygroup = space.
    *
    CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
    EXPORTING
    documentdata = ls_doc
    pf_http_dest = c_http_dest
    pf_ftp_dest = c_ftp_dest
    IMPORTING
    documenttype = es_dir_dtls-dokar
    documentnumber = es_dir_dtls-doknr
    documentpart = es_dir_dtls-doktl
    documentversion = es_dir_dtls-dokvr
    return = es_return
    TABLES
    characteristicvalues = lt_characteristicvalues[]
    classallocations = xt_classallocations[]
    documentdescriptions = xt_documentdescriptions[]
    objectlinks = xt_objectlinks[].
    IF es_return-type NA c_msg_error_abort.
    * Execute BAPI to perform commit
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    WAIT UP TO 1 SECONDS.
    *
    LOOP AT xt_documentfiles ASSIGNING <ls_documentfiles>.
    <ls_documentfiles>-documenttype = es_dir_dtls-dokar.
    <ls_documentfiles>-documentnumber = es_dir_dtls-doknr.
    <ls_documentfiles>-documentpart = es_dir_dtls-doktl.
    <ls_documentfiles>-documentversion = es_dir_dtls-dokvr.
    ENDLOOP.
    UNASSIGN <ls_documentfiles>.
    CLEAR : es_return.
    * Checkin the document files
    CALL FUNCTION 'BAPI_DOCUMENT_CHECKIN2'
    EXPORTING
    documenttype = es_dir_dtls-dokar
    documentnumber = es_dir_dtls-doknr
    documentpart = es_dir_dtls-doktl
    documentversion = es_dir_dtls-dokvr
    IMPORTING
    return = es_return
    TABLES
    documentfiles = xt_documentfiles[].
    ENDIF.
    ENDIF.
    *
    IF es_return-type CA c_error_abort. " 'EA'.
    * Execute external Rollback using BAPI
    CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
    ELSE.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    WAIT UP TO 1 SECONDS.
    ***Updating the rest characteristics
    CLEAR : ls_doc.
    ls_doc-documenttype = es_dir_dtls-dokar.
    ls_doc-documentversion = es_dir_dtls-dokvr.
    ls_doc-documentpart = es_dir_dtls-doktl.
    ls_doc-documentnumber = es_dir_dtls-doknr.
    CALL FUNCTION 'BAPI_DOCUMENT_CHANGE2'
    EXPORTING
    documenttype = es_dir_dtls-dokar
    documentnumber = es_dir_dtls-doknr
    documentpart = es_dir_dtls-doktl
    documentversion = es_dir_dtls-dokvr
    documentdata = ls_doc
    documentdatax = ls_doc_change
    IMPORTING
    return = es_return
    TABLES
    classallocations = xt_classallocations[]
    characteristicvalues = xt_characteristicvalues[].
    IF es_return-type CA c_error_abort.
    CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
    ELSE.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    WAIT UP TO 1 SECONDS.
    ENDIF.
    IF is_form_identifier-ei_ins_rprt_po = abap_true OR
    is_form_identifier-ei_exp_rprt_po = abap_true.
    xs_eirptdms-c_doc_num = es_dir_dtls-doknr.
    xs_eirptdms-c_doc_typ = es_dir_dtls-dokar.
    xs_eirptdms-c_doc_ver = es_dir_dtls-dokvr.
    xs_eirptdms-c_doc_par = es_dir_dtls-doktl.
    ENDIF.

    * Update the external numbers for the DIR
    IF es_dir_dtls-doknr IS NOT INITIAL.
    CALL METHOD update_ext_number
    EXPORTING
    iv_doctype = es_dir_dtls-dokar
    iv_docno = es_dir_dtls-doknr
    iv_docpart = es_dir_dtls-doktl
    iv_docver = es_dir_dtls-dokvr.
    ENDIF.

    * Set status of DIR to FC
    CALL METHOD set_status
    EXPORTING
    iv_documenttype = es_dir_dtls-dokar
    iv_documentnumber = es_dir_dtls-doknr
    iv_documentpart = es_dir_dtls-doktl
    iv_documentversion = es_dir_dtls-dokvr.
    ENDIF.

    ENDIF.

    Add comment
    10|10000 characters needed characters exceeded