Product Lifecycle Management Blogs by Members
Get insider knowledge about product lifecycle management software from SAP. Tap into insights and real-world experiences with community member blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
rambabu_k3
Active Participant
This can be used to give choice to users to print labels from WAE02
instead of going to CBGL_MP01 for Disposal material documents.
Steps:
Create one FM ZEHSWA_LABEL_PRINT with below Import, Export and Table
interface.
Go to SPRO->EH&S->Waste Management->Disposal Processing->specify
Functions
  1. Click on specify functions      for application toolbar
  2. Give function code (Ex SAP010), function test ‘Label’. after this step WAE02 shows a button with  Lablel
  3. Assign ZEHSWA_LABEL_PRINT. this FM will be triggered when label button is triggered from WAE02
  4. ZEHSWA_LABEL_PRINT FM must be created as below template
FM ZEHSWA_LABEL_PRINT
*"----------------------------------------------------------------------


*"*"Local Interface:

*" IMPORTING

*" VALUE(I_EANOCAT) LIKE EHSWAC_EANOCAT STRUCTURE
*” EHSWAC_EANOCAT OPTIONAL
*" VALUE(I_TRANSACTION) TYPE EHSWAE_TRANSA OPTIONAL
*" VALUE(I_WFTASK) TYPE EHSWAE_WFTASK OPTIONAL
*" VALUE(I_DIALCTR) TYPE RCGDIALCTR OPTIONAL
*" VALUE(I_FLG_BATCH) TYPE ESP1_BOOLEAN OPTIONAL
*" EXPORTING
*" VALUE(E_FLG_SAVE_PEND) TYPE ESP1_BOOLEAN
*" VALUE(E_FLG_FIRST_SAVE_DONE) TYPE ESP1_BOOLEAN
*" VALUE(E_FLG_ERROR) TYPE ESP1_BOOLEAN
*" TABLES
*" X_LG_IOTAB STRUCTURE EHSWAS_ENTAMIOT
*" X_LG_IOTAB_DEL STRUCTURE EHSWAS_ENTAMIOT
*" I_ENACC_IOTAB STRUCTURE EHSWAS_ENACCIOT OPTIONAL
*" E_MESSAGE_TAB STRUCTURE EHSWAS_ERROR_TAB OPTIONAL
*"----------------------------------------------------------------------






DATA:
  BEGIN OF wa_enfod,
       easucc
TYPE ehswat_enfod-easucc,
               easuccyear TYPE ehswat_enfod-easuccyear,
END OF wa_enfod,

it_enfod
LIKE TABLE OF wa_enfod.





* X_LG_IOTAB contains documents selected to go to LABEL
* For each selected document, label print will be done once
LOOPAT x_lg_iotab WHERE markflg EQ'X'.
* To get material document created for disposal
     SELECT easucc
           easuccyear
     INTO TABLE it_enfod
     FROM ehswat_enfod
    WHERE eapred EQ x_lg_iotab-entamno
      AND easucccat EQ 'SAP001'.
IF sy-subrc EQ 0.
     SORT it_enfod DESCENDING.
     READ TABLE it_enfod INTO wa_enfod INDEX 1.
ELSE.
     CONTINUE.
ENDIF.
* Write call transaction to goto CBGL_MP01
* Fill t_bdc_data using recording
CALL TRANSACTION 'CBGL_MP01' USING t_bdc_data MODE 'E'.


ENDLOOP.