Show TOC

 Inserting Your Own Programs as Tasks Locate this document in the navigation structure

Use

You can include your own transaction directly in the task plan without having to make changes to the transaction.

If you run your own program periodically, you can extend the program so that it can be used in flow definitions (Workflows) and you can see the processing status in the monitor.

For the program to use the worklist, the programming guidelines for the job monitor and the flow definition must be met. You must carry out further program extensions.

Procedure

Connecting Your Own Program to the Monitor

The program CUSTOMER_REPORT is available in the system as standard. This shows you how to call two function modules that enable the easiest connection to the monitor ( without a workflow connection).

Incorporate the two Includes SCHEDMAN_INIT and SCHEDMAN_CLOSE in your program. The program is connected to the Job Monitor.

Utilizing Your Program for Flow Definition

If you also want to utilize your program in flow definitions, you must incorporate the Include RKASMAWF in the selection screen.

At the beginning of processing, install the following coding instead of the Include SCHEDMAN_INIT mentioned above:

data: gs_key like schedman_key.

data: ls_detail like schedman_detail_user.

data: ls_appl like schedman_customer.

data: ld_dummy(20) value 'ABCDEFGHIJKL'.

constants: customer_appl like smmain-application value 'CUSTOMER'

ls_detail-application = customer_appl.

ls_detail-repid = sy-repid.

* ls_detail-testflag = true. "Decide if testrun or not

ls_appl-customer_field = ld_dummy.

CALL FUNCTION 'KPEP_MONI_INIT_RECORD'

EXPORTING

LS_DETAIL = ls_detail

* LS_WITEM =

LS_APPL = ls_appl

* LD_WORKLIST_FLAG = ' '

IMPORTING

LS_KEY = gs_key.

* TABLES

* LT_SELKRIT =

* LT_PARAM =

In the structure SCHEDMAN_CUSTOMER , you can define your own fields, which you fill with values at runtime.

At the end of program processing, install the following coding instead of the Include SCHEDMAN_CLOSE :

data: ld_aplstat like smmain-aplstat.

data: LS_SCMA_EVENT LIKE SCMA_EVENT.

constants: c_status_ok value '0'.

constants: c_status_undefined value '2'.

constants: c_status_error value '4'.

constants: c_status_aborted value 'A'.

include schedman_events.

*.decide the status you want to send

ld_aplstat = c_status_ok.

* ld_aplstat = c_status_undefined.

* ld_aplstat = c_status_error.

* ld_aplstat = c_status_aborted.

*.If the report ended with error -> stop whole workflow. Otherwise

*.start the next job

if ld_aplstat = '4' or ld_aplstat = 'A'.

ls_scma_event-wf_event = cs_wf_events-error.

else.

ls_scma_event-wf_event = cs_wf_events-finished.

endif.

*.the variables wf_witem and wf_okey

*.are from include RKASMAWF and are filled AUTOMATICALLY

*.fill them into strcuture ls_scma_event

ls_scma_event-WF_WITEM = wf_witem.

ls_scma_event-WF_OKEY = wf_okey.

CALL FUNCTION 'KPEP_MONI_CLOSE_RECORD'

EXPORTING

LS_KEY = gs_key.

* LS_MESSAGE =

* LD_OBJECTS =

* LS_EXT =

* LS_RL =

LS_SCMA_EVENT = ls_scma_event

* TABLES

* LT_SPOOL =

CHANGING

LD_APLSTAT = ld_aplstat

EXCEPTIONS

NO_ID_GIVEN = 1

OTHERS = 2.

 ( )

For programs that you want to include in flow definitions, note the following:

  • If it is a cross-application program, you need to copy the program that was already stored with an application, and then store the new program in the SCMAPROG table with the new application.

Enter the name of your program as a customer program in Schedule Manager. For more information, see Inserting Your Own Programs as Tasks .

You can include your own program in a flow definition using these settings, and see the results in the monitor.