Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Sometime it might have happened that a common infoprovider data load got failed due to deadlock scenario, to avoid the same Process chain can be modeled to work in parallel with each other by waiting. (conflict between two Process chains due to same data targets)

 

Scenario :

In a case of DSO, one Process Chain is activating a request and another PC start pushing the data, this will in result in failure.

Assumed flow :

Process Chain 1 loads the FI data from APAC Datasource till Cube starting at 08.00 IST.

Process Chain 2 loads the FI data from EAME Datasource till Cube starting at 09.00 IST.

If Process Chain 1 is delayed by that time Process Chain 2 will start executing then data load in C-DSO may fail due to dead lock scenario.



Solution :

Set and Reset program for Process chain with a Variants having TVARVC Variable as parameter.

1) ZBW_PARALLEL_PC_SET_VAR
2) ZBW_PARALLEL_PC_RESET_VAR

In Above example, 2 Process Chain will be loading C-DSO and to avoid the conflict we will create a TVARVC variable (Type P) namely "ZVAR_C_DSO" to be used in the program.

 

1.ZBW_PARALLEL_PC_SET_VAR

Use of Set Program:

This Program will take latest value for TVARVC variable (passed from program variant) and

if variable value is Blank/Null then it will set the variable value to “X” and setting program status to Green.

TVARVC value to “X” will indicate that some Process chain is executing which has concerned Info-provider, so other Process chains will not execute instead they will wait for the first process chain to complete.

Else if the value is already “X”, then the program will wait for 100 seconds and again check the value in TVARVC table. This will keep on repeating until the Variable value is null/Blank again.

 

2.ZBW_PARALLEL_PC_RESET_VAR

Use of Reset Program:

The reset program will change the TVARVC variable value from “X” to “ BLANK / NULL”. It will indicate that current process chain data targets are loaded and activated and other load can be started on the same data target.

Note : Program will take TVARVC variable as input and will change the value accordingly. This can be achieved by using program variant in the Process Chain.

 

After Solution is implemented :



 

Code :
REPORT  ZBW_PARALLEL_PC_SET_VAR.

* Variant to capture in a variable
SELECTION-SCREEN BEGIN OF BLOCK VARIANT_BLOCK
WITH FRAME TITLE TEXT-002 NO INTERVALS.
PARAMETERS: VAR_NAME TYPE RVARI_VNAM OBLIGATORY.
SELECTION-SCREEN END OF BLOCK VARIANT_BLOCK.

DATA: IT_TVARVC TYPE STANDARD TABLE OF TVARVC,
WA_TVARVC TYPE TVARVC.
FREE : IT_TVARVC, WA_TVARVC.
Data : SELECT_VAR TYPE SYSUBRC. " Number Variable.
FREE : SELECT_VAR.

* Assign SELECT_VAR to 0 so it can be used to create indefinte loop.
SELECT_VAR = 0.

WHILE SELECT_VAR EQ 0.

FREE : IT_TVARVC, WA_TVARVC.
* Select the latest value for the TVARVC entry
SELECT *
FROM TVARVC
INTO TABLE IT_TVARVC
BYPASSING BUFFER
WHERE NAME EQ VAR_NAME " VAR_NAME holds the TVARVC variable value.
AND TYPE EQ 'P'.

READ TABLE IT_TVARVC INDEX 1 INTO WA_TVARVC.
IF SY-SUBRC EQ 0 .
* If the value is BLANK
* then no PC is executing now and setting value to X.
IF WA_TVARVC-LOW EQ ''.
WA_TVARVC-LOW = 'X'.
APPEND WA_TVARVC TO IT_TVARVC.
MODIFY TVARVC FROM TABLE IT_TVARVC.
EXIT.
ELSE. " Other PC is executing.
* Wait so the other PC can complete and set the Flag to BLANK.
WAIT UP TO 100 SECONDS.
ENDIF.
ELSE.
EXIT. " NO Variable found..
ENDIF.
ENDWHILE.

 
REPORT  ZBW_PARALLEL_PC_RESET_VAR.

SELECTION-SCREEN BEGIN OF BLOCK VARIANT_BLOCK
WITH FRAME TITLE TEXT-002 NO INTERVALS.
PARAMETERS: VAR_NAME TYPE RVARI_VNAM OBLIGATORY.
SELECTION-SCREEN END OF BLOCK VARIANT_BLOCK.


DATA: IT_TVARVC TYPE STANDARD TABLE OF TVARVC,
WA_TVARVC TYPE TVARVC.
FREE : IT_TVARVC, WA_TVARVC.

SELECT *
FROM TVARVC
INTO TABLE IT_TVARVC
BYPASSING BUFFER
WHERE NAME EQ VAR_NAME
AND TYPE EQ 'P'.

READ TABLE IT_TVARVC INDEX 1 INTO WA_TVARVC.

IF SY-SUBRC EQ 0 .
* To set the Value as BLANK to denote the PC executing is completed.
WA_TVARVC-LOW = ''.
APPEND WA_TVARVC TO IT_TVARVC.
MODIFY TVARVC FROM TABLE IT_TVARVC.
ENDIF.

 

 

Thank You,

Himanshu Sarawagi

 

 

 
2 Comments
Labels in this area