SAP offers limited DMS Objects in standard system and there is always a requirement to have Custom DMS Objects. This is a detailed step-by-step guide to create Custom DMS Objects in SAP system.
In this article, we will use standard LIKP table and ZVENDCERT custom table for DMS Objects.
Table name should not exceed 10 characters, which will be our DMS Object
SAP IMG -> Cross-Application Components -> Document Management -> Control Data -> Maintain Key Fields
• LIKP table has only one key field i.e. VBELN and it is already in MCDOKOB structure, so no need to append MCDOKOB structure.
• ZVENDCERT table key fields are LIFNR, CERT_TYPE, CERT_NUMB, BEGDA, ENDDA. We will skip LIFNR because it is already there in MCDOKOB structure. Append MCDOKOB structure accordingly.
This step will add our Custom Object in DMS Object List. Just enter your Language, Custom Object and Object Description. F4 Help of Object field will not show our Custom Object unless you save this entry.
SAP IMG -> Cross-Application Components -> Document Management -> Control Data -> Define Document Types -> Maintain Object Link Descriptions
SAP IMG -> Cross-Application Components -> Document Management -> Control Data -> Define Document Types
We have 2 methods to create Object Links for our Custom DMS Objects:
• BAdI Enhancement
• Modification
We will create LIKP Object Link through BAdI and ZVENDCERT from Modification
BAdI DOCUMENT_OBJ is defined so that you can integrate your own objects in transactions for document management (CV01N, CV02N, CV03N, CV04N) without modification.
I have used the logics from existing Implementations of DOCUMENT_OBJ BAdI and have tried to keep them simple as possible for better understanding.
SAP has provided Screen 1500 in CV130/CV100 Function Groups to handle DOCUMENT_OBJ BAdI Objects. Object Links created via DOCUMENT_OBJ BAdI will always have Screen/Dynpro 500 in SPRO screens instead of 1500. We need to link our Document Type with an Object. So, we create the following entry for our newly created Document Type DLH.
SAP IMG -> Cross-Application Components -> Document Management -> Control Data -> Define Document Types -> Define Object Links
Create an entry with LIKP Object and Screen 500
SAP IMG -> Cross-Application Components -> Document Management -> Control Data -> Maintain Screen for Object Link
Add LIKP Object in Filter Value
Add the following code blocks in our Implementation class methods.
METHOD if_ex_document_obj~get_data.
MOVE if_ex_document_obj~table_drad_db TO table_drad_db.
MOVE if_ex_document_obj~table_drad_work TO table_drad_work.
MOVE if_ex_document_obj~draw TO draw.
MOVE if_ex_document_obj~activity TO activity.
ENDMETHOD.
METHOD if_ex_document_obj~put_data.
MOVE table_drad_db TO if_ex_document_obj~table_drad_db.
MOVE table_drad_work TO if_ex_document_obj~table_drad_work.
MOVE draw TO if_ex_document_obj~draw.
MOVE activity TO if_ex_document_obj~activity.
DELETE if_ex_document_obj~table_drad_db WHERE dokob NE flt_val.
ENDMETHOD.
METHOD if_ex_document_obj~object_check.
“ Insert your custom logic for OBJECT_CHECK method
DATA vbeln TYPE vbeln_vl.
vbeln = ls_obtab-objek.
SELECT SINGLE FROM likp WHERE vbeln = @vbeln INTO (delivery_valid).
IF delivery_valid <> abap_true.
RAISE object_not_found.
ENDIF.
ENDMETHOD.
METHOD if_ex_document_obj~jump_to_screen.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
ENDMETHOD.
Create a Function Group and Screen as Subscreen type. Enter Program called as ‘SAPL<Z FUNCTION GROUP>’ with Screen and create the following entry in Implementation Subscreens tab:
Note: Z Program name and Screen can also be added.
Function Group Data Declarations in TOP include:
CONTROLS: tc TYPE TABLEVIEW USING SCREEN 9002.
TYPES: BEGIN OF ty_tab,
vbeln TYPE vbeln_vl.
INCLUDE STRUCTURE dms_drad_badi_work.
TYPES: END OF ty_tab.
CONSTANTS: dms_object TYPE dokob VALUE 'LIKP'.
DATA: itab TYPE TABLE OF ty_tab,
wa TYPE ty_tab,
object_instance TYPE REF TO if_ex_document_obj,
table_drad_work TYPE dms_tbl_drad_badi_work,
wa_drad_work TYPE dms_drad_badi_work,
table_drad_db TYPE TABLE OF drad,
draw TYPE draw,
activity TYPE i,
vbeln TYPE vbeln_vl,
tabdrad TYPE STANDARD TABLE OF drad,
vb_flag TYPE flag.
Screen 9002 Flow Logic:
MODULE init.
LOOP AT itab INTO wa WITH CONTROL tc CURSOR tc-current_line.
MODULE set_data.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT itab.
CHAIN.
FIELD: wa-vbeln.
FIELD: wa-tab_mark. “ table control mark field
MODULE get_data ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
MODULE put_data.
PBO Modules:
MODULE init OUTPUT.
cl_exithandler=>get_instance_for_subscreens(
CHANGING
instance = object_instance ).
object_instance->get_data(
EXPORTING
flt_val = dms_object
IMPORTING
table_drad_work = table_drad_work
table_drad_db = table_drad_db
draw = draw
activity = activity ).
LOOP AT table_drad_work INTO wa_drad_work WHERE objky IS NOT INITIAL.
CLEAR wa.
MOVE-CORRESPONDING wa_drad_work TO wa.
wa-vbeln = wa-objky.
READ TABLE itab WITH KEY vbeln = wa-objky TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
APPEND wa TO itab.
ENDIF.
ENDLOOP.
ENDMODULE.
MODULE set_data OUTPUT.
IF activity = 3.
LOOP AT SCREEN.
IF screen-name = 'WA-VBELN'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
DATA(lines) = lines( itab ).
tc-lines = lines + 1.
ENDIF.
ENDMODULE.
PAI Modules:
MODULE get_data INPUT.
IF wa-vbeln IS NOT INITIAL.
SELECT SINGLE FROM likp WHERE vbeln = -vbeln INTO (delivery_valid).
IF delivery_valid = abap_false.
SET CURSOR FIELD 'WA-VBELN' LINE tc-current_line.
MESSAGE 'Delivery not valid' TYPE 'E'.
ENDIF.
READ TABLE itab WITH KEY vbeln = wa-vbeln TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
MODIFY itab FROM wa INDEX tc-current_line.
ELSE.
APPEND wa TO itab.
ENDIF.
ENDIF.
ENDMODULE.
MODULE put_data INPUT.
cl_exithandler=>get_instance_for_subscreens(
CHANGING
instance = object_instance ).
LOOP AT itab INTO wa.
CLEAR wa_drad_work.
MOVE-CORRESPONDING wa TO wa_drad_work.
wa_drad_work-objky = wa-vbeln.
APPEND wa_drad_work TO table_drad_work.
ENDLOOP.
object_instance->put_data(
EXPORTING
table_drad_work = table_drad_work
table_drad_db = table_drad_db
flt_val = dms_object
activity = activity ).
ENDMODULE.
Create a document with DLH document type and enter a valid Delivery number in Object Links tab in CV01N. Object Linkage is completed between DMS Object and Document Type.
To integrate DMS functionality in Delivery transactions VL0xN, we have created a Custom Tab (Screen 9001) in Delivery header with DMS Attachment button with the following logic:
Screen 9001 Flow Logic:
PROCESS BEFORE OUTPUT.
PROCESS AFTER INPUT.
MODULE user_command_9001.
PAI Modules:
MODULE user_command_9001 INPUT.
IF sy-ucomm = 'ATTACH'.
IMPORT p1 = vbeln FROM MEMORY ID 'ZDELIVERY'.
CASE sy-tcode.
WHEN 'VL02N'.
DATA(mode) = 1.
WHEN 'VL03N'.
mode = 3.
ENDCASE.
CALL FUNCTION 'DOCUMENT_ASSIGNMENT'
EXPORTING
check_exist = abap_true
dokob = dms_object
objky = CONV drad-objky( vbeln )
opcode = mode " 1=Create 2=Change 3=Display
IMPORTING
vb_flag = vb_flag
TABLES
tabdrad = tabdrad.
IF vb_flag IS NOT INITIAL AND tabdrad IS NOT INITIAL.
MODIFY drad FROM TABLE tabdrad.
IF sy-subrc = 0.
COMMIT WORK AND WAIT.
ELSE.
ROLLBACK WORK.
ENDIF.
ENDIF.
CLEAR sy-ucomm.
ENDIF.
ENDMODULE.
Modification is possible with Access Key provided from SAP. We will create Object Link for ZVENDCERT Custom DMS Object. Custom DMS Objects can be added through Modification according to SAP:
SAP Note 1417841 - FAQ: Document management
7. Question: Can other SAP objects also be added for linking to documents?
Answer: Yes. In principle, any SAP object can be added using a modification. You will find a short guide about this in the SAP Library (SAP Library -> SAP ERP Cross-Application Functions -> Cross-Application Components -> Document Management -> Document Info Record -> Linking Objects to a Document -> Adding Other Objects)
The documentation has been kept brief intentionally because, for technical reasons, the requirements differ from object to object and we cannot go into object-specific details in general documentation. Bear in mind that the interface must be programmed on both the DMS side and the object side when other objects are added. Additional SAP objects should be added by experienced ABAP developers only.
SAP Note 2429909 - DMS Standard Object Links where to find/Procedure if non standard object used
4. If you are trying to use NON STANDARD OBJECT link to what is listed above. And wish to create a link to Non Standard Object. You may refer to online documentation Referencing CV100 & CV130. The documentation in the provided links has been kept brief intentionally because, for technical reasons, the requirements differ from object to object and we cannot go into object specific details in general documentation. Bear in mind that the interface must be programmed on both the DMS side and the object side when the objects are added. Additional SAP objects should be added by experienced ABAP developers only. So I truly recommend you to contact your local consulting organization on this.
Copy any screen from CV130 FG Screens to 900X
Add our Custom DMS Object ZVENDCERT fields in its table control:
Copy newly created Screen 9001 to Function Group CV100 and CV140
Copy any standard OBJECT_CHECK_XXX function module, like OBJECT_CHECK_EQUI or OBJECT_CHECK_PMAUFK, and name it as our custom DMS Object name as OBJECT_CHECK_ZVENDCERT. We can use any Function Group. This FM is used to validate the entered data in our screen 9001. Change your logic accordingly.
FUNCTION object_check_zvendcert.
TABLES: zvendcert.
DATA: BEGIN OF lt_objecttab OCCURS 0.
INCLUDE STRUCTURE cltable.
DATA: END OF lt_objecttab.
DATA: BEGIN OF lt_tdskey OCCURS 0,
lifnr TYPE lifnr,
cert_type TYPE zvendcert_type,
cert_numb TYPE zvendcert_numb,
begda TYPE begda,
endda TYPE endda.
DATA: END OF lt_tdskey.
"--------------------------------------------
CLEAR no_auth.
CLEAR message_type.
CLEAR fault_text.
IF single IS NOT INITIAL.
READ TABLE otab INDEX 1.
lt_tdskey = otab-objek.
SELECT SINGLE * FROM zvendcert
WHERE lifnr = lt_tdskey-lifnr
AND cert_type = lt_tdskey-cert_type
AND cert_numb = lt_tdskey-cert_numb
AND begda = lt_tdskey-begda
AND endda = lt_tdskey-endda.
IF syst-subrc EQ 0.
otab-obtxt = 'Vendor Certificate'(001).
MODIFY otab INDEX 1.
IF called_from = 2.
lt_objecttab-tname = 'ZVENDCERT'.
CALL METHOD cl_abap_container_utilities=>fill_container_c
EXPORTING
im_value = zvendcert
IMPORTING
ex_container = lt_objecttab-table
EXCEPTIONS
illegal_parameter_type = 1
OTHERS = 2.
APPEND lt_objecttab.
CALL FUNCTION 'CTMS_OBJECT_AREA'
TABLES
objects = lt_objecttab.
ENDIF.
ELSE.
otab-obtxt = 'Vendor Certificate not valid'(002).
RAISE object_not_found.
ENDIF.
ENDIF.
ENDFUNCTION.
SAP IMG -> Cross-Application Components -> Document Management -> Control Data -> Define Document Types
Create new entry to add linkage for our newly created ZVC Document Type (in 5.2.3) to Object Link ZVENDCERT with Screen 9001
Create an entry with ZVENDCERT Object and Screen 9001
SAP IMG -> Cross-Application Components -> Document Management -> Control Data -> Maintain Screen for Object Link
Now we can create our ZVENDCERT Object Document with ZVC Document Type. Now we can integrate our DMS Object in our transaction.
SAP Document Management System (Documentation)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 |