Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Requirement :

ME28 {Release (Approve) Purchasing Documents} is the Transaction Code for Collect Approval where the requirement is to have Collective Rejection with Status of 08.

Procedure :


This requirement can be achieved by enhancing (Implicit Enhancement) Standard Program RM06EF00.


A>>> Identify the Implicit Enhancement places for incorporating the REJECTION functionality.


B>>> Enhance  the Report RM06EF00 Output displayed in ALV , providing the REJECTION  icon as similar as the APPROVE icon.


C>>> Handle the REJECTION icon functionality and Set the Document Number with Status-08.



Spot-1 : Enhancement in Data Declaration for defining the REJECTION Method and to add the functionality  in 


lcl_datablade_purchdoc_rel DEFINITION as below



ENHANCEMENT 1  ZMM_ME28.    "active version


    CLASS-DATA: my_icon_reject TYPE icon_release,


                my_icon_undo  TYPE icon_release.


    DATA      : MY_PROCSTAT      TYPE EKKO-PROCSTAT.


ENDENHANCEMENT.


*$*$-End:  (1)---------------------------------------------------------------------------------$*$*


ENDCLASS.                    "lcl_datablade_purchdoc_rel DEFINITION




Spot-2 : Add REJECT ICON to be displayed in the Output of the ALV Report .



ENHANCEMENT 2  ZMM_ME28.    "active version



    l_info = 'Reject'(134).


    CALL FUNCTION 'ICON_CREATE'


      EXPORTING


        name  = icon_reject


        info  = l_info


      IMPORTING


        result = my_icon_reject


      EXCEPTIONS


        OTHERS = 0.



        l_info = 'Reject'(134).


    CALL FUNCTION 'ICON_CREATE'


      EXPORTING


        name  = ICON_SYSTEM_UNDO


        info  = l_info


      IMPORTING


        result = my_icon_undo


      EXCEPTIONS


        OTHERS = 0.


ENDENHANCEMENT.


*$*$-End:  (1)---------------------------------------------------------------------------------$*$*


  ENDMETHOD.                    "class_constructor




Spot-3 : Handling the action made on the REJECTION ICON enhancement made at double click event.



ENHANCEMENT 03  ZMM_ME28.    "active version


      METHODS : REJECTION IMPORTING IM_WA TYPE ANY.


ENDENHANCEMENT.


*$*$-End:  (2)---------------------------------------------------------------------------------$*$*


ENDCLASS.                    " "lcl_reporting_cnt_purchdoc_rel DEFINITION




Spot-4 : To make the REJECTION icon HOTSPOT in Fieldcatalog


ENHANCEMENT 04  ZMM_ME28.    "active version


    LOOP AT my_fcat ASSIGNING <fcat>.


      CASE <fcat>-fieldname.


        WHEN 'ICON_REJECT'.


          <fcat>-icon = cl_mmpur_constants=>yes.


          <fcat>-hotspot = cl_mmpur_constants=>yes.


          ENDCASE.


          ENDLOOP.


          re_fcat = my_fcat.



ENDENHANCEMENT.


*$*$-End:  (1)---------------------------------------------------------------------------------$*$*


  ENDMETHOD.                    "get_fcat



Spot-5 : Implementation of the Method REJECTION


METHOD rejection.


" Method for Collective Rejection for ME28.



          DATA: ls_outtab      TYPE merep_outtab_purchdoc_rel,


          l_model        TYPE REF TO lcl_reporting_model,


          l_datablade    TYPE REF TO lcl_datablade_general,


          l_frgab        TYPE rm06b-frgab,


          l_frgzu        TYPE ekko-frgzu,


          l_frgke        TYPE ekko-frgke,


          l_ebeln        TYPE ekko-ebeln,


          lv_ebeln        TYPE ekko-ebeln.


            data: lc_po      type ref to  cl_po_header_handle_mm,


        ls_document type mepo_document,


            IM_DATA TYPE MEPOHEADER.


    DATA : IM_header TYPE BAPIMEPOHEADER,


            EX_header TYPE BAPIMEPOHEADER,


            IM_headerx TYPE BAPIMEPOHEADERX ,


            T_RETURN TYPE STANDARD TABLE OF BAPIRET2,


            S_RETURN LIKE LINE OF T_RETURN,


            CL_PO TYPE REF TO CL_PO_HEADER_HANDLE_MM,


            VAR TYPE C.



    FIELD-SYMBOLS: <line> LIKE LINE OF gt_outtab_purchdoc_rel.



    l_model = my_view->get_model( ).


    l_datablade ?= l_model->get_current_datablade( ).



MOVE-CORRESPONDING im_wa TO ls_outtab.



*  prepare creation of PO instance


  ls_document-doc_type    = 'F'.


  ls_document-process    = mmpur_po_process.


  ls_document-trtyp      = 'V'.


  ls_document-doc_key(10) = ls_outtab-ebeln.


  ls_document-initiator-initiator = mmpur_initiator_rel.



*  object creation and initialization


* lv_ebeln = ls_outtab-ebeln.


  create object lc_po.


  lc_po->for_bapi = mmpur_yes.


  call method lc_po->po_initialize( im_document = ls_document ).


  call method lc_po->set_po_number( im_po_number = ls_outtab-ebeln ).


  call method lc_po->set_state( cl_po_header_handle_mm=>c_available ).


CASE ls_outtab-icon_reject.


WHEN lcl_datablade_purchdoc_rel=>my_icon_reject.



*  read purchase order from database


  call method lc_po->po_read


    exporting


      im_tcode    = 'ME29N'


      im_trtyp    = ls_document-trtyp


      im_aktyp    = ls_document-trtyp


      im_po_number = ls_outtab-ebeln


      im_document  = ls_document.



  if lc_po->if_releasable_mm~is_rejection_allowed( ) = mmpur_yes.


    call method lc_po->if_releasable_mm~reject


      exporting


        im_reset = space


      exceptions


        failed  = 1


        others  = 2.


  endif.



  CALL METHOD lc_po->po_post


    EXCEPTIONS


      failure          = 1


      others            = 2


          .


  if sy-subrc = 0.



      LOOP AT gt_outtab_purchdoc_rel ASSIGNING <line> WHERE


                                                  ebeln = ls_outtab-ebeln.


            IF l_ebeln NE ls_outtab-ebeln.


              <line>-icon_reject = lcl_datablade_purchdoc_rel=>my_icon_undo.


              l_ebeln = ls_outtab-ebeln.


            ELSE.


              CLEAR <line>-icon_reject.


            ENDIF.


          ENDLOOP.


ENDIF.


  endcase.


  ENDMETHOD.



ENDENHANCEMENT.


*$*$-End:  (5)---------------------------------------------------------------------------------$*$*


ENDCLASS.                    "lcl_reporting_cnt_purchdoc_rel IMPLEMENTATION



Spot-6 : Enhancement for handling the action for double click on REJECTION icon.


IF ch_selfield-fieldname EQ 'ICON_REJECT'.



      CHECK NOT ch_selfield-tabindex IS INITIAL.


      CHECK ch_selfield-sumindex IS INITIAL.


      CHECK NOT ch_ucomm EQ 'MEDETAIL'.



      CALL METHOD rejection( im_wa = im_wa ).


      ch_selfield-refresh = 'X'.


      ch_selfield-col_stable = 'X'.


      ch_selfield-row_stable = 'X'.


    ENDIF.



ENDENHANCEMENT.


*$*$-End:  (3)---------------------------------------------------------------------------------$*$*


  ENDMETHOD.                    "double_click



Sample Output :

Thanks & Regards,

S.Rajendranath.

2 Comments
Labels in this area