Skip to Content
Author's profile photo Former Member

Collective reject from ME28 (Approve Purchase Documents)

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 EKKOPROCSTAT.

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 rm06bfrgab,

          l_frgzu        TYPE ekkofrgzu,

          l_frgke        TYPE ekkofrgke,

          l_ebeln        TYPE ekkoebeln,

          lv_ebeln        TYPE ekkoebeln.

            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_documentdoc_type    = ‘F’.

  ls_documentprocess    = mmpur_po_process.

  ls_documenttrtyp      = ‘V’.

  ls_documentdoc_key(10) = ls_outtabebeln.

  ls_documentinitiatorinitiator = 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_outtabebeln ).

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

CASE ls_outtabicon_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_documenttrtyp

      im_aktyp    = ls_documenttrtyp

      im_po_number = ls_outtabebeln

      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 sysubrc = 0.

      LOOP AT gt_outtab_purchdoc_rel ASSIGNING <line> WHERE

                                                  ebeln = ls_outtabebeln.

            IF l_ebeln NE ls_outtabebeln.

              <line>icon_reject = lcl_datablade_purchdoc_rel=>my_icon_undo.

              l_ebeln = ls_outtabebeln.

            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_selfieldfieldname EQ ‘ICON_REJECT’.

      CHECK NOT ch_selfieldtabindex IS INITIAL.

      CHECK ch_selfieldsumindex IS INITIAL.

      CHECK NOT ch_ucomm EQ ‘MEDETAIL’.

      CALL METHOD rejection( im_wa = im_wa ).

      ch_selfieldrefresh = ‘X’.

      ch_selfieldcol_stable = ‘X’.

      ch_selfieldrow_stable = ‘X’.

    ENDIF.

ENDENHANCEMENT.

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

  ENDMETHOD.                    “double_click

Sample Output :

REJ.png

Thanks & Regards,

S.Rajendranath.

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Dennis Urbano
      Dennis Urbano

      Hi S.Rajendranath,

      Could you please list the places for incorporating that functionality?

      Thanks in advance.

       

      Author's profile photo Hitesh Thakore
      Hitesh Thakore

      Enhancement mentioned in this blog is done for ALV report SAPLMEREP (function group MEREP).

      Start with include LMEREPD20 for lcl_datablade_purchdoc_rel DEFINITION enhancement and follow steps.