Tuesday, October 1, 2013

Restarting Processchains

How is it possible to restart a process chain at a failed step/request?

Sometimes, it doesn't help to just set a request to green status in order to run the process chain from that step on to the end.

You need to set the failed request/step to green in the database as well as you need to raise the event that will force the process chain to run to the end from the next request/step on.

Therefore you need to open the messages of a failed step by right clicking on it and selecting 'display messages'.

In the opened popup click on the tab 'Chain'.

In a parallel session goto transaction se16 for table rspcprocesslog and display the entries with the following selections:

1. copy the variant from the popup to the variante of table rspcprocesslog
2. copy the instance from the popup to the instance of table rspcprocesslog
3. copy the start date from the popup to the batchdate of table rspcprocesslog

Press F8 to display the entries of table rspcprocesslog.

Now open another session and goto transaction se37. Enter RSPC_PROCESS_FINISH as the name of the function module and run the fm in test mode.

Now copy the entries of table rspcprocesslog to the input parameters of the function module like described as follows:

1. rspcprocesslog-log_id -> i_logid
2. rspcprocesslog-type -> i_type
3. rspcprocesslog-variante -> i_variant
4. rspcprocesslog-instance -> i_instance
5. enter 'G' for parameter i_state (sets the status to green).

Now press F8 to run the fm.

Now the actual process will be set to green and the following process in the chain will be started and the chain can run to the end.

Of course you can also set the state of a specific step in the chain to any other possible value like 'R' = ended with errors, 'F' = finished, 'X' = cancelled ....

Check out the value help on field rspcprocesslog-state in transaction se16 for the possible values.
 
This is the code... Just copy it into your system..

*---------------------------------------------------------------------*
*Report ZRSPC_PROCESS_FINISH *
*---------------------------------------------------------------------*
REPORT zrspc_process_finish .
PARAMETERS: VARIANT TYPE rspc_variant OBLIGATORY,
INSTANCE TYPE rspc_instance OBLIGATORY,
DATE TYPE SY-DATUM OBLIGATORY,
state TYPE rspc_state OBLIGATORY default 'G'.
DATA : logid TYPE rspc_logid,
chain TYPE rspc_chain,
type TYPE rspc_type,
p_vari TYPE rspc_variant,
instan TYPE rspc_instance,
jobcount TYPE btcjobcnt,
batchdat TYPE btcreldt,
batchtim TYPE btcreltm.
DATA: LS_PCLOG LIKE RSPCPROCESSLOG.

* select the process log
SELECT SINGLE * FROM RSPCPROCESSLOG INTO LS_PCLOG
where variante = variant
and instance = instance
and batchdate = date.

if sy-subrc = 0.
* Set the status
CALL FUNCTION 'RSPC_PROCESS_FINISH'
EXPORTING
i_logid = LS_PCLOG-log_id
* i_chain = LS_PCLOG-chain
i_type = LS_PCLOG-type
i_variant = LS_PCLOG-variante
i_instance = LS_PCLOG-instance
i_state = state
* i_job_count = jobcount
i_batchdate = LS_PCLOG-batchdate
* i_batchtime = batchtim
EXCEPTIONS
error_message = 1.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

else.
message E000(YBW_USR_MON) with
'Process selected does not exist ' ' - Check you entry'.
endif.

*--------------- END OF CODE --------------------*

House Keeping Activities in SAP BW Systems

House Keeping Activities in SAP BW Systems -- PART 1

House Keeping Activities in SAP BW Systems -- PART 2

House Keeping Activities in SAP BW Systems -- PART 3

Periodic Jobs and Tasks in SAP BW

Whitepaper on BW System Copy