Skip to Content
Technical Articles
Author's profile photo Lalitha Varalakshmi C S

Display Material Picture in Material Master Screens MM01/MM02/MM03


This blog post will guide you to create a custom sub screen in the basic data tab of the material master transactions.which displays the picture of the corresponding material stored in the DMS.


The requirement is to create a sub screen in the basic data tab of the material master transactions.The custom screen is used to display its corresponding image from DMS.

With the help of custom function group and SPRO configuration to the screens,we will be able to achieve this.

we need to make sure the material picture is saved in DMS and the DMS configurations are in place.

We can retrieve the image corresponding to the material using simple query and setting up a  custom container in the screen to show the image.


1.Create a Function Group starting with (ZMM) in se80.

2.Navigate to Screen Number :0001

Creation of function group


3.In the Flow logic tab,create a method for PBO module .Type the below code in PBO method to fetch the image from the DMS and bind it to container in the subscreeen.

MODULE get_data_pbo OUTPUT.
GET PARAMETER ID ‘MAT’ FIELD w_matnr.”Fetching the material number

SELECT SINGLE dokar doknr dokvr doktl objky
FROM drad
INTO wa_drad
WHERE objky = w_matnr.

SELECT SINGLE dokar doknr dokvr doktl
FROM draw
INTO gs_doc
WHERE dokar = wa_drad-dokar
AND   doknr = wa_drad-doknr
AND   dokvr = wa_drad-dokvr
AND   doktl = wa_drad-doktl.
CALL METHOD cl_dms_thumbnail_display=>get_url
i_doc = gs_doc
e_url = gv_url.


“create thumbnail-object for the container in your dynpro

CREATE OBJECT gr_thumbnail
container_name = ‘ZIMG’.

“create the picture instance

CREATE OBJECT gr_picture
parent = gr_thumbnail.

“set display mode for the picture

CALL METHOD gr_picture->set_display_mode
display_mode = gr_picture->display_mode_fit_center.

“load the picture

gr_picture->load_picture_from_url_async( url = gv_url ).


dp_dokar = gs_doc-documenttype.
dp_doknr = gs_doc-documentnumber.
dp_dokvr = gs_doc-documentversion.
dp_doktl = gs_doc-documentpart.



4.Create a method for PAI module and copy the below code.

PAI module

5.Write the below code in the Include Name: LZMM01_IMGTOP


*TF 4.6C Materialfixierung=================================
INCLUDE <icon>.
*TF 4.6C Materialfixierung=================================

INCLUDE wstr_definition. “Holds BADI global definition


DATA: gv_url       TYPE dms_url,
gs_doc       TYPE bapi_doc_keys,
gr_thumbnail TYPE REF TO cl_gui_custom_container,
gr_picture   TYPE REF TO cl_gui_picture,
g_okcode     TYPE sy-ucomm.

DATA:  dp_dokar TYPE tdline
,dp_doknr TYPE tdline
,dp_dokvr TYPE tdline
,dp_doktl TYPE tdline.

DATA:w_matnr TYPE matnr.

dokar TYPE drad-dokar,
doknr TYPE drad-doknr,
dokvr TYPE drad-dokvr,
doktl TYPE drad-doktl,
objky TYPE drad-objky,
END OF ty_drad.

DATA:it_drad TYPE TABLE OF ty_drad,
wa_drad TYPE ty_drad.

6.Create a Screen similar to this screen to show the material image:

Sub screen to show the material image

7.Make the below configuration changes in Spro:

  • 7.1 Go to spro->Logistics-General->Material Master -> Configuring the Material Master ->Define Structure of Data Screens for Each Screen Sequence
  • 7.2 Click on the Basic Data screen and navigate to Data Screen in the dialog structure tab.
  • 7.3 Click on the Basic data 1 and go to sub screens.
  • 7.4 Change the screen name to your Function group name

Simulation Screenshot of your custom screen in MM01.

Sample Screen

Final Output of Material Picture in MM03 screen:

Final Output


With this,we will be able to retrieve the picture from DMS and display it in our custom screen in Material master transactions.

Please leave your valuable feedback and your questions regarding this blog in the comment section.

Thanks & Regards,

Lalitha Varalakshmi C S

SAP Technical Consultant


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Giuseppe Caselli
      Giuseppe Caselli

      Hi Lalitha, thaks for your post.

      Is it possible to do the same thing in a custom transaction?


      I have defined a container but the image is not displayed.

      Are there other ABAP institutions?


      Best regards,

      Giuseppe C.


      Author's profile photo Tamara DEFEVER
      Tamara DEFEVER

      Hello, can this be linked when creating a CO01? I mean, I want that this particular pdf file set in MM is visible also when creating a production order of this particular item set in MM so the attachement would be visible in this order.

      The issue is here that in production the quality department desires when a production order is created that also a pdf linked to this item should be print out.( pdf with info of the material such as measurements and weights to look into to)

      I know that the method is available in CO02 but this would be much easier that this is coming directly from the material master so no repeat each time when creating a CO01 and after do the change in CO02.