Skip to Content
Author's profile photo Marcus Zahn

Monday Knowledge Snippet (MKS) – 03 Control your process using the process controller

Asking yourself how to adjust standard TM processes to match a certain customer requirement? Stumbled over the process controller already?

The Process Controller Framework (PCF) is a concept going beyond BAdIs. With a BAdI you can manipulate a very specific function, while the PCF is meant to enable combining SAP standard functions with customer specific modules in a very generic way by defining strategies for a process. Such a stratgies makes it much more transparent, which enhancements have been done and which modules are used in comparisson to a simple BAdI implementation. The PCF has been used from the very beginning of the SAP TM development in planning, but grew into different areas (GIS integration, Copy Controll, Change Controll, Dangerous Goods handling, Incompatibilities, and so on). The basic idea is to pass all input / output data in a generic request object from one method to the other. Usually this is done in a very unrestricted way, but all OO concepts of information hiding could be applied, too.

From the perspective of a customer project having the need to create a new module, I think the definition of strategies, methods and the strategy – method assignment is well documented in the standard application help. The tricky part is here:

MKS03_PCF_Method_Definition.jpg

In the method defintion you need to point to an implementing class and method, which fullfills the signature (I guess the maintenance should check the compliance):

MKS03_PCF_Method_Signature.jpg

Within the method, you then need to access the request object:

METHOD your_functionality.

  DATA: lo_request            TYPE REF TO /sctm/cl_request,
        lo_[PROCESS]_request  TYPE REF TO [YOUR REQUEST OBJECT].

  LOOP AT it_request INTO lo_request.

    lo_[PROCESS]_request = cast_request( lo_request ).
    CHECK lo_[PROCESS]_request IS NOT INITIAL.

#################################################

Execute your process here; take request data out

of lo_[PROCESS]_request and put in result

#################################################

  ENDLOOP.

ENDMETHOD.

Usually the input table IT_REQUEST holds only 1 object. The cast is required to get the process specific request object. In case you get a dump here when testing, you have probably tried to cast for a wrong service.

That’s all! 🙂

Cheers,

Marcus

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Marcus Zahn
      Marcus Zahn
      Blog Post Author
      Author's profile photo Hemant Vakharia
      Hemant Vakharia

      Thanks Markus for this simplified version.

      One question - The parameters screen you are showing here is part of your interface (ZKKTEST), right?

      Author's profile photo Marcus Zahn
      Marcus Zahn
      Blog Post Author

      You mean the second screenshot? Yes, this is the signature of a method of that interface. But keep in mind ANY method to be used for the Process Controller needs to look the same.

      Author's profile photo Marcus Zahn
      Marcus Zahn
      Blog Post Author

      Here is the link to the famous TM podcast about this topic: TMP007: The Process Controller | tmp