Trigger Workflow When We Creating Sales order in SAP ABAP.
Trigger Workflow Creating Sales order in
SAP ABAP.
*DATA :lt_container TYPE STANDARD TABLE OF swr_cont,
* ls_container TYPE swr_cont.
*IF sy-tcode = 'VA02'.
* SELECT SINGLE kvgr2 FROM vbak
* INTO lv_kvgr2
* WHERE vbeln = vbak-vbeln.
* IF vbak-kvgr2 = lv_kvgr2.
* ELSE.
** PERFORM call_workflow.
* flag_kvgr2 = 'X'.
* ls_container-element = 'DOC_NO'.
* ls_container-value = vbak-vbeln.
* APPEND ls_container TO lt_container.
* CLEAR : ls_container.
*
* CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
* EXPORTING
* task = 'WS999001233'
* language = sy-langu
* do_commit = 'X'
* user = sy-uname
** START_ASYNCHRONOUS = ' '
** DESIRED_START_DATE =
** DESIRED_START_TIME =
** DESIRED_START_ZONLO = SY-ZONLO
** IFS_XML_CONTAINER =
** IMPORTING
** RETURN_CODE =
** WORKITEM_ID =
** NEW_STATUS =
* TABLES
* input_container = lt_container
** MESSAGE_LINES =
** MESSAGE_STRUCT =
** AGENTS =
* .
* IF sy-subrc = 0.
* EXPORT flag_kvgr2 FROM flag_kvgr2 TO MEMORY ID 'SY-UNAME'.
* ENDIF.
* ENDIF.
*ENDIF.
* ls_container TYPE swr_cont.
*IF sy-tcode = 'VA02'.
* SELECT SINGLE kvgr2 FROM vbak
* INTO lv_kvgr2
* WHERE vbeln = vbak-vbeln.
* IF vbak-kvgr2 = lv_kvgr2.
* ELSE.
** PERFORM call_workflow.
* flag_kvgr2 = 'X'.
* ls_container-element = 'DOC_NO'.
* ls_container-value = vbak-vbeln.
* APPEND ls_container TO lt_container.
* CLEAR : ls_container.
*
* CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
* EXPORTING
* task = 'WS999001233'
* language = sy-langu
* do_commit = 'X'
* user = sy-uname
** START_ASYNCHRONOUS = ' '
** DESIRED_START_DATE =
** DESIRED_START_TIME =
** DESIRED_START_ZONLO = SY-ZONLO
** IFS_XML_CONTAINER =
** IMPORTING
** RETURN_CODE =
** WORKITEM_ID =
** NEW_STATUS =
* TABLES
* input_container = lt_container
** MESSAGE_LINES =
** MESSAGE_STRUCT =
** AGENTS =
* .
* IF sy-subrc = 0.
* EXPORT flag_kvgr2 FROM flag_kvgr2 TO MEMORY ID 'SY-UNAME'.
* ENDIF.
* ENDIF.
*ENDIF.