In this Post ,We will create a program which triggers a
process chain when Flag from TVARVC is X or based on DSO/ADSO value.
Let us consider a scenario where we have TVARV flag Variable
which we can change in STVARV T-code. Based on that flag we need to trigger.
So, we are reading that flag and trigger the process chain in the program using
the below Function Module.
*&---------------------------------------------------------------------*
*& Report ZPC_TRIGGER_FLAG
*&---------------------------------------------------------------------*
*& (PC Trigger) Program
*$ Created on 07/11/2023
*&---------------------------------------------------------------------*
REPORT ZPC_TRIGGER_FLAG.
DATA: V_FLAG TYPE C.
SELECT SINGLE LOW FROM TVARVC INTO V_FLAG WHERE NAME = 'ZV_PC_TRG_FLG' .
IF ( V_FLAG = 'X' ).
CALL FUNCTION 'RSPC_CHAIN_START'
EXPORTING
I_CHAIN = 'ZPC_TRIGGER'.
ENDIF.
Let us consider Another scenario where Process chain needs to be
triggered if we have data loaded to any DSO/ADSO.
*&---------------------------------------------------------------------*
*& Report ZPC_TRIGGER_FLAG2
*&---------------------------------------------------------------------*
*& (PC Trigger) Program
*$ Created on 07/11/2023
*&---------------------------------------------------------------------*
REPORT ZPC_TRIGGER_FLAG2.
DATA: V_COUNT TYPE I.
SELECT COUNT(*) FROM /BIC/AZADSOX2 INTO V_COUNT WHERE /BIC/ZDATE = SY-DATUM.
IF ( V_COUNT > 0 ).
CALL FUNCTION 'RSPC_CHAIN_START'
EXPORTING
I_CHAIN = ‘ZPC_TRIGGER'.
ENDIF.
Then after triggering the Program the process chain will gets triggered automatically.