TEST BANK For Evidence-Based Practice for Nurses Appraisal and Application of...
Zrisk analysis
1. *&---------------------------------------------------------------------*
*& Report ZRISK_ANALYSIS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZRISK_ANALYSIS.
**---------------------- Tables Declaration --------------------
tables :ZMASTER_RISK,ZMASTER_ABILITY1,ZMASTER_ABILITY2,ZFINAL_DISPLAY,AGR_TCO
DES,AGR_USERS.
*---------------------- Type Pools Declaration ---------------
type-pools: slis.
*---------------------- Internal table Declaration -----------------
DATA: it_ability1 TYPE STANDARD TABLE OF zmaster_ability1 with header line,
"itab
wa_ability1 TYPE zmaster_ability1,
it_ability2 type standard table of zmaster_ability2 with header line,
wa_ability2 type zmaster_ability2,
it_tcode type standard table of agr_1251 with header line,
wa_tcode type agr_1251,
IT_USERS TYPE STANDARD TABLE OF AGR_USERS WITH HEADER LINE,
it_final type standard table of zfinal_display with header line,
it_final1 type standard table of zmaster_ability2 with header line,
wa_final type zfinal_display.
data:begin of line,
zzrole type agr_tcodes-AGR_NAME,
zzTCODE type agr_tcodes-TCODE,
zzuser type agr_users-UNAME,
end of line.
DATA: it_role LIKE TABLE OF LINE WITH HEADER LINE.
*****Alv Decalaration*****************
data: g_repid like sy-repid,
gs_print type slis_print_alv,
t_list_top_of_page type slis_t_listheader,
gt_events type slis_t_event,
i_sort type slis_t_sortinfo_alv,
gs_layout type slis_layout_alv,
gt_fieldcat type slis_t_fieldcat_alv,
gs_cell type slis_lineinfo,
fieldcat_ln like line of gt_fieldcat.
data : gs_variant like disvariant,
g_save.
data : dmbtr2 type dmbtr.
data : it_events type slis_t_event with header line.
data : l_list(105) type c. "Store the Top-of-page headings
data : t_formname_top_of_page type slis_formname value 'TOP_OF_PAGE'.
2. data : it_fieldcat type slis_t_fieldcat_alv with header line.
data : ls_sort type table of slis_sortinfo_alv.
data : wa_sort like line of ls_sort.
******Selection Screen***************************
selection-screen begin of block b1 with frame title text-002.
select-options : s_tcode for zmaster_ability1-zzcol1.
selection-screen end of block b1.
start-of-selection.
select zzrisk_id into CORRESPONDING FIELDS OF TABLE it_final from zmaster
_ability1
where zzcol1 in s_tcode
or zzcol2 in s_tcode
or zzcol3 in s_tcode
or zzcol4 in s_tcode
or zzcol5 in s_tcode
or zzcol6 in s_tcode
or zzcol7 in s_tcode
or zzcol8 in s_tcode
or zzcol9 in s_tcode
or zzcol10 in s_tcode
or zzcol11 in s_tcode
or zzcol12 in s_tcode
or CP1_ZZCOL1 in s_tcode
or CP1_ZZCOL2 in s_tcode
or CP1_ZZCOL3 in s_tcode
or CP1_ZZCOL4 in s_tcode
or CP1_ZZCOL5 in s_tcode
or CP1_ZZCOL6 in s_tcode
or CP1_ZZCOL7 in s_tcode
or CP1_ZZCOL8 in s_tcode
or CP1_ZZCOL9 in s_tcode
or CP1_ZZCOL10 in s_tcode
or CP1_ZZCOL11 in s_tcode
or CP1_ZZCOL12 in s_tcode
or CP2_ZZCOL1 in s_tcode
or CP2_ZZCOL2 in s_tcode
or CP2_ZZCOL3 in s_tcode
or CP2_ZZCOL4 in s_tcode
or CP2_ZZCOL5 in s_tcode
or CP2_ZZCOL6 in s_tcode
or CP2_ZZCOL7 in s_tcode
or CP2_ZZCOL8 in s_tcode
or CP2_ZZCOL9 in s_tcode
or CP2_ZZCOL10 in s_tcode
or CP2_ZZCOL11 in s_tcode
or CP2_ZZCOL12 in s_tcode
or CP3_ZZCOL1 in s_tcode
or CP3_ZZCOL2 in s_tcode
3. or CP3_ZZCOL3 in s_tcode
or CP3_ZZCOL4 in s_tcode
or CP3_ZZCOL5 in s_tcode
or CP3_ZZCOL6 in s_tcode
or CP3_ZZCOL7 in s_tcode
or CP3_ZZCOL8 in s_tcode
or CP3_ZZCOL9 in s_tcode
or CP3_ZZCOL10 in s_tcode
or CP3_ZZCOL11 in s_tcode
or CP3_ZZCOL12 in s_tcode
or CP4_ZZCOL1 in s_tcode
or CP4_ZZCOL2 in s_tcode
or CP4_ZZCOL3 in s_tcode
or CP4_ZZCOL4 in s_tcode
or CP4_ZZCOL5 in s_tcode
or CP4_ZZCOL6 in s_tcode
or CP4_ZZCOL7 in s_tcode
or CP4_ZZCOL8 in s_tcode
or CP4_ZZCOL9 in s_tcode
or CP4_ZZCOL10 in s_tcode
or CP4_ZZCOL11 in s_tcode
or CP4_ZZCOL12 in s_tcode
or zzcol13 in s_tcode
or zzcol14 in s_tcode
or zzcol15 in s_tcode
or zzcol16 in s_tcode
or zzcol17 in s_tcode
or zzcol18 in s_tcode
or zzcol19 in s_tcode
or zzcol20 in s_tcode
or zzcol21 in s_tcode
or zzcol22 in s_tcode
or zzcol23 in s_tcode
or zzcol24 in s_tcode.
if sy-subrc eq 0.
select * from zmaster_ability2 into corresponding fields of table it_abil
ity2
for all entries in it_FINAL
where zzrisk_id = it_FINAL-zzrisk_id.
endif.
***
select ZZRISK_ID from zmaster_ability2 into corresponding fields of table i
t_final1
where zzcol1 in s_tcode
or zzcol2 in s_tcode
or zzcol3 in s_tcode
or zzcol4 in s_tcode
or zzcol5 in s_tcode
or zzcol6 in s_tcode
or zzcol7 in s_tcode
or zzcol8 in s_tcode
or zzcol9 in s_tcode
4. or zzcol10 in s_tcode
or zzcol11 in s_tcode
or zzcol12 in s_tcode
or CP1_ZZCOL1 in s_tcode
or CP1_ZZCOL2 in s_tcode
or CP1_ZZCOL3 in s_tcode
or CP1_ZZCOL4 in s_tcode
or CP1_ZZCOL5 in s_tcode
or CP1_ZZCOL6 in s_tcode
or CP1_ZZCOL7 in s_tcode
or CP1_ZZCOL8 in s_tcode
or CP1_ZZCOL9 in s_tcode
or CP1_ZZCOL10 in s_tcode
or CP1_ZZCOL11 in s_tcode
or CP1_ZZCOL12 in s_tcode
or CP2_ZZCOL1 in s_tcode
or CP2_ZZCOL2 in s_tcode
or CP2_ZZCOL3 in s_tcode
or CP2_ZZCOL4 in s_tcode
or CP2_ZZCOL5 in s_tcode
or CP2_ZZCOL6 in s_tcode
or CP2_ZZCOL7 in s_tcode
or CP2_ZZCOL8 in s_tcode
or CP2_ZZCOL9 in s_tcode
or CP2_ZZCOL10 in s_tcode
or CP2_ZZCOL11 in s_tcode
or CP2_ZZCOL12 in s_tcode
or CP3_ZZCOL1 in s_tcode
or CP3_ZZCOL2 in s_tcode
or CP3_ZZCOL3 in s_tcode
or CP3_ZZCOL4 in s_tcode
or CP3_ZZCOL5 in s_tcode
or CP3_ZZCOL6 in s_tcode
or CP3_ZZCOL7 in s_tcode
or CP3_ZZCOL8 in s_tcode
or CP3_ZZCOL9 in s_tcode
or CP3_ZZCOL10 in s_tcode
or CP3_ZZCOL11 in s_tcode
or CP3_ZZCOL12 in s_tcode
or CP4_ZZCOL1 in s_tcode
or CP4_ZZCOL2 in s_tcode
or CP4_ZZCOL3 in s_tcode
or CP4_ZZCOL4 in s_tcode
or CP4_ZZCOL5 in s_tcode
or CP4_ZZCOL6 in s_tcode
or CP4_ZZCOL7 in s_tcode
or CP4_ZZCOL8 in s_tcode
or CP4_ZZCOL9 in s_tcode
or CP4_ZZCOL10 in s_tcode
or CP4_ZZCOL11 in s_tcode
or CP4_ZZCOL12 in s_tcode
or zzcol13 in s_tcode
or zzcol14 in s_tcode
5. or zzcol15 in s_tcode
or zzcol16 in s_tcode
or zzcol17 in s_tcode
or zzcol18 in s_tcode
or zzcol19 in s_tcode
or zzcol20 in s_tcode
or zzcol21 in s_tcode
or zzcol22 in s_tcode
or zzcol23 in s_tcode
or zzcol24 in s_tcode.
if sy-subrc eq 0.
select * from zmaster_ability1 into corresponding fields of table it_abil
ity1
for all entries in it_FINAL1
where zzrisk_id = it_FINAL1-zzrisk_id.
endif.
loop at it_final.
read table it_ability2 with key zzrisk_id = it_FINAL-zzrisk_id.
if sy-subrc = 0.
it_final-zzcol1 = it_ability2-zzcol1.
it_final-zzcol2 = it_ability2-zzcol2.
it_final-zzcol3 = it_ability2-zzcol3.
it_final-zzcol4 = it_ability2-zzcol4.
it_final-zzcol5 = it_ability2-zzcol5.
it_final-zzcol6 = it_ability2-zzcol6.
it_final-zzcol7 = it_ability2-zzcol7.
it_final-zzcol8 = it_ability2-zzcol8.
it_final-zzcol9 = it_ability2-zzcol9.
it_final-zzcol10 = it_ability2-zzcol10.
it_final-zzcol11 = it_ability2-zzcol11.
it_final-zzcol12 = it_ability2-zzcol12.
it_final-CP1_ZZCOL1 = it_ability2-CP1_ZZCOL1.
it_final-CP1_ZZCOL2 = it_ability2-CP1_ZZCOL2.
it_final-CP1_ZZCOL3 = it_ability2-CP1_ZZCOL3.
it_final-CP1_ZZCOL4 = it_ability2-CP1_ZZCOL4.
it_final-CP1_ZZCOL5 = it_ability2-CP1_ZZCOL5.
it_final-CP1_ZZCOL6 = it_ability2-CP1_ZZCOL6.
it_final-CP1_ZZCOL7 = it_ability2-CP1_ZZCOL7.
it_final-CP1_ZZCOL8 = it_ability2-CP1_ZZCOL8.
it_final-CP1_ZZCOL9 = it_ability2-CP1_ZZCOL9.
it_final-CP1_ZZCOL10 = it_ability2-CP1_ZZCOL10.
it_final-CP1_ZZCOL11 = it_ability2-CP1_ZZCOL11.
it_final-CP1_ZZCOL12 = it_ability2-CP1_ZZCOL12.
it_final-CP2_ZZCOL1 = it_ability2-CP2_ZZCOL1.
it_final-CP2_ZZCOL2 = it_ability2-CP2_ZZCOL2.
it_final-CP2_ZZCOL3 = it_ability2-CP2_ZZCOL3.
it_final-CP2_ZZCOL4 = it_ability2-CP2_ZZCOL4.
it_final-CP2_ZZCOL5 = it_ability2-CP2_ZZCOL5.
it_final-CP2_ZZCOL6 = it_ability2-CP2_ZZCOL6.
it_final-CP2_ZZCOL7 = it_ability2-CP2_ZZCOL7.
it_final-CP2_ZZCOL8 = it_ability2-CP2_ZZCOL8.
8. it_final1-CP4_ZZCOL12 = it_ability1-CP4_ZZCOL12.
it_final1-zzcol13 = it_ability1-zzcol13.
it_final1-zzcol14 = it_ability1-zzcol14.
it_final1-zzcol15 = it_ability1-zzcol15.
it_final1-zzcol16 = it_ability1-zzcol16.
it_final1-zzcol17 = it_ability1-zzcol17.
it_final1-zzcol18 = it_ability1-zzcol18.
it_final1-zzcol19 = it_ability1-zzcol19.
it_final1-zzcol20 = it_ability1-zzcol20.
it_final1-zzcol21 = it_ability1-zzcol21.
it_final1-zzcol22 = it_ability1-zzcol22.
it_final1-zzcol23 = it_ability1-zzcol23.
it_final1-zzcol24 = it_ability1-zzcol24.
endif.
modify it_final1.
endloop.
append lines of it_final1 to it_final.
sort it_FINAL by zzrisk_id.
****
select AGR_NAME LOW into (IT_ROLE-ZZROLE,IT_ROLE-ZZTCODE) from agr_1251
for all entries in it_final
where OBJECT = 'S_TCODE'
AND LOW = it_final-zzcol1
or LOW = it_final-zzcol2
or LOW = it_final-zzcol3
or LOW = it_final-zzcol4
or LOW = it_final-zzcol5
or LOW = it_final-zzcol6
or LOW = it_final-zzcol7
or LOW = it_final-zzcol8
or LOW = it_final-zzcol9
or LOW = it_final-zzcol10
or LOW = it_final-zzcol11
or LOW = it_final-zzcol12
or LOW = it_final-CP1_ZZCOL1
or LOW = it_final-CP1_ZZCOL2
or LOW = it_final-CP1_ZZCOL3
or LOW = it_final-CP1_ZZCOL4
or LOW = it_final-CP1_ZZCOL5
or LOW = it_final-CP1_ZZCOL6
or LOW = it_final-CP1_ZZCOL7
or LOW = it_final-CP1_ZZCOL8
or LOW = it_final-CP1_ZZCOL9
or LOW = it_final-CP1_ZZCOL10
or LOW = it_final-CP1_ZZCOL11
or LOW = it_final-CP1_ZZCOL12
or LOW = it_final-CP2_ZZCOL1
or LOW = it_final-CP2_ZZCOL2
or LOW = it_final-CP2_ZZCOL3
or LOW = it_final-CP2_ZZCOL4
or LOW = it_final-CP2_ZZCOL5
or LOW = it_final-CP2_ZZCOL6
or LOW = it_final-CP2_ZZCOL7
9. or LOW = it_final-CP2_ZZCOL8
or LOW = it_final-CP2_ZZCOL9
or LOW = it_final-CP2_ZZCOL10
or LOW = it_final-CP2_ZZCOL11
or LOW = it_final-CP2_ZZCOL12
or LOW = it_final-CP3_ZZCOL1
or LOW = it_final-CP3_ZZCOL2
or LOW = it_final-CP3_ZZCOL3
or LOW = it_final-CP3_ZZCOL4
or LOW = it_final-CP3_ZZCOL5
or LOW = it_final-CP3_ZZCOL6
or LOW = it_final-CP3_ZZCOL7
or LOW = it_final-CP3_ZZCOL8
or LOW = it_final-CP3_ZZCOL9
or LOW = it_final-CP3_ZZCOL10
or LOW = it_final-CP3_ZZCOL11
or LOW = it_final-CP3_ZZCOL12
or LOW = it_final-CP4_ZZCOL1
or LOW = it_final-CP4_ZZCOL2
or LOW = it_final-CP4_ZZCOL3
or LOW = it_final-CP4_ZZCOL4
or LOW = it_final-CP4_ZZCOL5
or LOW = it_final-CP4_ZZCOL6
or LOW = it_final-CP4_ZZCOL7
or LOW = it_final-CP4_ZZCOL8
or LOW = it_final-CP4_ZZCOL9
or LOW = it_final-CP4_ZZCOL10
or LOW = it_final-CP4_ZZCOL11
or LOW = it_final-CP4_ZZCOL12
or LOW = it_final-zzcol13
or LOW = it_final-zzcol14
or LOW = it_final-zzcol15
or LOW = it_final-zzcol16
or LOW = it_final-zzcol17
or LOW = it_final-zzcol18
or LOW = it_final-zzcol19
or LOW = it_final-zzcol20
or LOW = it_final-zzcol21
or LOW = it_final-zzcol22
or LOW = it_final-zzcol23
or LOW = it_final-zzcol24.
APPEND IT_ROLE.
ENDSELECT.
* DELETE ADJACENT DUPLICATES FROM IT_ROLE.
* modify it_final.
* loop at it_final.
* read table it_tcode with key OBJECT = 'S_TCODE' .
*
* if sy-subrc = 0.
*
* it_final-zzrole = it_tcode-AGR_NAME.
* it_final-zztcode = it_tcode-low.
10. * endif.
*
* modify it_final .
* endloop.
* sort it_final ascending by zzrole.
SELECT AGR_NAME UNAME FROM AGR_USERS INTO CORRESPONDING FIELDS OF TABLE IT_
USERS
FOR ALL ENTRIES IN IT_ROLE
WHERE AGR_NAME = IT_ROLE-ZZROLE .
LOOP AT IT_role.
READ TABLE IT_USERS with key AGR_NAME = IT_ROLE-ZZROLE .
IF SY-SUBRC = 0.
IT_ROLE-ZZUSER = IT_USERS-UNAME.
ENDIF.
MODIFY IT_ROLE TRANSPORTING ZZUSER.
ENDLOOP.
DELETE IT_ROLE WHERE ZZUSER EQ '' OR ZZTCODE = ''.
perform build.
perform get_events.
perform sub_comment_build using t_list_top_of_page.
perform call_alv.
*&------------Form BUILD
form build.
data: fieldcat_in type slis_fieldcat_alv.
refresh gt_fieldcat.
clear fieldcat_ln.
fieldcat_ln-fieldname = 'ZZTCODE'. "1
* fieldcat_ln-tabname = 'ITAB'.
fieldcat_ln-seltext_l = 'TR CODE'.
fieldcat_ln-no_zero = 'X'.
fieldcat_ln-just = 'C'.
fieldcat_ln-outputlen = '10'.
append fieldcat_ln to gt_fieldcat.
clear fieldcat_ln.
fieldcat_ln-fieldname = 'ZZROLE'. "1
* fieldcat_ln-tabname = 'ITAB'.
fieldcat_ln-seltext_l = 'ROLE'.
fieldcat_ln-no_zero = 'X'.
fieldcat_ln-just = 'C'.
fieldcat_ln-outputlen = '10'.
append fieldcat_ln to gt_fieldcat.
clear fieldcat_ln.
fieldcat_ln-fieldname = 'ZZUSER'. "1
11. * fieldcat_ln-tabname = 'ITAB'.
fieldcat_ln-seltext_l = 'USER'.
fieldcat_ln-no_zero = 'X'.
fieldcat_ln-just = 'C'.
fieldcat_ln-outputlen = '10'.
append fieldcat_ln to gt_fieldcat.
endform.
*&---------------Form CALL_ALV
data t_layout type slis_layout_alv.
*&---------------------------------------------------------------------
*
*& Form CALL_ALV
*&---------------------------------------------------------------------
*
form call_alv.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_save = g_save
is_variant = gs_variant
it_fieldcat = gt_fieldcat[]
is_layout = gs_layout
it_events = it_events[]
TABLES
t_outtab = it_ROLE
EXCEPTIONS
program_error = 1
others = 2.
endform. "CALL_ALV
*&---------------------------------------------------------------------*
*& Form get_events
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form get_events .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_events[]
EXCEPTIONS
list_type_wrong = 1
others = 2.
if sy-subrc <> 0.
12. message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
read table it_events with key name = slis_ev_top_of_page
into it_events.
if sy-subrc = 0.
move t_formname_top_of_page to it_events-form.
append it_events.
endif.
endform. " get_events
*&---------------------------------------------------------------------*
*& Form BUILD_LAYOUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form build_layout .
gs_layout-no_input = 'X'.
gs_layout-colwidth_optimize = 'X'.
gs_layout-totals_text = 'Totals'(201).
gs_layout-totals_only = 'X'.
gs_layout-zebra = 'X'.
gs_layout-info_fieldname = 'LINE_COLOR'.
* gd_layout-group_change_edit = 'X'.
endform. " BUILD_LAYOUT
*&---------------------------------------------------------------------
*
*& Form sub_comment_build
*&---------------------------------------------------------------------
*
form sub_comment_build using i_top_of_page type slis_t_listheader.
data: ls_line type slis_listheader,
ld_lines type i,
ld_linesc(10) type c.
clear ls_line.
ls_line-typ = 'H'.
ls_line-info = 'Ester Industries Limited'.
append ls_line to i_top_of_page.
ls_line-typ = 'H'.
ls_line-info = 'SOD RISK ANALYSIS Report'.
13. append ls_line to i_top_of_page.
clear: ls_line, l_list.
ls_line-typ = 'S'.
ls_line-info = l_list.
append ls_line to i_top_of_page.
* Date
ls_line-typ = 'S'.
ls_line-key = 'DATE: '.
concatenate sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) into ls_line-info. "todays date
append ls_line to i_top_of_page.
clear: ls_line, l_list.
* Total No. of Records Selected
* DESCRIBE TABLE ITAB LINES LD_LINES.
*
** describe table ITAB lines ld_lines.
* LD_LINESC = LD_LINES.
* CONCATENATE ' Total No. of Records Selected: ' LD_LINESC
* INTO LS_LINE SEPARATED BY SPACE.
* LS_LINE-TYP = 'A'.
* LS_LINE-INFO = LS_LINE.
* APPEND LS_LINE TO I_TOP_OF_PAGE.
clear: ls_line, l_list.
endform. " sub_comment_build
*&---------------------------------------------------------------------
*
*& Form top_of_page
*&---------------------------------------------------------------------
*
* text
*----------------------------------------------------------------------
*
form top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_list_top_of_page.
endform. "TOP_OF_PAGE