Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
Firoz_Ashraf
Contributor


Requirement:     Users want that using transaction CV01N, they should be able to link the material document at header level and the same should be displayed in transaction MIGO.

Solution:             There are two parts involved in the whole process:

  1. Doing settings on DMS Side.

  2. Enhancing the MIGO Screen to display the list of attachments.


Let's go in detail on each part of the solution:

Part A - Doing settings on DMS Side.

(You may also refer to SAP Note 1417841 and Online SAP Help Documentation on this part)

Step No. 1:        Since we want the documents to be attached at header level. Hence find if your system has the function module OBJECT_CHECK_MKPF


                          If you do not have this FM then create it using the template of OBJECT_CHECK_MSEG or OBJECT_CHECK_EQUI and do the neccesary changes in the code so that data is read from MKPF instead of MSEG or Equipment Master table.


                          This FM is used to retrieve the header text to be displayed in the object link screen in CV01N.


Step No. 2:        Now using SE80, go to Package CV. Under Screens of function Group CV130,
create a subscreen (Copy screen 1204 to 9002 for example). Replace EQUI-EQUNR with MKPF-MBLNR and MKPF-MJHAR. Copy the same screen under CV140.


                        Kindly note that you have to take the access keys from SAP to create the subscreens under CV130 and CV140.


Step No. 3:        After you have created the screen 9002, ABAP development for the first part on DMS side is done. Now you need to
do the configuration in SPRO.


                          Go to SPRO--> Cross-Application Components --> Document Management --> Control
Data --> Maintain Key Fields


                          Create a new entry.


                          Table - MKPF,Transaction Code - MIGO, Field name - MBLNR, PID - MBN, Field Name - MJAHR, PID- MJA



Step No. 4:        Go to SPRO --> Cross-Application Components --> Document Management --> Control Data --> Maintain Screen for Object Link


                        Create a new entry.

                          SAP Object - MKPF,Screen - 9002



Step No. 5:        Go to SPRO --> Cross-Application Components --> Document Management --> Control Data --> Define Document Types


                        Copy document type PUR and name it ZMG



Next, click on 'Define object links'. Create new entry here.

Enter the the document type ZMG that you created above, enter MKPF under Object. Screen 9002 will automatically get picked. Save                          your entries.



This completes part A of the solution.

Now DIR can be created and attachments to material header document can be done in transaction CV01N.

To verify this go to CV01N and enter or select ZMG from the drop down and press enter.



Enter the description and document status in 'Document Data' tab and click on 'Open Original' icon at the bottom of the screen (marked 1 in the screen shot). This will open up a pop-up window to select the file that you want to attach. Next click on 'Check In Orig.' icon at the same bottom screen (marked 2).



Now click on tab 'Object Links' Here you can see your screen 9002 with two fields material Doc. and year. Enter and valid document, press enter and the doucment header 'Description' will get populated.



Note that you have to append two fields (MBLNR and MJAHR) in standard structure MCDOKOB for CV01N to retain the data entered in fields MBLNR and MJAHR.

If you don't maintain these fields in MCDOKOB then after entering the MBLNR and MJAHR values in the above sscreen when you press enter, the values will disappear.



Part B - Enhancing the MIGO Screen to display the list of attachments.

You need to use the BADI MB_MIGO_BADI to add a new header tab containing your screen with a button to show the list of attachments.


To acheive this follow the below steps:


Step No. 1:          Using SE80, create a subscreen under a seperate Z program. For example, screen 100 under ZMMM120.



Place a pushbutton on the screen and in the PAI, write a module (Say, MODULE GET_ATTACHMENT.)  to fetch the attachments.


The coding of this module could be:



MODULE get_attachment INPUT.


               CHECK sy-ucomm = 'ATT'.


               DATA: v_mblnr TYPE mblnr, v_gjahr TYPE gjahr, v_zeile TYPE mblpo,


            v_objkey TYPE drad-objky,i_tabdrad TYPE drad OCCURS 0.
IMPORT p1 = v_mblnr
p2 = v_gjahr
FROM MEMORY ID 'MIGODMS'.
IF sy-subrc = 0.
CONCATENATE v_mblnr v_gjahr INTO v_objkey.
FREE MEMORY ID 'MIGODMS'.



CALL FUNCTION 'DOCUMENT_ASSIGNMENT'
EXPORTING
dokob                     = 'MKPF'
objky                     = v_objkey
opcode                    = 3
TABLES
tabdrad                   = i_tabdrad.
ENDIF.
ENDMODULE.                 " GET_ATTACHMENT  INPUT


Note that the Doc.No. (MBLNR) and Doc. Year (MJAHR) will be IMPORTed from the point in BADI implementation where it has been EXPORTed to Memory ID 'MIGODMS'.

Once we get the Doc.No. and Doc. Year we will simply use the FM DOCUMENT_ASSIGNMENT using document object as MKPF and document key as MBLNR & MJAHR concatenated togeather.

Step No. 2:          After you have created your subscreen, go to SE19 and create an implementation of BADI MB_MIGO_BADI.


                            In the method PBO_HEADER do the following coding to call the subscreen that you created in the above step.


METHOD if_ex_mb_migo_badi~pbo_header .
e_cprog   = 'ZMMM0120'.
e_dynnr   = '0100'.                     "External fields: Input
e_heading = 'DMS Attachment List'.
* Export data to function group (for display on subscreen)
CALL FUNCTION 'MIGO_BADI_EXAMPLE_PUT_HEADER'
EXPORTING
is_migo_badi_header_fields = gs_exdata_header.
ENDMETHOD.


Next, in the method LINE_MODIFY do the following coding to EXPORT the Doc.No. and year to Memory ID.


METHOD if_ex_mb_migo_badi~line_modify.


          EXPORT p1 = cs_goitem-mblnr


            p2 = cs_goitem-mjahr


          TO MEMORY ID 'MIGODMS'.


ENDMETHOD.


Activate the BADI Implementaion and you are done !!

This completes the whole process of creating the DIR and displaying the attachment list on MIGO Header Screen.

To verify this go to transaction MIGO, enter any Doc. No. and press enter. You will find a new tab in the header havign a push button. Clicking this button generates a pop-up window showing all the attachments done through DIR (transaction CV01N).



References:

  1. SAP Notes: 1417841, 1066915

  2. SAP Online Help Documentation: http://help.sap.com/erp2005_ehp_04/helpdata/en/b2/c043a66fab11d1949500a0c92f024a/frameset.htm


Regards,

Firoz.

PS: Transaction CV04N might give Short Dump.To overcome this please do the following:

Using SE80, go to Package CV. Under Screens of function Group CV100, create a subscreen (Copy screen 1247 to 9002). Rename MCDOKOB-BANFN with MCDOKOB-MBLNR and MCDOKOB-BNFPO with MCDOKOB-MJAHR.

Save and activate the screen 9002.

Issue No. 1: The attachment push button is working only once. When the pop-up window is closed (being in the MIGO screen) and when trying to click the attachment button again, the pop-u[p window that shows the list of attachment is not opening.

Solution: Method PAI_DETAIL (IF_EX_MB_MIGO_BADI~PAI_DETAIL) of the BADI Implementation MB_MIGO_BADI should be activated and shold have the have the code:

e_force_change = 'X'.

 

12 Comments
Labels in this area