How to Define Additional Logic for SAP OM Infotype?

How to Define Additional Logic for SAP OM Infotype?

Clarification of the Issue

In one of my earlier posts, I discussed how to define additional logic for a PA infotype:

See the article: How to Define Additional Logic for PA Infotype?

In this article, I want to explore how to define additional logic for Organizational Management (OM) infotypes. Just like with PA infotypes, this can be useful, for example, to reduce the number of user errors when maintaining master data.

As an example, I propose implementing a check for the “Object name” field of infotype 1000 – “Object” for object type 91.

Solution

This time, the BAdI HRBAS00INFTY will help us. You can access it by running transaction SE18.

Create a new implementation for this BAdI by selecting the menu Enhancement Implementation → Create.

Enter a technical name for the new implementation.

Then assign it a descriptive text name.

To implement the check described above, I will use the AFTER_INPUT method. The ABAP code could look approximately like this:

METHOD if_ex_hrbas00infty~after_input.
 
    DATA: lt_1000  TYPE STANDARD TABLE OF p1000.
    FIELD-SYMBOLS: <fs_1000>   LIKE LINE OF lt_1000 .
 
 
    IF new_innnn-infty = '1000' AND new_innnn-otype = '91'.
 
      ASSIGN ('(MP100000)P1000') TO <fs_1000>.
 
      IF <fs_1000>-stext IS INITIAL.
        MESSAGE e003(zhr). "Please fill in "Object name" field!
      ENDIF.
 
    ENDIF.
 
  ENDMETHOD.

Activate both the method and the implementation. You can use transaction PP01 to test the changes.

0:00
/0:14

Optional: Enhanced Error Message

If the standard error message format does not suit your needs, you can use a slightly different approach – namely, a pop-up window displaying the same error. To do this, you’ll need to slightly modify the error message code:

METHOD if_ex_hrbas00infty~after_input.
 
    DATA: lt_1000  TYPE STANDARD TABLE OF p1000.
    FIELD-SYMBOLS: <fs_1000>   LIKE LINE OF lt_1000 .
 
 
    IF new_innnn-infty = '1000' AND new_innnn-otype = '91'.
 
      ASSIGN ('(MP100000)P1000') TO <fs_1000>.
 
      IF <fs_1000>-stext IS INITIAL.
        MESSAGE 'Please fill in "Object name" field!' TYPE 'A'. "Please fill in "Object name" field!
      ENDIF.
 
    ENDIF.
 
  ENDMETHOD.

Testing

Test the implementation to ensure the logic works as expected.

0:00
/0:10