Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying Jobs in SM37 with function module BP_JOBLIST_PROCESSOR_SM37B

Former Member
0 Kudos

Hello and good afternoon,

I am attempting to display a list of jobs using function module BP_JOBLIST_PROCESSOR_SM37B. I am using this approach as there are no Parameter ID's associated with the transaction SM37 and therefore I cannot use the SET/GET Parameter ID approach followed by CALL TRANSACTION 'SM37' AND SKIP FIRST SCREEN.

I have initially used function module 'BP_JOB_SELECT' to select the job details based on my restriction criteria into a table (JOBSELECT_JOBLIST).

Using the results contained in table JOBSELECT_JOBLIST I then call function module 'BP_JOBLIST_PROCESSOR_SM37B' passing the tables parameter JOBLIST = JOBSELECT_JOBLIST. I also pass the parameter JOBLIST_OPCODE = '21' to allow the user to edit these jobs.

The correct list of jobs and their current job status are then displayed in an ALV grid. My problem arises when the user wishes to REFRESH the details contained within the result list. The REFRESH option/button doesn't appear to work. I have attempted to CANCEL jobs and DELETE jobs and the background process works (i.e. the selected job is cancelled/deleted) however the screen displays the job in the state it was originally displayed in, even after a REFRESH.

Am I missing something? I'm super confused!!

Assistance would be greatly appreciated.

Kind Regards,

Richard.

1 REPLY 1

Former Member
0 Kudos

Hi All,

I have managed to solve the problem...

I had a look at function module 'BP_JOB_MAINTENANCE'. This function module uses both function modules 'BP_JOB_SELECT' and 'BP_JOBLIST_PROCESSOR_SM37B' as I was doing. The only difference being that I was not updating the selection criteria (i.e. I was specifying the IMPORTING parameter JOBSEL_PARAM_IN but not updating the parameters with the EXPORTING parameter JOBSEL_PARAM_OUT).

Once I had done this, all worked correcly...

Below is a snippet of the code:

DATA: ls_jobsel_param_in TYPE btcselect,

lt_jobselect_joblist TYPE TABLE OF tbtcjob.

ls_jobsel_param_in-jobname = 'ZR_PROJECT_PLAN_COPY*'.

ls_jobsel_param_in-from_date = gv_start_date.

ls_jobsel_param_in-from_time = gv_start_time.

ls_jobsel_param_in-username = sy-uname.

ls_jobsel_param_in-schedul = 'X'.

ls_jobsel_param_in-ready = 'X'.

ls_jobsel_param_in-running = 'X'.

ls_jobsel_param_in-finished = 'X'.

ls_jobsel_param_in-aborted = 'X'.

CALL FUNCTION 'BP_JOB_SELECT'

EXPORTING

jobselect_dialog = 'N'

jobsel_param_in = ls_jobsel_param_in

  • ENDDATE = ' '

  • ENDTIME = ' '

  • SELECTION = 'AL'

IMPORTING

jobsel_param_out = ls_jobsel_param_in

TABLES

jobselect_joblist = lt_jobselect_joblist

  • JOBNAME_EXT_SEL =

  • USERNAME_EXT_SEL =

  • CHANGING

  • ERROR_CODE =

  • EXCEPTIONS

  • INVALID_DIALOG_TYPE = 1

  • JOBNAME_MISSING = 2

  • NO_JOBS_FOUND = 3

  • SELECTION_CANCELED = 4

  • USERNAME_MISSING = 5

  • OTHERS = 6

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'BP_JOBLIST_PROCESSOR_SM37B'

EXPORTING

joblist_opcode = '21'

joblist_refr_param = ls_jobsel_param_in

  • IMPORTING

  • JOBLIST_SEL_JOB =

TABLES

joblist = lt_jobselect_joblist

  • EXCEPTIONS

  • INVALID_OPCODE = 1

  • JOBLIST_IS_EMPTY = 2

  • JOBLIST_PROCESSOR_CANCELED = 3

  • OTHERS = 4

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.