Skip to Content
Author's profile photo S M Firoz Ashraf

DMS – Linking Material Document in DIR and Displaying the attachments in MIGO.

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.

/wp-content/uploads/2012/10/1_146189.jpg

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

/wp-content/uploads/2012/10/2_146190.jpg

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

/wp-content/uploads/2012/10/3_146191.jpg

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

                        Copy document type PUR and name it ZMG

/wp-content/uploads/2012/10/4_146207.jpg

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.

/wp-content/uploads/2012/10/5_146210.jpg

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.

/wp-content/uploads/2012/10/6_146211.jpg

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).

/wp-content/uploads/2012/10/7_146212.jpg

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.

/wp-content/uploads/2012/10/8_146213.jpg

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.

Adding fields in strcuture MCDOKOB.jpg

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.

/wp-content/uploads/2012/10/9_146214.jpg

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.

/wp-content/uploads/2012/10/10_146215.jpg

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 syucomm = ‘ATT’.

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

            v_objkey TYPE dradobjky,i_tabdrad TYPE drad OCCURS 0.
IMPORT p1 = v_mblnr
p2 = v_gjahr
FROM MEMORY ID ‘MIGODMS’.
IF sysubrc = 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.

/wp-content/uploads/2012/10/11_146219.jpg

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_goitemmblnr

            p2 = cs_goitemmjahr

          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).

/wp-content/uploads/2012/10/12_146220.jpg

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’.

 

Assigned Tags

      12 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Atul Tulaskar
      Atul Tulaskar

      excellent Firoz...

      we have requirement of object link to the PO header level. Could u please help us?  

      Author's profile photo S M Firoz Ashraf
      S M Firoz Ashraf
      Blog Post Author

      Hi Atul,

      You may already have the FM OBJECT_CHECK_EKKO.in your system

      You simply need to do the first part as explained in my blog. Create your screen for PO header under function group CV130. You may copy screen 148 (which is for PO Item) and remove the item (EBELP). Just keep EBELN.

      Once you have done the first part find out the enhancement at PO Header level and call up the attachment list as explained in part B.

      Regards,

      Firoz.

      Author's profile photo Atul Tulaskar
      Atul Tulaskar

      Thanks Firoz. I will try as suggested above

      Author's profile photo Former Member
      Former Member

      Dear Firoz,

      Nice Blog

      when i do the same i got duplicate TAB for DMS attachment in MIGO(GRN) Transaction.

      and with this , I have tried out for HR the object is PLOGI with screen no 500 but not getting success, with same i am not able to get in to MIRO also

      which bapi i have to use for HR, MIRO  ???

      Kindly Do the needful

      Regards

      Tushar Dave

      Author's profile photo S M Firoz Ashraf
      S M Firoz Ashraf
      Blog Post Author

      Hi Tushar,

      Can u please share the screen shot where you are getting the duplicate tab in MIRO?

      Regards,

      Firoz.

      Author's profile photo Former Member
      Former Member

      Hi Firoz,

      Thanks to focus on my query,

      but i am sorry to say that i was facing that problem in May 27 2013 in one of my project

      after update of EHP it was automatically sort-out.

      For HR object i was recommended to use ARchiveLink

      But now in my new project with development client i want to do same for HR object (PLOGI) and MIGO(GRN) , and in Invoice generation (VF03)

      can you suggest for the same.

      Regards

      Tushar Dave

      Author's profile photo Bruno Esperança
      Bruno Esperança

      Amazing work. Thanks for sharing.

      BR,

      Bruno

      Author's profile photo Bharath Padmanabhan
      Bharath Padmanabhan

      Hi Firoz,

      The level of detail captured in this blog is amazing. Your narration style to capture every single possible issues along the way is extremely good!

       

      Thanks a million for taking your valuable time to condense several weeks of your hardwork for us.

      Cheers,

      Aspire

      Author's profile photo Mangesh Nirmale
      Mangesh Nirmale

      Very nice information. Thank you sharing

       

      Mangesh

      Author's profile photo karteek k
      karteek k

      Perfect explanation!

       

      Thank you,

      Karteek

      Author's profile photo S Abinath
      S Abinath

      Hi,

      Neat and detailed explanation --- Thanks for Sharing

      Author's profile photo Fatima Mustafayeva
      Fatima Mustafayeva

      Thanks for sharing Firoz,

      Also could you tell me please if it is possible to save an attachment file for hold migo document?

      As per my knoledge, attachment file itself is saved only if the document is posted.

      If it is not possible, could the DMS help out us  for  held migo document case?