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: 
Introduction:

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.

Requirement:

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.

Solution:

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
EXPORTING
i_doc = gs_doc
IMPORTING
e_url = gv_url.

IF NOT gv_url IS INITIAL.

“create thumbnail-object for the container in your dynpro

CREATE OBJECT gr_thumbnail
EXPORTING
container_name = ‘ZIMG’.

“create the picture instance

CREATE OBJECT gr_picture
EXPORTING
parent = gr_thumbnail.

“set display mode for the picture

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

“load the picture

gr_picture->load_picture_from_url_async( url = gv_url ).

ENDIF.

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

SHIFT dp_doknr LEFT DELETING LEADING ‘0’.

ENDMODULE.

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

FUNCTION-POOL ZMM01_IMG
MESSAGE-ID M3.

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

INCLUDE MMMGTRBB.
INCLUDE MMMGBBAU.
*—————————–
INCLUDE wstr_definition. “Holds BADI global definition

INCLUDE LMGD1IV0.   “IS2ERP

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.

TYPES:BEGIN OF ty_drad,
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


Conclusion:

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

 
2 Comments
Labels in this area