using and enhancing the job document mass ... - sap
TRANSCRIPT
Authors:
Gergely Spiry
Using and Enhancing the Job Document
Mass Maintenance Tool
Document describes the SMSE/SAP BPA by Redwood
scheduler case.
Note, that the usage of tool for the case of reading scheduling
information directly from the managed ABAP system is very similar.
Report: AC_JSM_JOBDOC_MASS_MAINTENANCE
This document describes SP08 with TCI note 2871102 applied.
Version Status Date Notes
1.0 Released 30.07.2019 Version SP08
1.1 Released 15.04.2020 Tag column added with SP11
1.2 Released 28.04.2021 Step Language column added with SP13
Public
Job Management – Usage and Enhancement of Mass Maintenance Tool
Contents
1 General Information _____________________________________________________ 2
2 Important notes on top of SP08 and TCI or SP10 _____________________________ 3
3 Usage of the Tool – Step by Step __________________________________________ 3
4 BAdI to Process Additional Job Document Data (up to 25 custom fields) _______ 14
4.1 Operations ________________________________________________________________ 15
4.2 Example Custom Implementation _____________________________________________ 18 4.2.1 Summary ___________________________________________________________ 18
4.2.2 Method CUSTOM_DISPLAY_RESULTS_ALV _________________________________ 19
4.2.3 Method PROCESS_CUSTOM_FIELDS ______________________________________ 19
4.2.4 Method PROCESS_JOBDOCS ____________________________________________ 20
4.2.5 Method MAP_DATA_TO_UI ____________________________________________ 21
4.2.6 Method FILL_JOBDOC_DEEP ____________________________________________ 21
4.2.7 Method GET_COLUMNS _______________________________________________ 22
4.2.8 External Ticketing and Mass Maintenance _________________________________ 22
4.3 Data Retrieved from SAP BPA Scheduler_______________________________________ 23
5 Enhancement Support by SAP ___________________________________________ 24
1 General Information Using report AC_JSM_JOBDOC_MASS_MAINTENANCE you have the option to mass maintain your job
documentation, i.e. to create new or update existing job documents. The general principle is, that
you can fill job document relevant information into an excel, upload the excel and create a new or
update the corresponding (existing) job documents.
On top the tool offers
1. to read existing job documents data from the Solution Manager DB and to download it into
excel
2. for a given job name and the remote ABAP system in which it runs, to fetch job data either
a. from the SAP ABAP system or
b. from the SAP BPA (or SMSE certified) job scheduler
If you want to create job documents for your running jobs (and even link them), you could do the
following steps:
1. Download the empty excel template
2. Fill excel file with job name and system information
3. Upload excel file to the mass maintenance tool and
a. Read from Scheduler (fill additional data fetched from the scheduler by implementing
BAdI operation FILL_CUSTOM_SMSE_PARAMETERS) or
b. Read from Managed System (fill additional data fetched from the scheduler by
implementing BAdI operation FILL_CUSTOM_XBP_PARAMETERS)
4. Download and enrich the excel file with additional information (e.g. job owner)
Job Management – Usage and Enhancement of Mass Maintenance Tool
5. Get job document(s) created by the tool from the excel content (note that if the job run id is
the most current one, the tool will link the running job to the job document).
Note, that for staging the additional information and to hand it over to the update functions, via BAdI
option you can enhance the mass maintenance tool, i.e. add additional columns to the ALV and the
excel. Important: If you have done so, then on upgrade, in case SAP has added columns (e.g. as with
Tag and Language) you need to adjust your implementation as to columns will be shifted.
2 Important notes on top of SP08 and TCI or SP10
Note Note Text
2982792 Job Management: Prevent inconsistencies with Logical Component Groups or Technical
Scenarios
3022206 Job Management - Mass Maintenance: Allow creation of Monitoring Object of SMSE
type depending on selected Scheduler
2982715 Job Management - Mass Maintenance: Remove Link option on Scheduling UI fails after
MM Create/Update Job Documentation
2965505 Job Management - Mass Maintenance: Job Documentations are read even if input field
System or Client is inconsistent
2955454 Job Management - Mass Maintenance: Job Documentations and Chains are not
correctly read from scheduler
2943009 Job Management - Mass Maintenance: Frequency field not correctly read
2954267 Job Management - Mass Maintenance: Job Documentations without scheduling
information do not get listed at reading
2912986 Issue with Mass import Job data tool: AC_JSM_JOBDOC_MASS_MAINTENANCE
3 Usage of the Tool – Step by Step
Download excel template
No. Action Description Screenshot
Job Management – Usage and Enhancement of Mass Maintenance Tool
1. Transaction: SE38
Then enter the report
program
AC_JSM_JOBDOC_MASS_
MAINTENANCE and click
on “Download Template”
from the tool bar.
2.
Open the downloaded
excel
You should get 52 columns (via BAdI you can add up to 25 columns)
Fill excel with job name and system information
No. Action Description Screenshot
1. a) Level: HEAD
b) Job Name: Job Name
as visible in SM37 or
like the job name
parameter value in
CPS.
c) System: Fill with
system in which the
job is scheduled / has
been executed.
d) Client: Fill with client
in which the job is
scheduled / has been
executed.
Upload excel file to the mass maintenance tool and Read from Scheduler
No. Action Description Screenshot
Job Management – Usage and Enhancement of Mass Maintenance Tool
1.
Click on the radio button
“Read Mass Maintenance
from Excel” use the F4
help for “Choose XLSX
File” and execute.
2.
On the next screen the
columns Level, Job Name,
System and Client should
be filled.
Select the lines and press
Read data from
Scheduler.
Job Management – Usage and Enhancement of Mass Maintenance Tool
3.
You should get this
popup.
.
4.
Download the excel file.
5. If the job has more than 1
step, for the next steps
you should get one line
with level STEP.
Check that the following
columns have been filled:
1. Job ID
2. ABAP Program Name
3. Variant (if job is
schedule with
variant)
4. User
5. System
6. Client
7. Job Priority (SMSE)
8. Schedule Begin Date
(this is the date,
when the job that
was fetched is
executed)
9. Schedule Begin Time
(this is the time,
when the job that
Job Management – Usage and Enhancement of Mass Maintenance Tool
was fetched is
executed)
10. Frequency Unit *
11. Frequency (e.g. 2 in
combination with D
means every 2nd day)
12. Time Zone
13. Time Window
14. Submit Frame
15. Queue
16. Job Definition
*
D → Day
H → Hour
M → Minute
M1 → Month
W → Week
E~<event_name> → e.g.
if job is triggered by event
START, then E~START
A → Advanced (if job
schedule is managed by
submit frame)
Enrich excel with information for the job you want to create a job document
No. Action Description Screenshot
1. For creation of the JD you
should fill the following
excel columns (on top to
the data retrieved).
a) Job Doc Name
b) Document Type "JOB"
c) Job Doc Status
“PRODUCTIVE”
d) IT Functional Owner
e) Organization Unit
f) Business Area
g) Country
Job Management – Usage and Enhancement of Mass Maintenance Tool
h) Region
i) Review Date
j) Logical Component
group (that contains the
system and client)
k) Scheduler Type "SMSE"
l) Business Requirement
m) Job Description
n) Monitoring Description
o) Scheduling Description
p) Error Notes
q) Restart Procedure
r) Cancelation Procedure
s) Contact Person
2.
Load the excel: Click on
the radio button “Read
Mass Maintenance from
Excel” use the F4 help for
“Choose XLSX File” and
execute.
3. If a Job Document with
the name already exists,
it will be identified, i.e. its
number will be filled
(thus for a new document
chose a different name).
4.
Press Validate. Results
should be green.
Job Management – Usage and Enhancement of Mass Maintenance Tool
Further Details on Column Names and Example content.
Column Name Comment Example Content
Level For a simple job with one step HEAD. For a simple job with more than one step, for the steps 2 to N, fill STEP
HEAD
Job Doc Number Tool searches for job document with Job Doc Name and fills the number. If space a new job document will be created.
Job Doc Name Name that the job document shall get ZCW_FBT200_EMEA_DE_SERV_1WFR
Job Name Name of the job as executed in the SAP system ZCW_FBT200_EMEA_DE_SERV_1WFR
Document Type For a simple job it is JOB JOB
Job Doc' Status Status of the job document PRODUCTIVE
Tag(s) [separated by ;]
Tag value(s) assigned to the job document (not existing tag values will be created) - introduced with SP11
PROJECT_A
IT Function Owner Value of Business Context --> Business Owner field. Mr. Business Owner
Organization Unit Value of Business Context --> Organization Unit field (must exist).
ORG_UNIT
Business Area Value of Business Context --> Business Area field (must exist).
BA
Country Value of Business Context --> Country field (must be valid).
DE
Region Value of Business Context --> Region field (must exist). REGION
Review Date (MM/DD/YYYY)
Value of the Review Date field (must be valid). 06/11/2020
New Version? If you set X, then on update a new version of the job document is created, else the highest version is updated.
Create Monitored Object?
If you set X, then a monitoring object is created and linked to the job document, for the job for the maintained system and client.
Job ID/ Job Count Value is filled into the job scheduling UI for the maintained system and client.
ABAP Program Name
Value is filled into the steps table Program Name field (if Level HEAD, then as step 1, if STEP as step 2 or higher).
ZTEST_SIMPLE_REQUEST_REPORT1
Job Management – Usage and Enhancement of Mass Maintenance Tool
Variant Value is filled into the steps table Variant field (if Level HEAD, then as step 1, if STEP as step 2 or higher).
PLANT_1000
User Value is filled into the steps table Variant field (if Level HEAD, then as step 1, if STEP as step 2 or higher).
JOBMAN_TOP
Language Value is filled into the steps table Language field (if Level HEAD, then as step 1, if STEP as step 2 or higher). Expected is the 2-digit ISO language code - introduced with SP13
EN
Step Level
Job Documentation
System System the scheduling information is persisted for. FA7
Client Client the scheduling information is persisted for. 200
Logical Component Group
Value is filled into the System(s) field on the job documentation UI. Use transaction LMDB entering the system (e.g. FA7) to find the related logical component groups and chose the one you want to link to the job document.
ERP_700
Technical Scenario Name
Technical scenario is assigned to the job document, which is created as a detailed document or converted to it on update. If “Create Monitored Object?” is flagged, then the monitoring object is linked to the technical scenario.
Note: To change the type of a job document (e.g. back to simple) you can use utility report
AC_JSM_JOBDOC_MODE_CHANGE (see note 2910541)
Scheduler Type XBP (if direct scheduling) or SMSE (if external scheduling)
SMSE
Job Class (XBP) SAP ABAP job class (A or B or C) B
Job Priority (SMSE) SAP BPA / CPS job priority (will be filled on job scheduling UI for the maintained system and client)
070
Schedule Begin Date (MM/DD/YYYY)
Start date of the job (will be filled on job scheduling UI for the maintained system and client)
04/05/2019
Schedule Begin Time (HH:MM:SS)
Start time of the job (will be filled on job scheduling UI for the maintained system and client)
15:05:00
Frequency Unit SMSE Start Condition of Job D, W, M, A for extended (will be filled on job scheduling UI for the maintained system and client)
A
Job Management – Usage and Enhancement of Mass Maintenance Tool
Frequency Repeat value of the job. If Frequency Unit W and Frequency 1, then weekly job (will be filled on job scheduling UI for the maintained system and client). Make sense for Daily, Weekly, Monthly and Annually job
Time Zone Time Zone of the job (will be filled on job scheduling UI for the maintained system and client)
Europe/Berlin
Monday to Friday (SMSE/ Frequency Unit is Daily)
X, if job shall run Monday to Friday as SMSE job (will be filled on job scheduling UI for the maintained system and client)
Weekday (SMSE/Frequency Unit is Weekly)
e.g. 1111110 if job shall run all days except for Saturday as SMSE job (will be filled on job scheduling UI for the maintained system and client if job is weekly job and into the start condition popup)
0111111
Day of the Month if the frequency is monthly
e.g. 12 if job shall run every 12th day of a month as SMSE job (will be filled on job scheduling UI for the maintained system and client)
Time Window (SMSE)
For SMSE job enter the time window with partition as prefix (will be filled on job scheduling UI for the maintained system and client)
GLOBAL.Custom_not_on_Sunday
Submit Frame (SMSE)
For SMSE job enter the submit frame with partition as prefix (will be filled on job scheduling UI for the maintained system and client)
GLOBAL.Custom_Every_Day
Business Requirement
Value is filled into the Business Context --> Business Process field
Business Process
Job Description Value is filled into the Job Description field Creates Orders
Monitoring Description
Value is filled into the Business Impact field Check for cancellation and existence
Scheduling Description
Value is filled into the Start Condition --> Description field
Every day, but not on Sunday
Error Notes (Analysis/ Resolution)
Value is filled into the error notes field Error Handling - Error Notes
Restart Procedure Value is filled into the restart procedure field Error Handling - Restart Procedure
Cancelation Procedure
Value is filled into the cancellation procedure field Error Handling - Cancellation Procedure
Contact Person (email or SAP User Name)
Value is filled into the Business Context --> Business Group email field.
Job Management – Usage and Enhancement of Mass Maintenance Tool
Predecessor (Job Doc Name)
Value is filled into the Predecessor job field Run After ZCD_FBT200_EMEA_DE_SERV_XXX4
Successor (Job Doc Name)
Value is filled into the Successor job field before ZCD_FBT200_EMEA_DE_SERV_XXX2
Dependency (Job Doc Name)
Value is filled into the Job Dependency field If job ZCD_FBT200_EMEA_DE_SERV_XXX1 is successful
Job Definition (with Isolation Group)
For SMSE job enter the job definition with partition as prefix (will be filled on job scheduling UI for the maintained system and client)
GLOBAL.JOB_DEF_NAME
IT Ticket Value is filled into the ticket field, i.e. the job document will be linked to the ticket number (ITSM ticket must exist).
Create Job Document from Excel for the Job you want to create documentation for
No. Action Description Screenshot
1.
Create Job
Documentation.
If you left flag “In
background” this will
trigger a batch job, in
which you find the
number of the created
job document.
2.
Open the created Job
document. This is what
you should get filled.
You should set manually
the Job Step Desc / Fail
Action if needed or
implement the BAdI.
Job Management – Usage and Enhancement of Mass Maintenance Tool
3.
From the job document
launch the Job Start
Condition Popup.
The Job Frequency is set
for the case that the
Frequency Unit column
value is Y, M, W or D.
The Repeat Value is the
value from column
Frequency.
The weekdays are
flagged according to the
values in column
Weekday (e.g. Friday is
flagged if the value is
0000010)
The Start Date, Time and
Time Zone are set.
Note, that on creation / update of the document the value in the Frequency
Unit column is checked and if
a) Y (yearly) the job will get Job Frequency ZCY
b) M (monthly) the job will get Job Frequency ZCM
d) W (weekly) the job will get Job Frequency ZCW
e) D (daily) the job will get Job Frequency ZCD
Else, it will get Job Frequency ZCT1 (one time). You might have job
frequencies, that cannot be mapped using the Frequency Unit column value.
In this case you could implement BAdI
IF_JSM_JOBDEF_MASSMAINTAIN~GET_START_CONDITIONS and make use
e.g. of the job name prefix to set the start condition accordingly (e.g. Job
Name starts with ZXE --> you set the start condition on ZXE).
4.
From the job document
launch the scheduling UI
for the system, that you
had maintained in the
excel.
Job Management – Usage and Enhancement of Mass Maintenance Tool
6.
You should see the
scheduling information
filled:
1. Queue
2. Priority
3. Start Condition
either Daily, Weekly,
Monthly, Annually
or Extended
4. Start Date
5. Start Time
6. Time Zone
7. If weekly job the
day(s) of the week
flagged.
8. The job definition
filled.
4 BAdI to Process Additional Job Document Data (up to 25 custom fields)
To add information to the job document, you can add up to 25 custom columns, that you can either
fill with data from excel or by fetching data from scheduler or managed system.
BAdI Name: AGS_JSM_JOBDEF_MASSMAINTAIN
BAdI Definition Fallback class
AGS_JSM_JOBDEF_MASSMAINTAIN CL_JSM_JOBDEF_MASSMAINTAIN_FBK
Job Management – Usage and Enhancement of Mass Maintenance Tool
Please note, that at custom implementation (i.e. when you implement one of the BAdIs) you need to
copy over the fallback classes to the BAdI (i.e. don’t use the option, to create the class of the BAdI
empty). Consequently, by copying over the classes, the standard methods contained in the
operations are still supported by SAP and corrections (e.g. delivered by a SAP note) reach those.
However, changes to the implementations of the fallback operations do not reach the BADI
implementations.
If you want to take over the example coding below, add to the PUBLIC SECTION of the Z class
DEFINITION mt_jobdoc_ui and lt_custom_fields, i.e.
DATA: mt_jobdoc_ui TYPE if_jsm_jobdoc_mass_maintenance=>tt_jobdoc_ui.
CLASS-DATA: lt_custom_fields TYPE string_table.
4.1 Operations
Job Management – Usage and Enhancement of Mass Maintenance Tool
Operation Name Comment
GENERATE_JOBDEF_CUSTOM_FIELDS
IO_JOBDEF_REF TYPE REF TO CL_AGS_EJR_JOB_DEF IP_SYSTEM TYPE SMSY_NAME IP_CLIENT TYPE SMSY_MANDT IP_JOBDOC_TYPE TYPE AGS_EJR_DOC_TYPE IS_JOBDOC_DATA TYPE IF_JSM_JOBDOC_MASS_MAINTENANCE=>TS_JOBDOC_MASTER
To process Job Definition Custom Fields
GET_EXTERNAL_SCHEDULER
IP_SYSTEM TYPE SMSY_NAME IP_CLIENT TYPE SMSY_MANDT EP_DESTINATION TYPE RFCDEST EP_QUEUE TYPE BTC_EXT_SDL_QUEUE EP_ISOLATION TYPE BTC_EXT_ISOL_GROUP
To get Queue, Isolation group, and Destination based on the passed System and Client (in case of several queues the first one is handed back).
CUSTOM_DISPLAY_RESULTS_ALV
IO_ALV_FACTORY TYPE REF TO CL_SALV_TABLE
To give a name to the 25 custom columns in ALV (see example
coding below)
PROCESS_CUSTOM_FIELDS
IT_DATA TYPE REF TO DATA CT_JOBDOC_DATA TYPE IF_JSM_JOBDOC_MASS_MAINTENANCE=>TT_JOBDOC_MASTER
Action “Load from Excel”: To hand over custom field values to
ALV for display (see example coding below)
PROCESS_JOBDOCS
IS_JOBDOC_DATA TYPE AGS_JOBDOC_DEEP CS_JOBDOC_DATA TYPE IF_JSM_JOBDOC_MASS_MAINTENANCE=>TS_JOBDOC_MASTER
Action “Read Job Docs from DB”: To hand over values to
CS_JOBDOC_DATA (see example coding below).
MAP_DATA_TO_UI
IT_JOBDOC_DATA TYPE IF_JSM_JOBDOC_MASS_MAINTENANCE=>TT_JOBDOC_MASTER CT_JOBDOC_UI TYPE IF_JSM_JOBDOC_MASS_MAINTENANCE=>TT_JOBDOC_UI
To assign custom column values to ALV column (see example
coding below).
FILL_JOBDOC_DEEP
IP_SYSTEM TYPE SMSY_NAME IP_CLIENT TYPE SMSY_MANDT IS_JOBDOC TYPE IF_JSM_JOBDOC_MASS_MAINTENANCE=>TS_JOBDOC_MASTER CS_JOBDOC_DEEP TYPE AGS_JOBDOC_DEEP
Action “Create/Update Job Documentation”: To hand over
(additional) Job Document data for persisting it, you need to
assign it (from ALV) to provided structure CS_JOBDOC_DEEP (see
example coding below)
MAINTAIN_JOBDOC_CUSFIELDS
IS_JOBDOC_DEEP TYPE AGS_JOBDOC_DEEP IO_JOBDOC_REF TYPE REF TO CL_AGS_EJR_JOB_DEF
To enrich additional/ custom fields of Simple/ Detailed Job Documentation one needs to implement this operation.
MAINTAIN_JOBINST_CUSFIELDS
IS_JOBDOC_DEEP TYPE AGS_JOBDOC_DEEP IO_JOBINST_REF TYPE REF TO CL_AGS_EJR_JOB_INSTANCE
Job Management – Usage and Enhancement of Mass Maintenance Tool
To enrich additional/ custom fields of scheduling UI one needs to implement this operation.
READ_JOBDOC_CUSFIELDS
IO_JOBDOC_REF TYPE REF TO CL_AGS_EJR_JOB_DEF CS_JOBDOC_DEEP TYPE AGS_JOBDOC_DEEP
To while reading the details of the Job Documentation in Mass Maintenance tool, by default we read all supported columns & display the same in ALV. In case customer had implemented the aforementioned BAdI (to store extra parameters for Job Doc/ Scheduling), they have to read those fields while reading it. (If they do not do this, the additional fields will be missing in the ALV)
SET_MODE
IO_JOBDOC_REF TYPE REF TO CL_AGS_EJR_JOB_DEF
To set the job doc type (Job Request, Job Document or Job Chain Document)
GET_START_CONDITIONS
IS_JOBDOC TYPE IF_JSM_JOBDOC_MASS_MAINTENANCE=>TS_JOBDOC_MASTER value( RT_START_CONDITIONS ) TYPE AGS_EJR_TT_PARAMETER_VALUE
To get the start condition fitting to the job schedule information.
CREATE_MONITORED_OBJECTS
IP_SYSTEM TYPE STRING IP_CLIENT TYPE STRING IO_MASSMONOBJ_REF TYPE REF TO CL_JBIMON_MONOBJ_MASSMAINTAIN ET_MESSAGES TYPE BAPIRET2_T EP_RESULT TYPE BAPI_MTYPE value( CT_MONOBJ_PARAMS ) TYPE CL_JBIMON_MONOBJ_MASSMAINTAIN=>TT_MONOBJ_PARAMS
To create Job Monitoring Objects.
READ_SDK_TICKET
IP_DEFINITION_ID TYPE AGS_EJR_JOB_DEFINITION_ID IP_VERSION TYPE AGS_EJR_VERSION value( RT_TICKET_ID ) TYPE CRMT_SRV_INF_ALL_HEADER_T
To read the ticket linked to the job document (default is the ITSM ticket)
ASSIGN_SDK_TICKET
IO_JOBDEF_REF TYPE REF TO CL_AGS_EJR_JOB_DEF IT_TICKET_ID TYPE CRMT_SRV_INF_ALL_HEADER_T ET_BAPIRET TYPE BAPIRETTAB
To assign the ticket number to the job document.
IS_SDK_TICKET_EXISTS
IP_TICKET_ID TYPE STRING value( RP_IS_EXISTS ) TYPE SAP_BOOL
To return, if the ticket exists (default check against ITSM ticket)
GET_COLUMNS
IS_XLSX_DATA TYPE CL_JSM_JOBDOC_XLSX_OPERATIONS=>TS_XLSX_DATA RT_COLUMNS TYPE CL_JSM_JOBDOC_XLSX_OPERATIONS=>TT_XLSX_COLUMNS
To add the custom field names to the excel columns
FILL_CUSTOM_SMSE_PARAMETERS
IO_SCHEDULER_REF TYPE REF TO CL_AGS_EJR_SCHEDULER_INTERFACE ET_MESSAGES TYPE BAPIRET2_T EP_RC TYPE SYSUBRC CS_JOB_HEADER TYPE IF_JSM_JOBDOC_MASS_MAINTENANCE=>TS_JOBDOC_MASTER
Action “Read from Scheduler”: To hand over (additional) data from Scheduler to Job Document assign it to provided structure CS_JOB_HEADER (<ls_jobdoc_list>)
Job Management – Usage and Enhancement of Mass Maintenance Tool
DO_MAPPINT_EXPORT
IT_JOBDOC_STORE TYPE IF_JSM_JOBDOC_MASS_MAINTENANCE=>TT_JOBDOC_MASTER IT_XLSX_DATA TYPE CL_JSM_JOBDOC_XLSX_OPERATIONS=>TT_XLSX_DATA OPTIONAL
Implement this method in case you need to export the custom fields in the excel
GET_TOTAL_EXCEL_COLUMNS
FILL_CUSTOM_XBP_PARAMETERS
I_DEST TYPE RFCDEST ET_MESSAGES TYPE BAPIRET2_T EP_RC TYPE SYSUBRC CS_JOB_HEADER TYPE IF_JSM_JOBDOC_MASS_MAINTENANCE=>TS_JOBDOC_MASTER
Action “Read from Managed System”: To hand over (additional) data from Scheduler to Job Document assign it to provided structure CS_JOB_HEADER (<ls_jobdoc_list>)
4.2 Example Custom Implementation
4.2.1 Summary
1. To get additional information (custom field values) loaded from excel handed over to ALV for
display, implement method PROCESS_CUSTOM_FIELDS.
2. To get additional information (custom field values) loaded from external scheduler handed over
to ALV, implement method FILL_CUSTOM_SMSE_PARAMETERS.
3. To assign custom column values to ALV column, implement method MAP_DATA_TO_UI and hand
over the custom values to ct_jobdoc_ui and assign it to me->mt_jobdoc_ui to be used in method
CUSTOM_DISPLAY_RESULTS_ALV.
4. To give a name to the 25 custom columns in ALV implement method
CUSTOM_DISPLAY_RESULTS_ALV to (e.g. display ‘Email’ for column of custom field 1) using the
mt_jobdoc_ui.
5. To persist the data, i.e. for action “Create/Update Job Documentation” implement method
FILL_JOBDOC_DEEP to hand over (additional) Job Document data from ALV to provided structure
CS_JOBDOC_DEEP.
Job Management – Usage and Enhancement of Mass Maintenance Tool
6. To fetch the custom field values for action “Read Job Docs from DB”, i.e. to using the function
Module “AGS_JSM_JOBDOC_READ” implement method PROCESS_JOBDOCS and hand the values
over to CS_JOBDOC_DATA.
7. To add the custom field names to the excel columns, i.e. for action “Download Template” or
“Download Excel (*.XLSX) implement method GET_COLUMNS and hand over the custom column
names to table rt_columns.
When implementing the example coding you need to add to the PUBLIC SECTION of the DEFINITION
of the copied fall back class mt_jobdoc_ui and lt_custom_fields, i.e.
DATA: mt_jobdoc_ui TYPE if_jsm_jobdoc_mass_maintenance=>tt_jobdoc_ui.
CLASS-DATA: lt_custom_fields TYPE string_table.
4.2.2 Method CUSTOM_DISPLAY_RESULTS_ALV IO_ALV_FACTORY TYPE REF TO CL_SALV_TABLE
To give a name to the 25 custom columns in ALV (e.g. display ‘Email’ for column of custom field 1):
METHOD if_jsm_jobdef_massmaintain~custom_display_results_alv.
DATA: lr_columns TYPE REF TO cl_salv_columns_table,
lr_column TYPE REF TO cl_salv_column_table,
lo_stru TYPE REF TO cl_abap_structdescr,
lv_field TYPE string,
lt_comp_name TYPE string_table.
FIELD-SYMBOLS: <lv_custom> TYPE string,
<ls_jobdoc_ui> TYPE if_jsm_jobdoc_mass_maintenance=>ts_jobdoc_ui.
TRY.
lr_columns = io_alv_factory->get_columns( ).
DATA(lt_columns) = lr_columns->get( ).
LOOP AT me->mt_jobdoc_ui ASSIGNING <ls_jobdoc_ui>.
lo_stru ?= cl_abap_typedescr=>describe_by_data( <ls_jobdoc_ui> ).
DATA(lt_comp) = lo_stru->components.
ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <ls_jobdoc_ui> TO <lv_custom>.
lr_column ?= lr_columns->get_column( CONV #( 'FIELD1') ).
lr_column->set_visible( if_salv_c_bool_sap=>true ).
lr_column->set_long_text( CONV #( 'Email') ).
ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <ls_jobdoc_ui> TO <lv_custom>.
lr_column ?= lr_columns->get_column( CONV #( 'FIELD2') ).
lr_column->set_visible( if_salv_c_bool_sap=>true ).
lr_column->set_long_text( CONV #( 'Printer') ).
ASSIGN COMPONENT 'FIELD3' OF STRUCTURE <ls_jobdoc_ui> TO <lv_custom>.
lr_column ?= lr_columns->get_column( CONV #( 'FIELD3') ).
lr_column->set_visible( if_salv_c_bool_sap=>true ).
lr_column->set_long_text( CONV #( 'Target Group') ).
ENDLOOP.
CATCH cx_salv_not_found cx_salv_msg. "
ENDTRY.
ENDMETHOD.
4.2.3 Method PROCESS_CUSTOM_FIELDS IT_DATA TYPE REF TO DATA CT_JOBDOC_DATA TYPE IF_JSM_JOBDOC_MASS_MAINTENANCE=>TT_JOBDOC_MASTER
Action “Load from Excel”: To hand over custom field values to ALV for display, for example:
METHOD if_jsm_jobdef_massmaintain~process_custom_fields.
DATA:
lv_col TYPE i,
lv_times TYPE i,
lv_col_index TYPE i.
Job Management – Usage and Enhancement of Mass Maintenance Tool
APPEND 'Email' TO me->lt_custom_fields.
APPEND 'Print' TO me->lt_custom_fields.
APPEND 'Target Group' TO me->lt_custom_fields.
FIELD-SYMBOLS: <lt_worksheet_data> TYPE STANDARD TABLE,
<lv_worksheet_data> TYPE string,
<lv_worksheet> TYPE string,
<lv_data> TYPE string,
<ls_jobdoc_data> TYPE if_jsm_jobdoc_mass_maintenance=>ts_jobdoc_master,
<lv_jobname> TYPE string,
<lv_custom_field> TYPE string,
<lv_custom_value> TYPE string,
<field_name> TYPE string.
ASSIGN it_data->* TO <lt_worksheet_data>.
LOOP AT ct_jobdoc_data ASSIGNING <ls_jobdoc_data>.
LOOP AT <lt_worksheet_data> ASSIGNING FIELD-SYMBOL(<ls_worksheet_data>) FROM 2.
ASSIGN COMPONENT 4 OF STRUCTURE <ls_worksheet_data> TO <lv_jobname>.
IF <lv_jobname> = <ls_jobdoc_data>-job_name.
IF <ls_jobdoc_data>-jobdoc_type = 'JOB'.
lv_col = 51.
lv_times = 2.
lv_col_index = 1.
ELSE.
lv_col = 53.
lv_times = 1.
lv_col_index = 3.
ENDIF.
DO lv_times TIMES.
ASSIGN COMPONENT lv_col OF STRUCTURE <ls_worksheet_data> TO <lv_custom_value>.
ASSIGN COMPONENT lv_col_index OF STRUCTURE <ls_jobdoc_data>-custom TO <lv_custom_field>.
<lv_custom_field> = <lv_custom_value>.
lv_col = lv_col + 1.
lv_col_index = lv_col_index + 1.
ENDDO.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDMETHOD.
4.2.4 Method PROCESS_JOBDOCS IS_JOBDOC_DATA TYPE AGS_JOBDOC_DEEP CS_JOBDOC_DATA TYPE IF_JSM_JOBDOC_MASS_MAINTENANCE=>TS_JOBDOC_MASTER
Action “Read Job Docs from DB”: To hand over values to CS_JOBDOC_DATA, for example:
METHOD if_jsm_jobdef_massmaintain~process_jobdocs. DATA: mo_ags_sjr_jobdef TYPE REF TO cl_ags_ejr_job_def,
ls_jobdoc_deep TYPE ags_jobdoc_deep.
APPEND 'Email' TO me->lt_custom_fields.
APPEND 'Print' TO me->lt_custom_fields.
APPEND 'Target Group' TO me->lt_custom_fields.
FIELD-SYMBOLS: <lv_email> TYPE string,
<lv_print> TYPE string,
<lv_target_group> TYPE string.
"For JD add email and Print and read from Job Documenation"
ASSIGN COMPONENT 1 OF STRUCTURE cs_jobdoc_data-custom TO <lv_email>.
ASSIGN COMPONENT 2 OF STRUCTURE cs_jobdoc_data-custom TO <lv_print>.
ASSIGN COMPONENT 3 OF STRUCTURE cs_jobdoc_data-custom TO <lv_target_group>.
"Read Email custom Parameter value from JD"
DATA(ls_system_client) = is_jobdoc_data-system_client.
TRY.
cl_ags_ejf_dpo_factory=>get_job_definition(
EXPORTING
i_job_definition_id = is_jobdoc_data-definition_id
IMPORTING
eo_job_definition = DATA(lr_jobdoc) ).
IF is_jobdoc_data-jobdoc_type = 'J'.
CALL FUNCTION 'AGS_JSM_JOBDOC_READ'
EXPORTING
ip_definition_id = is_jobdoc_data-definition_id " Unique ID of a Job Definition
ip_system = ls_system_client-system
ip_client = ls_system_client-client
IMPORTING
Job Management – Usage and Enhancement of Mass Maintenance Tool
es_jobdoc_deep = ls_jobdoc_deep " Deep structure for Job Documentation
EXCEPTIONS
not_read = 1
OTHERS = 2.
IF sy-subrc = 0.
DATA(lt_scheduler_params) = ls_jobdoc_deep-scheduler_params.
IF lt_scheduler_params IS NOT INITIAL.
READ TABLE lt_scheduler_params INTO DATA(ls_sched_param)
WITH KEY param_name = 'EMAIL'.
IF sy-subrc = 0.
DATA(lv_email_value) = ls_sched_param-param_value.
<lv_email> = lv_email_value.
ENDIF.
ENDIF.
ENDIF.
"Printer
lr_jobdoc->get_step_parameter(
EXPORTING
iv_parameter_name = 'PRINTER' " External Scheduler Parameters
"i_step_param_id = " Unique ID
IMPORTING
et_step_parameter_db = DATA(lt_step_parameters) " Step Parameter
).
LOOP AT lt_step_parameters INTO DATA(ls_step_param).
IF ls_step_param-param_value IS NOT INITIAL.
<lv_print> = ls_step_param-param_value.
ENDIF.
ENDLOOP.
ELSE.
"For JCD, read Target Group from Chain Documentation
lr_jobdoc->get_cus_para(
IMPORTING
et_parameters = DATA(lt_cus_params)
).
READ TABLE lt_cus_params INTO DATA(ls_cus_param)
WITH KEY param_name = 'EXECSERVER_GROUP'.
IF sy-subrc = 0.
<lv_target_group> = ls_cus_param-param_value.
ENDIF.
ENDIF.
CATCH cx_ags_ejr_dpo_factory cx_ags_ejr_database.
ENDTRY.
ENDMETHOD.
4.2.5 Method MAP_DATA_TO_UI
IT_JOBDOC_DATA TYPE IF_JSM_JOBDOC_MASS_MAINTENANCE=>TT_JOBDOC_MASTER CT_JOBDOC_UI TYPE IF_JSM_JOBDOC_MASS_MAINTENANCE=>TT_JOBDOC_UI
To assign custom column values to ALV column:
METHOD if_jsm_jobdef_massmaintain~map_data_to_ui. FIELD-SYMBOLS: <lv_value> TYPE string,
<ls_jobdoc_ui> TYPE if_jsm_jobdoc_mass_maintenance=>ts_jobdoc_ui.
LOOP AT it_jobdoc_data INTO DATA(ls_jobdoc_data).
DATA(lv_row) = sy-tabix.
DATA(ls_custom_fields) = ls_jobdoc_data-custom.
DO 25 TIMES.
DATA(lv_data_index) = sy-index.
ASSIGN COMPONENT lv_data_index OF STRUCTURE ls_custom_fields TO <lv_value>.
READ TABLE ct_jobdoc_ui INDEX lv_row ASSIGNING <ls_jobdoc_ui>.
MOVE-CORRESPONDING ls_custom_fields TO <ls_jobdoc_ui>.
ENDDO.
ENDLOOP.
me->mt_jobdoc_ui = ct_jobdoc_ui.
ENDMETHOD.
4.2.6 Method FILL_JOBDOC_DEEP IP_SYSTEM TYPE SMSY_NAME IP_CLIENT TYPE SMSY_MANDT IS_JOBDOC TYPE IF_JSM_JOBDOC_MASS_MAINTENANCE=>TS_JOBDOC_MASTER CS_JOBDOC_DEEP TYPE AGS_JOBDOC_DEEP
Job Management – Usage and Enhancement of Mass Maintenance Tool
Action “Create/Update Job Documentation”: To hand over (additional) Job Document data for
persisting it, you need to assign it (from ALV) to provided structure CS_JOBDOC_DEEP, for example:
METHOD if_jsm_jobdef_massmaintain~fill_jobdoc_deep.
FIELD-SYMBOLS: <lv_email> TYPE string,
<lv_print> TYPE string,
<lv_target_group> TYPE string,
<ls_step_params> TYPE ags_ejr_s_step_parameter_db,
<ls_cust_params> TYPE ags_ejr_s_parameter_value.
"For JD add email and Print and read from Job Documentation"
ASSIGN COMPONENT 1 OF STRUCTURE is_jobdoc-custom TO <lv_email>.
ASSIGN COMPONENT 2 OF STRUCTURE is_jobdoc-custom TO <lv_print>.
ASSIGN COMPONENT 3 OF STRUCTURE is_jobdoc-custom TO <lv_target_group>.
IF is_jobdoc-jobdoc_type = 'JOB'.
"Email as scheduler parameter"
DATA(ls_scheduler_param) = VALUE ags_ejr_s_scheduler_parameter(
scheduler_type = cl_ags_ejr_constants=>c_scheduler_cps
param_name = `EMAIL`
param_value = <lv_email> ).
INSERT ls_scheduler_param INTO TABLE cs_jobdoc_deep-scheduler_params.
"Printer as step parameter"
READ TABLE cs_jobdoc_deep-step_params ASSIGNING <ls_step_params>
WITH KEY param_name = 'PRINTER'.
IF sy-subrc = 0.
<ls_step_params>-param_value = <lv_print>.
ENDIF.
ENDIF.
ENDMETHOD.
4.2.7 Method GET_COLUMNS IS_XLSX_DATA TYPE CL_JSM_JOBDOC_XLSX_OPERATIONS=>TS_XLSX_DATA
RT_COLUMNS TYPE CL_JSM_JOBDOC_XLSX_OPERATIONS=>TT_XLSX_COLUMNS
For action “Download Template” or “Download Excel (*.XLSX)” to add the custom field names to the
excel columns, implement the method GET_COLUMNS and hand over the custom column names to
table rt_columns.
METHOD if_jsm_jobdef_massmaintain~get_columns.
FIELD-SYMBOLS: <ls_email> TYPE cl_jsm_jobdoc_xlsx_operations=>ts_xlsx_column,
<ls_printer> TYPE cl_jsm_jobdoc_xlsx_operations=>ts_xlsx_column,
<ls_target_group> TYPE cl_jsm_jobdoc_xlsx_operations=>ts_xlsx_column.
READ TABLE rt_columns INDEX 51 ASSIGNING <ls_email>.
<ls_email>-name = 'Email'.
<ls_email>-display_name = 'Email'.
READ TABLE rt_columns INDEX 52 ASSIGNING <ls_printer>.
<ls_printer>-name = 'Printer'.
<ls_printer>-display_name = 'Printer'.
READ TABLE rt_columns INDEX 53 ASSIGNING <ls_target_group>.
<ls_target_group>-name = 'Target Group'.
<ls_target_group>-display_name = 'Target Group'.
ENDMETHOD.
4.2.8 External Ticketing and Mass Maintenance
If you have done external ticket integration that the external ticket information is persisted into table
AGS_JOB_EXTSDK. If you want the mass maintenance tool
a) to read the external ticket into column IT Ticket you need to implement method
if_jsm_jobdef_massmaintain~read_sdk_ticket, i.e. read from table AGS_JOB_EXTSDK the
EXTSDK_ID value for a given DEFINITION_ID and VERSION.
b) to persist the external ticket from column IT Ticket you need to implement method
if_jsm_jobdef_massmaintain~assign_sdk_ticket, i.e. store into table AGS_JOB_EXTSDK
the EXTSDK_ID value and the EXTSDK_UUID for a given DEFINITION_ID and VERSION.
Job Management – Usage and Enhancement of Mass Maintenance Tool
4.3 Data Retrieved from SAP BPA Scheduler
To enrich the job document with additional information from the scheduler, you could make use of
the data delivered by method job_params_get.
Submit Frame and Time Window driven job:
Job Management – Usage and Enhancement of Mass Maintenance Tool
Job running every Friday (weekly job).
5 Enhancement Support by SAP If an issue is observed in the BADI code, the customer needs to debug it and if the issue seems to be
related to a standard function, check how the standard function works in SAP standard.
a) If the issue is reproducible in the non-Z environment as well, then the customer can directly
open a message, with BADIs active (the correction provided by SAP will solve the issue in the
Z environment as well).
b) If the issue does not happen in the non-Z environment, then the BADI coding needs to be
adjusted by a customer developer.