Introduction:
In this blog I am going to explain how to add additional tab and print preview button in MIGO Transaction.
Normally in MIGO Transaction there is no standard print preview button available to preview the forms. Only way to preview the Form layout is by using another transaction MB90 only, But there is an way to achieve the print preview using a BADI by adding a custom tab and a print preview button to view the form layout.
Disclaimer: The Program name and other details I am using in this blog is from demo system only and this is only for learning purpose.
Steps to follow:
I’ve come up solution that we are going to use Standard BADI “MB_MIGO_BADI” to add the custom tab in MIGO Screen.
Step 1:
In the Step 1, we are going to create BADI Implementation to add the logics.
Goto SE18, Enter the BADI name and Click Enhancement Implementation–>Create.
Provide Enhancement Implementation Name & descriptions.
Create Implementing Class.
Inside the method “PBO_DETAIL”, we are going to add the code logics.
Select PBO_DETAIL Method in the BADI
Logics to be added in the PBO_DETAIL Method,
DATA : LS_EXTDATA TYPE MIGO_BADI_EXAMPLE_SCREEN_FIELD.
CLEAR : E_HEADING,E_CPROG,E_DYNNR .
IF I_CLASS_ID = 'MIGO_BADI_IMPLEMENTATION_CIN'.
E_HEADING = 'Print Preview'.
E_CPROG = 'ZMIGO_ADD_SCREEN'.
E_DYNNR = '9000'.
ENDIF.
Note :
◉ In E_HEADING, add your custom tab name.
◉ In E_CPROG, add your custom developed module pool program name.
◉ In E_DYNNR, add your custom developed module pool screen number.
we need the Material Document number (MBLNR) and Fiscal year(MJAHR) values to pass the data to our custom developed module pool program. So we are going to use the STATUS_AND_HEADER Method,
select STATUS_AND_HEADER method in the BADI
Here in the method we are getting the MBLNR and MJAHR values,
DATA : cs_gohead1 TYPE gohead,
LV_ID TYPE C LENGTH 30.
MOVE-CORRESPONDING is_gohead TO cs_gohead1.
CONCATENATE sy-uname 'MIGOPRINT' INTO LV_ID.
EXPORT cs_gohead FROM cs_gohead1 TO MEMORY ID LV_ID.
Note :
- Here we used SY-UNAME with ‘MIGOPRINT’ to produce the Export ID as dynamic, so that it wont affect when multiple users access the MIGO Transaction at the same time.
Step 2 :
In this Step 2, we are going to create custom module pool program in SE38.
Create a custom Screen with Number For example “9000” and add a button with FctCODE = “PRINT”,
Logics to be added in Custom Developed Module pool program,
In Process After Input Module,
DATA : cs_gohead TYPE gohead,
cs_gohead1 TYPE gohead,
LV_ID TYPE C LENGTH 40,
LV_MBLNR TYPE MBLNR,
LV_MJAHR TYPE MJAHR.
IF SY-UCOMM = 'PRINT'.
CONCATENATE SY-UNAME 'MIGOPRINT' INTO LV_ID.
IMPORT cs_gohead FROM MEMORY ID LV_ID.
IF CS_GOHEAD IS NOT INITIAL.
LV_MBLNR = CS_GOHEAD-MBLNR.
LV_MJAHR = CS_GOHEAD-MJAHR.
IF LV_MBLNR IS NOT INITIAL AND LV_MJAHR IS NOT INITIAL.
SUBMIT ZMM_VENDOR_RETURN_MIGO WITH P_MBLNR = LV_MBLNR WITH P_MJAHR = LV_MJAHR AND RETURN.
ENDIF.
ENDIF.
FREE MEMORY ID LV_ID.
ENDIF.
Note:
◉ Here in the above Submit code statement, add your own custom developed report program for previewing the forms.
◉ Here we used SY-UNAME with ‘MIGOPRINT’ to produce the Export ID as dynamic, so that it wont affect when multiple users access the MIGO Transaction at the same time.
Notes to be followed while releasing Transport Request :
◉ If you face the error “Enhancement needs to be adjusted” while releasing the Transport Request, please follow the below mentioned note.
◉ While releasing the Transport Request, ensure that all adjustments for this BADI is done. So that it will allow you to release the Transport requests. In the adjustment TAB, Click on Conflict and implement the mentioned methods and activate.
Sample Output :
Finally, we have added the custom tab and print preview button in the MIGO Transaction
Source: sap.com
No comments:
Post a Comment