Sapass

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



Index

COOPA_01

Customer exits for internal orders
Description

When processing internal orders (order category 01-03), and CO production orders (categories 04-05, if used by the master data maintenance for internal orders), you can add user-defined checks to the following areas using user exits:

1. Master data maintenance, or order information system

During master data maintenance of orders, and running an order report, the system processes the EXIT_SAPLRKIO_001 exit. This contains the I_ACTVT parameter, and the I_AUFK structure (master record for the order). This parameter specifies the processing type: (02 = Change / 03 = Display / 32 = Save for master data transactions, 27 = Display totals records for order reports, and 03 = Display / 27 = Display totals records for order selection by classification).
You can use this data to make your own checks.

The exit is processed in the following places:

  • Creating an internal order with reference

The system processes the exit that has the "Display" processing type for the reference order.

  • Changing or displaying an order

When the order is imported, the system processes the exit with each processing type ("Change", or "Display").

  • Creating or changing an order

When the order is saved, the system processes the exit with the new field contents, and the processing type "Save".

  • Executing an order report in the order information system:

The system processes the exit with the processing type "Display totals records".

  • Order selection by classification

When importing the orders, the system initially processes the exit with the processing type "Display totals records". If you then display certain orders in the master data list, then the system processes the exit with the processing type "Display" again.

2. Business transaction check, or authorization check

If a business transaction (such as, "Release", "G/L account posting") is executed for an order, the system processes the EXIT_SAPLRKIO_002 exit. This contains the I_VRGNG parameter, and the I_AUFK structure (master record for the order). This parameter specifies the system identifier for the business transaction being used.

Example

For example, if you want to ensure that orders for an order type "XY" can be released by processors "USER1" and "USER2" (Business transaction "BFRE"), then you can include the following coding in the EXIT_SAPLRKIO_002 exit:

IF I_VRGNG = 'BFRE'
AND I_AUFK-AUART = 'XY'
AND SY-UNAME NE 'USER1'
AND SY-UNAME NE 'USER2'.
E_RESULT = 4.
ENDIF.

This means that all processors except for USER1 and USER2 receive the standard error message for non-authorization for the orders. If you want to raise a user-defined error message, you can enter the following code:

IF I_VRGNG = 'BFRE'
AND I_AUFK-AUART = 'XY'
AND SY-UNAME NE 'USER1'
AND SY-UNAME NE 'USER2'.
MESSAGE E100(ZZ) RAISING E_MESSAGE.
ENDIF.

You need to create message 100 in message class ZZ manually.

The "RAISING E_MESSAGE" addition means that the error message display in each situation can be processed correctly (for example, collected display of more than one error message, instead of several single messages). Under no circumstances should you send the message without the "RAISING E_MESSAGE" addition.

You can also define your own authorization objects, check any fields in the order master, and include the corresponding authorization check (AUTHORITY_CHECK) in the exit.

Further Notes

For more information, see the documentation on the EXIT_SAPLRKIO_002 function module, which contains more sample coding for this component.

3. Substituting the AUTHPHASE field during authorization check

The system makes a routine check on the K_ORDER authorization object during authorization checks for orders. The AUTHPHASE field for this object is normally tested using the status number for the user status (for general status management), or using the order status (for order status management). You can use the EXIT_SAPLKOAU_002 component to ensure that this field is tested using any value, which you can determine from the order master data.

Note that the EXIT_SAPLKOAU_002 component is only intended for substituting the AUTHPHASE field. You should implement any further checks in the EXIT_SAPLRKIO_002 component.

Further Notes

For more information, see the documentation on the EXIT_SAPLKOAU_002 function module, which
Function/Program:

  • EXIT_SAPLKOAU_002: Authorization check for internal orders: Replace AUTHPHASE
  • EXIT_SAPLRKIO_001: Reporting: Master Data Maintenance
  • EXIT_SAPLRKIO_002: Internal Orders: Check for Business Transaction and Authorization

02-Oct-2005