Validate Profit Centers Against Company Code

Jimbo's picture

Loading Material Masters using Standard Batch/Direct Input can be a daunting task because of the hundreds of hierarchical dependencies required to create a single Material Master. Like so many other fields, it is easy enough to validate PRCTR before attempting to load.

In this case, the system threw the following error messages: No postings can be made to profit center 1501500 in company code 0130. and Profit center 1501500 cannot receive postings in company code 0130. Predicting this error prior to loading for go-live so that it can be resolved before the hectic weekend when it is least convenient will naturally make the programmer a hero.

The task starts with the simple KE_PROFIT_CENTER_CHECK function module. It requires only the BUKRS, PRCTR and values.

        bukrs              = BMM00-BUKRS
        prctr              = BMM00-PRCTR
        not_found             = 1
        not_defined_for_date  = 2
        no_kokrs_for_bukrs    = 3
        parameter_mismatch    = 4
        prctr_locked          = 5
        not_defined_for_bukrs = 6
        OTHERS                = 7.
if sy-subrc ne 0. 
*  . . . add code to handle errors here . . .

If the system does not allow postings to the Profit Center in the supplied Company Code then the function will throw error 4. A meaningful report can be then sent back to the business to resolve the identified issues.


Programming Language: