Settlement Procedure as Job
Settlement procedures that are implemented as jobs run identically to procedures controlled by workflows. The mains difference between these 2 forms of implementation is that the workflow environment contains additional functions (such as schedule monitoring, agent determination, and so on) that are not available if the settlement procedure is mapped as a job.
If you want to execute a settlement run for multiple settlement units, you should choose to map the settlement procedure as a job. This allows you to avoid dynamic parallel processing with a large number of parallel settlement steps, which can have a negative impact on performace if you map the settlement procedure as a workflow.
Note
If you still choose to map the procedure as a workflow, you can read how to avoid performance-critical dynamic parallel processing under Settlement Procedure as a Workflow.
You can use the standard settlement reports as a template for implementing new settlement steps.
The structure of a settlement report is always the same:
Syntax
REPORTreedmsettlproc_vv2_synth
******************************************** global prameters of settlement runPARAMETER: settldocTYPE e_edmsettldoc OBLIGATORY,settlrunTYPE e_edmsettldocrun OBLIGATORY.******************************************** global data definitionDATA: process_ref TYPE REF TO cl_isu_edm_settlprocess,settlunits TYPE t_settlunit,settlunit TYPE e_edmsettlunit,impvalues TYPE t_settlsteppar_contvalue,impprofiles TYPEt_settlsteppar_contprofile,expvalues TYPE t_settlsteppar_contvalue,expprofiles TYPEt_settlsteppar_contprofile,settlsteplevel TYPE e_settlsteplevel.******************************************** class interfaceCLASS cl_isu_edm_settlement DEFINITION LOAD.START-OF-SELECTION.******************************************** Laufstatus Gestartet setzen******************************************** Instanz des Bilanzierungslaufs erzeugen******************************************** Bilanzierungsschritte ausführen******************************************** Laufstatus Beendet mit OK setzenThe first activity in the report to map a settlement procedue is to set the status of the settlement run to Started (cl_isu_edm_settlement=>co_settlrunstatus_started
). In the settlement workbench, the user can then follow the status of the settlement run.
Syntax
START-OF-SELECTION.******************************************** set initial statusCALL METHOD cl_isu_edm_settlement=>cl_set_run_statusEXPORTING x_status = cl_isu_edm_settlement=>co_settlrunstatus_startedx_settldoc = settldocx_settldocrun = settlrunEXCEPTIONS OTHERS = 1.IF sy-subrc <> 0.MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgnoWITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.EXIT.ENDIF.It is not possible to start additional runs for settlement documents that use the same data basis (that is the same settlement units) until the status has been set to Finished with OK (cl_isu_edm_settlement=>co_settlrunstatus_ok
) or Terminated (cl_isu_edm_settlement=>co_settlrunstatus_error
). The Finished with OK status should be the last action in the workflow. The Terminated status should be set before the job is terminated after a critical error. Otherwise, a new run for the settlement document cannot be created and backbilling cannot start.
Syntax
******************************************** set final status of settlement runCALL METHOD cl_isu_edm_settlement=>cl_set_run_statusEXPORTING x_status = cl_isu_edm_settlement=>co_settlrunstatus_ok* in case of an error: x_status = cl_isu_edm_settlement=>co_settlrunstatus_errorx_settldoc = settldocx_settldocrun = settlrunEXCEPTIONSOTHERS = 1IF sy-subrc <> 0.MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgnoWITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.EXIT.ENDIF.An instance of the settlement run must first be generated in order to execute the settlement steps. The document number and the run number, which are provided by the settlement workbench at the beginning of a job, are required as input parameters.
Syntax
PARAMETER: settldocTYPE e_edmsettldoc OBLIGATORY,settlrunTYPE e_edmsettldocrun OBLIGATORY.DATA: process_ref TYPE REF TO cl_isu_edm_settlprocess,Settlunits TYPE t_settlunit,settlunit TYPE e_edmsettlunit,settlsteplevel TYPE e_settlsteplevel,temp_settlsteplevel TYPE e_settlsteplevel,impvalues TYPE t_settlsteppar_contvalue,impprofiles TYPEt_settlsteppar_contprofile,expvalues TYPE t_settlsteppar_contvalue,expprofiles TYPEt_settlsteppar_contprofile.******************************************** set initial status first !CALL METHOD cl_isu_edm_settlement=>cl_set_run_statusEXPORTING x_status = cl_isu_edm_settlement=>co_settlrunstatus_startedx_settldoc = settldocx_settldocrun = settlrunEXCEPTIONS OTHERS = 1.IF sy-subrc <> 0.MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgnoWITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.EXIT.ENDIF.*******************************************CREATE OBJECT process_refEXPORTING x_settldoc = settldocEXCEPTIONS others = 1.IF sy-subrc <> 0.exit_error_repeat_msg.ENDIF.******************************************** create new run instance CALL METHOD process_ref->create_settldocrunEXPORTING x_settldoc = settldocx_settldocrun = settlrunIMPORTING yt_settlunit = settlunitsEXCEPTIONS OTHERS = 1.IF sy-subrc <> 0.exit_error_repeat_msg.ENDIF.If the settlement run was successfully instantiated, the yt_settlunit
output parameter contains the table with all the settlement units that are taken into account in the settlement document.
The method of class CL_ISU_EDM_SETTLPROCESS
is used to execute settlement steps. An instance of the settlement run must have been generated beforehand as described under Generate Instance of Settlement Run
. Input parameter x_settlstep
determines which settlement run is executed. The name of the settlement step to be executed is entered in capital letters in the input parameter.
Syntax
******************************************** call of a single settlement step* calculate suplier factors (as profile and single value)CALL METHOD process_ref->start_stepEXPORTING x_settlstep = 'FACTSUP'xt_impprofiles = impprofilesxt_impvalues = impvaluesxt_settlunits = settlunitsIMPORTING yt_expprofiles = expprofilesyt_expvalues = expvaluesCHANGING xy_settlsteplevel = settlsteplevelEXCEPTIONS OTHERS = 1.IF sy-subrc <> 0.* e.g. set status of settlement run and quit processingMESSAGE s415(eedmset)CALL METHOD cl_isu_edm_settlement=>cl_set_run_statusEXPORTING x_status = cl_isu_edm_settlement=>co_settlrunstatus_errorx_settldoc = settldocx_settldocrun = settlrunEXCEPTIONS others = 1.IF sy-subrc <> 0.* e.g. repeat sy-subrcENDIF.EXIT.ENDIF.APPEND LINES OF expprofiles TO impprofiles.APPEND LINES OF expvalues TO impvalues.The interface is the same for all settlement steps:
X_SETTLSTEP | Name of settlement step |
|---|---|
XT_IMPVALUES | Table of value parameters for settlement steps (optional) |
XT_IMPPROFILES | Table of profile parameters for settlement steps (optional) |
XT_SETTLUNITS or X_SETTLUNIT | List of settlement units for global settlement steps or individual settlement unit |
YT_EXPVALUES | Table of value parameters for settlement steps |
YT_EXPPROFILES | Table of profile parameters for settlement steps |
Y_COMPLETED_WITH_WARNINGS | Return parameter |
XY_SETTLSTEPLEVEL | Level of settlement step processing |
Generally, all the settlement units (with the exception of steps that run for each settlement unit) and all the parameters (profiles and values) are transferred to the settlement step and the results are added to the parameter container. The settlement step has an automatic filter to calculate the required input parameters.
The y_completed_with_warnings
parameter can be evaluated in order to determine whether the settlement step ended with a warning.
An exception when calling start_step
means that a critical error has occurred during execution of the settlement step. The simplest way of handling this error could be to set the status of the settlement step and then terminate the job.
Some settlement steps can only run for each settlement unit. For these settlement steps, the name of the respective settlement unit has to be transferred to parameter x_settlunit
. Parameter xt_settlunits
is used for settlement steps that process data from multiple settlement units.
Syntax
******************************************** call of a settlement step, that is processed for one settlement unit onlyLOOP AT settlunits INTO settlunit.******************************************** calculate load profile of all interval metered customers of one* settlement unittemp_settlsteplevel = settlsteplevel.CALL METHOD process_ref->start_stepEXPORTING x_settlstep = 'SUMINTSU'xt_impprofiles = impprofilesxt_impvalues = impvaluesx_settlunit = settlunitIMPORTING yt_expprofiles = expprofilesyt_expvalues = expvaluesCHANGING xy_settlsteplevel = temp_settlsteplevelEXCEPTIONS OTHERS = 1.IF sy-subrc <> 0.* e.g. set status of settlement run and quitt processingEXIT.ENDIF.APPEND LINES OF expprofiles TO impprofiles.APPEND LINES OF expvalues TO impvalues.ENDLOOP.settlsteplevel = temp_settlsteplevel.The processing level (settlsteplevel
) of the settlement step in the settlement unit is raised each time method start_step
is called. To ensure that each settlement unit has the same processing level, the processing level should be reset in loops.
You can trigger an alert from a job (for example, if a settlement step that is critical for further processing is terminated due to an error).
Syntax
DATA: wa_alert TYPE eedmsettlmsgalert,lt_alert TYPE t_eedmsettlmsgalert.wa_alert-msgty = 'E'.wa_alert-msgno = '488'.wa_alert-msgid = 'EEDMSET'.wa_alert-msgv1 = settldoc.wa_alert-msgv2 = settlrun.*wa_alert-msgv3 = .*wa_alert-msgv4 = .*wa_alert-settlunit = .*wa_alert-grid_id = .wa_alert-settldoc = settldoc.wa_alert-settldocrun = settlrun.wa_alert-settlalertstatus = cl_isu_edm_settlement=>co_settlalertstatus_activ.append wa_alert to lt_alert.* set alertCALL METHOD cl_isu_edm_settlement=>cl_alert_write.EXPORTING xt_alert = lt_alertEXCEPTIONS others = 0.The following components of eedmsettlmsgalert
must be specified:
MSGTY
: Message Type
MSGID
: Message Class
MSGNO
: Message Number
SETTLDOC
: Settlement Document
SETTLDOCRUN
: Number of Settlement Run
SETTLALERTSTATUS
: Activate Alert (cl_isu_edm_settlement=>co_settlalertstatus_activ
)
The alert input parameters are entered in the same way as the system fields (SY-MSGNO
, SY-MSGID
, SY-MSGTY
, SY-MSGV1
, SY-MSGV2
, SY-MSGV3
, and SY-MSGV4
). You need to specfiy the alert context (settlement unit, grid) if the message refers to a specfiic settlement unit and/or grid.
An alert must be confirmed manually in the settlement workbench. Special authorization is required to view or confirm alerts.
An alert generates a BOR event simultaneously that can be used in an additional workflow to send a notification mail, for example.
Access to table t_settlsteppar_contvalue
can be used to set or read parameter values. The parameter name must be entered in capital letters.
You can use the reference to the settlement run process_ref->run_information
to obtain read-only access to the settlement run information. The following data is available:
SETTLDOCMODE
: Mode of Settlement Run (for example, Simulation, Active)
SETTLRUNTYPE
: Type of Settlement Run (for example, Backbilling Following an Error)