Using the BDC Wait option

By using the Batch Data Collector (BDC) Wait option, you can specify that a SAP job launched by HCL Workload Automation is not to be considered complete until all of its BDC sessions have completed.

About this task

The Batch Data Collector (BDC) Wait option prevents other HCL Workload Automation jobs that are dependent on the SAP job from being launched until all of the related BDC sessions for the SAP job have ended.

To use the option, a SAP job must write informational messages in its job log. This can be done by modifying the SAP function module BDC_OPEN_GROUP as follows:
FUNCTION BDC_OPEN_GROUP.
... 
CALL 'BDC_OPEN_GROUP' ID 'CLIENT'      FIELD CLIENT
                      ID 'GROUP'       FIELD GROUP
                      ID 'USER'        FIELD USER
                      ID 'KEEP'        FIELD KEEP
                      ID 'HOLDDATE' 	  FIELD HOLDDATE
 			             ID 'DESTINATION' FIELD DEST
 			             ID 'QID'         FIELD QID
 			             ID 'RECORD'      FIELD RECORD
 			             ID 'PROG'        FIELD PROG.
*
IF SY-SUBRC EQ 0.
  BQID   = QID.
  BUSER  = SY-MSGV1.
  BGROUP = GROUP.
* CALL FUNCTION 'DB_COMMIT'.
  CALL FUNCTION 'ENQUEUE_BDC_QID'
  EXPORTING  	DATATYP 		= 'BDC '
 	GROUPID  		= BGROUP
 	QID            		= BQID
  EXCEPTIONS 	FOREIGN_LOCK		= 98
 	SYSTEM_FAILURE  	= 99.
  
  IF SY-SUBRC EQ 0.
     message i368(00) with 'BDCWAIT: ' qid.
  ENDIF.

ENDIF.
*
PERFORM FEHLER_BEHANDLUNG USING SY-SUBRC.
*
*
ENDFUNCTION.
Note: The actual parameters of the call of the C function (CALL ‘BDC_OPEN_GROUPʼ ID ...) might vary depending on the SAP release. With this approach, you obtain a global change in your SAP system.

The completion status of a SAP job launched by HCL Workload Automation is based on the value you set for the bdc_job_status_failed option. By default, this option is set to ignore, meaning that the job is considered successfully completed when the BDC sessions are finished, regardless of their success or failure. For details about the bdc_job_status_failed option, refer to Task string parameters for SAP jobs.