Hi!
Want to leave here a reminder for myself how to develop programs for PUST/PEST transactions. Source – help.sap.com.
Sometime SAP deletes its own links, so let the text stay here for a while.
Example: Program in Process Model
See below for examples of source texts in programs you can use in a process model.
Note
If you use the workflow container , you require additional source text. These parts are displayed in italics.
You will also find examples of programs that are used within process models in the standard system.
Programs That Process Personnel Numbers Using a Logical Database
Source Text
REPORT MY_STEP_PROGRAM.
INCLUDE <CNTN01>.
[...]
START-OF-SELECTION.
[...]
GET PERNR.
[...]
IF not employee is ok.
CALL FUNCTION 'HRPY_PROCESS_SET_PERNR_STATUS'
EXPORTING
IMP_PERNR=PERNR-PERNR
IMP_PARCEL=PYPARAID
IMP_SET_ERR='X'.
REJECT.
ENDIF.
[...]
CALL FUNCTION 'HRPY_PROCESS_SET_PERNR_STATUS'
EXPORTING
IMP_PERNR=PERNR-PERNR
IMP_PARCEL=PYPARAID
IMP_SET_SUC='X'.
END-OF-SELECTION.
* Fill container
SAP Programs
Posting to Accounting: Create Posting Run
Program RPCIPE00 (Posting to Accounting: Create Posting Run) starts with include <CNTN01>. Subroutine REJECTION is accessed in this include if a personnel number is not relevant to this process step. This happens in the following situations:
The personnel number was rejected during payroll.
The personnel number has already been evaluated.
In the first instance, subroutine REJECTION sets the status of the personnel number to incorrect . In the second instance, it sets the status to successful .
If the personnel number has the status successful , program RPCIPE00 informs the process managerusing routine REGISTER_AND_INDEX. The routine is called just before END-OF-SELECTION. At the end of END-OF-SELECTION, routine END_PROCESS_MODEL transfers the number of the posting run and, if necessary, the name of the TemSe fileto the workflow container.
Payroll driver
In the payroll programs, the include statement for container macros can be found in include RPCFDC19. In program RPCALCX0 (Payroll Driver – International) , for example, the container is only filled in an evaluation run after END-OF-SELECTION. Include RPCFDC19 transfers the names of TemSe files to the container.
If necessary, subroutine NEW_ABLEHNUNG sets the status of the personnel number to incorrect .
At the end of subroutine MAIN , routine PROCESS_SET_PERNR_STATUS sets the status for successful personnel numbers.
END-OF-SELECTION ends with the LEAVE LIST-PROCESSING command, so subroutine FIRE_EVENT first calls function module HRPY_PROCESS_FIRE_EVENT to return control to the process manager.
Programs That Do Not Use a Logical Database And Do Not Process Personnel Numbers
Source Text
INCLUDE RPUPMDP3.
INCLUDE <CNTN01>.
[...]
START-OF-SELECTION.
CALL FUNCTION 'HRPY_PUST_GET_CONTAINER’
EXPORTING
IMP_PARCEL = PYPARAID
TABLES
CONTAINER = PY_PM_CONTAINER.
[...]
END-OF-SELECTION.
* Fill container
IF NOT PYPARAID IS INITIAL.
CALL FUNCTION 'HRPY_PROCESS_FIRE_EVENT'
EXPORTING
IMP_PARCEL=PYPARAID
TABLES
IMP_CONTAINER=PY_PM_CONTAINER .
ENDIF.
Note
You only need to use the source text in italics and bold type if you require data from the workflow container that does not satisfy the program’s selection criteria. For more information, see Workflow Container .
SAP Programs
Display Posting Document
Program RPCIPS00 (Display Posting Document) contains include RPUPMDP3. This program does not process personnel numbers or fill the workflow container, which means it does not require any further function modules, includes, or macros. At the end of END-OF-SELECTION, program RPCIPS00 returns control to the process manager.
Transfer to FI/CO: Export to R/2 or R/3 < 4.0
Program RPCIPX00 (Transfer to FI/CO: Export to R/2 or R/3 < 4.0) imports a TemSe file, processes it, and writes a new TemSe file. It must therefore use routine START_PROCESS to import the workflow container, and routine END_PROCESS to store new data in the workflow container. Function module HRPY_PROCESS_FIRE_EVENT is also called in routine END_PROCESS.