You are on page 1of 15

10/30/23, 4:55 PM DMS – Linking Material Document in DIR and Displaying the attachments in MIGO.

| SAP Blogs

Community

 A New Home in 
New Year for SAP
Community:
Exciting times
ahead for the SAP
Community! Read about the migration and join SAP Community Groups!

Not yet a member on


the new home? Join
today and start
participating in the
discussions!

Ask a Question Write a Blog Post Login

S M Firoz Ashraf
October 13, 2012 | 6 minute read

DMS – Linking Material Document in


DIR and Displaying the attachments
in MIGO.
Follow
 12  14  28,841

 Like
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
 RSS Feed transaction MIGO.

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

A. Doing settings on DMS Side.


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

https://blogs.sap.com/2012/10/13/dms-linking-material-document-in-dir-and-displaying-the-attachments-in-migo/ 1/15
10/30/23, 4:55 PM DMS – Linking Material Document in DIR and Displaying the attachments in MIGO. | SAP Blogs

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.


https://blogs.sap.com/2012/10/13/dms-linking-material-document-in-dir-and-displaying-the-attachments-in-migo/ 2/15
10/30/23, 4:55 PM DMS – Linking Material Document in DIR and Displaying the attachments in MIGO. | SAP Blogs

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

https://blogs.sap.com/2012/10/13/dms-linking-material-document-in-dir-and-displaying-the-attachments-in-migo/ 3/15
10/30/23, 4:55 PM DMS – Linking Material Document in DIR and Displaying the attachments in MIGO. | SAP Blogs

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.

https://blogs.sap.com/2012/10/13/dms-linking-material-document-in-dir-and-displaying-the-attachments-in-migo/ 4/15
10/30/23, 4:55 PM DMS – Linking Material Document in DIR and Displaying the attachments in MIGO. | SAP Blogs

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

https://blogs.sap.com/2012/10/13/dms-linking-material-document-in-dir-and-displaying-the-attachments-in-migo/ 5/15
10/30/23, 4:55 PM DMS – Linking Material Document in DIR and Displaying the attachments in MIGO. | SAP Blogs

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.

https://blogs.sap.com/2012/10/13/dms-linking-material-document-in-dir-and-displaying-the-attachments-in-migo/ 6/15
10/30/23, 4:55 PM DMS – Linking Material Document in DIR and Displaying the attachments in MIGO. | SAP Blogs

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:

https://blogs.sap.com/2012/10/13/dms-linking-material-document-in-dir-and-displaying-the-attachments-in-migo/ 7/15
10/30/23, 4:55 PM DMS – Linking Material Document in DIR and Displaying the attachments in MIGO. | SAP Blogs

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.

https://blogs.sap.com/2012/10/13/dms-linking-material-document-in-dir-and-displaying-the-attachments-in-migo/ 8/15
10/30/23, 4:55 PM DMS – Linking Material Document in DIR and Displaying the attachments in MIGO. | SAP Blogs

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

https://blogs.sap.com/2012/10/13/dms-linking-material-document-in-dir-and-displaying-the-attachments-in-migo/ 9/15
10/30/23, 4:55 PM DMS – Linking Material Document in DIR and Displaying the attachments in MIGO. | SAP Blogs

References:

1. SAP Notes: 1417841, 1066915


2. SAP Online Help Documentation:
http://help.sap.com/erp2005_ehp_04/helpdata/en/b2/c043a66fab11d194
9500a0c92f024a/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’.

Alert Moderator

Assigned Tags

PLM Document Management System (DMS)

MM Inventory Management

cv01n

dir

dms

firoz ashraf s blog

migo

https://blogs.sap.com/2012/10/13/dms-linking-material-document-in-dir-and-displaying-the-attachments-in-migo/ 10/15
10/30/23, 4:55 PM DMS – Linking Material Document in DIR and Displaying the attachments in MIGO. | SAP Blogs

View more... 

Similar Blog Posts 


Attaching document to MIGO object link via CV01 (DMS)
By Rachna Srivastava Aug 25, 2015

Document Management in SAP S/4HANA Cloud


By ANUPAMA CHANDRASEKHAR Jul 04, 2019

Content Repository Migration in mind ?


By Sagar Shridhar Bhide Dec 09, 2019

Related Questions 
DMS-Document attachment in MIRO
By Former Member May 04, 2010

Attach DIR at goods receipt and invoice,


By Former Member Jul 02, 2008

DMS configration for migo


By diwakar chaube Jul 02, 2013

12 Comments

You must be Logged on to comment or reply to a post.

Atul Tulaskar
October 16, 2012 at 10:12 am

excellent Firoz...

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

Like 0 | Share
https://blogs.sap.com/2012/10/13/dms-linking-material-document-in-dir-and-displaying-the-attachments-in-migo/ 11/15
10/30/23, 4:55 PM DMS – Linking Material Document in DIR and Displaying the attachments in MIGO. | SAP Blogs

S M Firoz Ashraf | Blog Post Author


October 17, 2012 at 11:54 am

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.

Like 0 | Share

Atul Tulaskar
October 17, 2012 at 12:01 pm

Thanks Firoz. I will try as suggested above

Like 0 | Share

Former Member
May 27, 2013 at 11:41 am

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

Like 0 | Share
https://blogs.sap.com/2012/10/13/dms-linking-material-document-in-dir-and-displaying-the-attachments-in-migo/ 12/15
10/30/23, 4:55 PM DMS – Linking Material Document in DIR and Displaying the attachments in MIGO. | SAP Blogs

S M Firoz Ashraf | Blog Post Author


September 10, 2013 at 5:28 am

Hi Tushar,

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

Regards,

Firoz.

Like 0 | Share

Former Member
September 10, 2013 at 5:59 am

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

Like 0 | Share

Bruno Esperança
March 3, 2014 at 9:49 am

Amazing work. Thanks for sharing.

BR,

Bruno

Like 1 | Share

https://blogs.sap.com/2012/10/13/dms-linking-material-document-in-dir-and-displaying-the-attachments-in-migo/ 13/15
10/30/23, 4:55 PM DMS – Linking Material Document in DIR and Displaying the attachments in MIGO. | SAP Blogs

Bharath Padmanabhan
May 16, 2017 at 2:22 am

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

Like 1 | Share

Mangesh Nirmale
October 5, 2017 at 11:00 am

Very nice information. Thank you sharing

Mangesh

Like 0 | Share

karteek k
October 9, 2017 at 3:16 pm

Perfect explanation!

Thank you,

Karteek

Like 0 | Share

https://blogs.sap.com/2012/10/13/dms-linking-material-document-in-dir-and-displaying-the-attachments-in-migo/ 14/15
10/30/23, 4:55 PM DMS – Linking Material Document in DIR and Displaying the attachments in MIGO. | SAP Blogs

S Abinath
June 23, 2020 at 4:21 pm

Hi,

Neat and detailed explanation --- Thanks for Sharing

Like 0 | Share

Fatima Mustafayeva
January 6, 2022 at 9:52 am

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?

Like 0 | Share

Find us on

Privacy Terms of Use

Legal Disclosure Copyright

Trademark Cookie Preferences

Newsletter Support

https://blogs.sap.com/2012/10/13/dms-linking-material-document-in-dir-and-displaying-the-attachments-in-migo/ 15/15

You might also like