Sapass

 Simplify SAP R/3 development with Excel VBA/VB RFC  
Home> UserExit>ME590001



Index

ME590001

User Exits: Purchasing
Enhancement ME590001 allows you to use a non-standard-SAP logic for grouping requisitions for purchase orders or PO items when automatically converting requisitions into POs.

In the standard system, you can use the selection parameters to specify that a new PO is to be created when one of the criteria "purchasing group", "plant", "storage location", "item category", "delivery date", "vendor sub-range", "purchase requisition number", "purchase requisition item", or "company code" changes.

The function exit EXIT_SAPLME59_001 enables you to define any other criteria (example: see below).

The function module has the following parameters:

  • T_EBAN
    Table with all requisitions that are to be converted. The table is pre-sorted according to the splitting criteria you selected on the selection screen.
  • T_EBANX
    Index table containing those requisitions for which a new PO or PO item is to be generated. This table is likewise pre-filled in the standard system. For example, the field T_EBANX-PO_NEW is filled with 'X' in the case of each requisition that is assigned to a different vendor than the preceding one.

Example:

You are not using any of the splitting criteria available in the standard system but wish to generate a new purchase order for each requester shown in the requisition. The relevant source code in program ZXM01U01 might look like this:

 
DATA: L_EBAN LIKE EBAN OCCURS 0 WITH HEADER LINE,
      L_TABIX LIKE SY-TABIX,
      NEXT_EBAN LIKE EBAN,
      NEW_PO LIKE SY-CALLD,
      OLD_AFNAM LIKE EBAN-AFNAM.
 
LOOP AT T_EBAN.
  L_TABIX = SY-TABIX + 1.
  READ TABLE T_EBAN INDEX L_TABIX INTO NEXT_EBAN.
  IF SY-SUBRC NE 0.
    NEW_PO = 'X'.
  ELSE.
    READ TABLE T_EBANX WITH KEY BANFN = NEXT_EBAN-BANFN
                                BNFPO = NEXT_EBAN-BNFPO.
    IF SY-SUBRC EQ 0 AND NOT T_EBANX-NEW_PO IS INITIAL.
      NEW_PO = 'X'.
    ELSE.
      CLEAR NEW_PO.
    ENDIF.
  ENDIF.
  APPEND T_EBAN TO L_EBAN.
  CHECK NEW_PO EQ 'X'.
  SORT L_EBAN BY AFNAM.
  CLEAR OLD_AFNAM.
  LOOP AT L_EBAN.
    IF SY-TABIX EQ 1 OR L_EBAN-AFNAM NE OLD_AFNAM.
      READ TABLE T_EBANX WITH KEY BANFN = L_EBAN-BANFN
                                  BNFPO = L_EBAN-BNFPO.
      IF SY-SUBRC EQ 0.
        T_EBANX-NEW_PO = 'X'.
        MODIFY T_EBANX INDEX SY-TABIX.
      ELSE.
        CLEAR T_EBANX.
        T_EBANX-BANFN = L_EBAN-BANFN.
        T_EBANX-BNFPO = L_EBAN-BNFPO.
        T_EBANX-NEW_PO = 'X'.

Function/Program:
  • EXIT_SAPLME59_001: Grouping Purchase Requisitions for Automatic Creation of Purchase Orders

02-Oct-2005