2008 Oct 07 10:25 AM
Hello All,
I have a strange problem..
My selection-screen values are getting refreshed after execution and come back to selection screen. I am using normal ALV Fm to display the values. Can some suggest a possible reason?
Many thanks,
V Nair
2008 Oct 07 10:27 AM
Hi,
Please check if you are clearing the Selection screen variables that you have defined in your programs. Variable declared with the parameter statement should not be cleared in the program.
Only variables declared with Data Statement.
Regards,
Pramod
2008 Oct 07 10:28 AM
Hi,
check your code any where you are refreshing the selection screen variables after calling the alv function module.
Regards,
venkat
2008 Oct 07 11:31 AM
No .. I have checked it..Selection variables are not getting refreshed.
My Code Below
REPORT yhr_icm_exception_report.
*----
-
-
-
-
-
*
Type Pool declarations
*----
-
-
-
-
-
*
TYPE-POOLS: slis, "For AlV
sdydo, "Dynamic Documents
icon. "For ICON
*----
-
-
-
-
-
*
Table declarations
*----
-
-
-
-
-
*
TABLES : yhr_icm_exp_log, "ICM Exceptions Log
yhr_icm_exp_hist. "ICM Exception History
*----
-
-
-
-
-
*
Include Constants
*----
-
-
-
-
-
*
INCLUDE yhr_icm_constants . "Program to hold constants
*----
-
-
-
-
-
*
Types declarations
*----
-
-
-
-
-
*
*-To hold return field
TYPES: BEGIN OF ty_returntab.
INCLUDE STRUCTURE ddshretval. "Interface Structure
TYPES: END OF ty_returntab.
*-To hold deletion records
TYPES : BEGIN OF ty_icm_del,
tab_name TYPE yhr_tabname, "Internal table name
objid TYPE hrobjid, "Object ID
begda TYPE begda, "Begin Date
otype TYPE otype, "Object Type
END OF ty_icm_del.
*-Message details to be displayed
TYPES : BEGIN OF ty_message,
msgnr TYPE msgno, "System message number
text TYPE yhr_icm_exp_log-msgxx, "Message Text
END OF ty_message.
*-To hold exception log
TYPES : BEGIN OF ty_icm_exp_log,
msgno TYPE msgnr, "Message number
run_id TYPE yhr_icm_erun_id, "Exception Run ID
delta_id TYPE yhr_icm_run_id, "Run ID
record_type TYPE yhr_icm_exp_type, "Record Type
otype TYPE yhr_otype, "Object Type
objid TYPE hrobjid, "Object ID
begda TYPE begda, "Begin Date
msgxx TYPE msgxx, "Message
status TYPE yhr_icm_icon, "Status
delta_relevance TYPE yhr_delta_rel, "Delta Relevance
END OF ty_icm_exp_log.
*-To hold email attachment
TYPES: BEGIN OF ty_attach,
text(500) TYPE c, "Text
END OF ty_attach.
*To hold object type & text
TYPES :BEGIN OF ty_objid_text,
objid TYPE objid, "Object ID
text TYPE emnam, "Object Text
END OF ty_objid_text.
*-To hold counter values - Exp , Del & historical
TYPES :BEGIN OF ty_count,
exp(10) TYPE c, "Exceptions
del(10) TYPE c, "Deletions
hist(10) TYPE c, "Historical Deletions
END OF ty_count.
*- To hold lock details
TYPES : BEGIN OF ty_lock,
live TYPE c, "Live Callidus Program
genr TYPE c, "Generation Program
exp TYPE c, "Exception Program
END OF ty_lock.
*----
-
-
-
-
-
*
Range Declarations
*----
-
-
-
-
-
*
RANGES :
gr_objid FOR hrp1001-objid, "Range for Object ID
gr_pernr FOR pa0000-pernr. "Range for Employee number
*----
-
-
-
-
-
*
Internal Table Declarations
*----
-
-
-
-
-
*
DATA : gt_records TYPE STANDARD TABLE OF yhr_icm_exp_report,
gt_objid_text TYPE STANDARD TABLE OF ty_objid_text,
gt_icm_exp_log TYPE STANDARD TABLE OF ty_icm_exp_log,
gt_returntab TYPE STANDARD TABLE OF ty_returntab,
gt_t777o TYPE STANDARD TABLE OF t777o,
gt_diff_tab TYPE STANDARD TABLE OF yhr_icm_diff,
gt_del_tab TYPE STANDARD TABLE OF ty_icm_del, "#EC *
gt_iattach TYPE STANDARD TABLE OF ty_attach,
gt_message TYPE STANDARD TABLE OF ty_message,
gt_fieldcat TYPE slis_t_fieldcat_alv,
gt_heading TYPE slis_t_listheader,
gt_exceptions TYPE yhr_icm_exp_list_t,
gt_events TYPE slis_t_event.
*----
-
-
-
-
-
*
Structure Declarations
*----
-
-
-
-
-
*
DATA : gs_objid_text TYPE ty_objid_text,
gs_icm_exp_log TYPE ty_icm_exp_log,
gs_records TYPE yhr_icm_exp_report,
gs_exceptions TYPE yhr_icm_exp_list,
gs_count TYPE ty_count,
gs_fieldcat TYPE slis_fieldcat_alv, "#EC *
gs_returntab TYPE ty_returntab,
gs_icm_exp_hist TYPE yhr_icm_exp_hist,
gs_iattach TYPE ty_attach,
gs_message TYPE ty_message, "#EC *
gs_layout TYPE slis_layout_alv,
gs_t777o TYPE t777o,
gs_lock TYPE ty_lock.
*----
-
-
-
-
-
*
Constant declarations
*----
-
-
-
-
-
*
CONSTANTS:
c_yes TYPE string VALUE 'YES',
c_no TYPE string VALUE 'NO',
c_true TYPE c VALUE 'X',
c_deletions TYPE c VALUE 'D',
c_delta_no TYPE c VALUE 'N',
c_delta_yes TYPE c VALUE 'Y',
c_historical TYPE c VALUE 'H',
c_a TYPE c VALUE 'A',
c_error TYPE c VALUE 'E',
c_equal(2) TYPE c VALUE 'EQ',
c_participants TYPE c VALUE 'P',
c_include TYPE c VALUE 'I',
c_position TYPE c VALUE 'S',
c_organization TYPE c VALUE 'O',
c_runlock TYPE string VALUE 'RUN_LOCK',
c_parameter TYPE string VALUE 'P',
c_selfield TYPE string VALUE 'SEL_FIELD' ,
c_type TYPE string VALUE 'TYPE',
c_topofpage TYPE string VALUE 'TOP_OF_PAGE',
c_rectype TYPE string VALUE ' S_RECTYPE',
c_objectkey TYPE string VALUE 'OBJECTKEY1',
c_icon_green TYPE string VALUE '@08@',
c_icon_red TYPE string VALUE '@0A@',
c_icon_amber TYPE string VALUE '@09@',
c_green TYPE string VALUE 'GREEN',
c_amber TYPE string VALUE 'AMBER',
c_red TYPE string VALUE 'RED',
c_tabname TYPE slis_tabname VALUE 'GT_RECORDS',
c_structname TYPE dd02l-tabname VALUE 'YHR_ICM_EXP_REPORT' ,
c_siwb_wallpaper TYPE sdydo_key VALUE 'SIWB_WALLPAPER',
c_user_command TYPE slis_formname VALUE 'F01_ALV_EVENT_USER_COMMAND',
c_genname TYPE trdir-name VALUE 'YHR_ICM_GENERATE_EXCEPTIONS',
c_expname TYPE trdir-name VALUE 'YHR_ICM_EXCEPTION_REPORT',
c_pf_status TYPE slis_formname VALUE 'SET_PF_STATUS',
c_msg_class TYPE string VALUE 'YHR_ICM'.
*----
-
-
-
-
-
*
Global Variable Declarations
*----
-
-
-
-
-
*
DATA: gv_email_error TYPE c,
gv_email_sent TYPE c,
gv_exit TYPE c.
*----
-
-
-
-
-
*
Selection Screen - Block I
*----
-
-
-
-
-
*
SELECTION-SCREEN: BEGIN OF BLOCK b3 WITH FRAME TITLE text-s07.
SELECT-OPTIONS:
*- Run ID
s_run_id FOR yhr_icm_exp_hist-run_id,
*- Exception Type
s_rectyp FOR yhr_icm_exp_log-record_type NO INTERVALS,
*- Object Type
s_otype FOR yhr_icm_exp_log-otype NO INTERVALS,
*- Object ID
s_objid FOR yhr_icm_exp_log-objid NO INTERVALS,
*- Start Date
s_begda FOR yhr_icm_exp_log-begda,
*- Message number
s_msgno FOR yhr_icm_exp_log-msgno,
*- Message Text
s_msgxx FOR yhr_icm_exp_log-msgxx.
SELECT-OPTIONS:
*- Delta Relevance
s_relv FOR yhr_icm_exp_log-delta_relevance NO INTERVALS.
PARAMETERS:
*- Long Text
p_ltext AS CHECKBOX DEFAULT ' '.
SELECTION-SCREEN: END OF BLOCK b3.
*----
-
-
-
-
-
*
Selection Screen - Block II
*----
-
-
-
-
-
*
SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-s08.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(14) text-033.
*-Sucess
PARAMETERS:
p_stat_s AS CHECKBOX. "D11K917251
SELECTION-SCREEN COMMENT 24(14) text-034.
*-Warning
PARAMETERS:
p_stat_w AS CHECKBOX. "D11K917251
SELECTION-SCREEN COMMENT 48(15) text-035.
PARAMETERS:
*-Error
p_stat_e AS CHECKBOX . "D11K917251
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN: END OF BLOCK b2.
*----
-
-
-
-
-
*
Selection Screen - Block III
*----
-
-
-
-
-
*
SELECTION-SCREEN: BEGIN OF BLOCK b4 WITH FRAME TITLE text-s09.
*-Email Details
PARAMETERS:
p_email(128) TYPE c.
SELECTION-SCREEN: END OF BLOCK b4.
*----
-
-
-
-
-
*
Selection Screen on value request.
*----
-
-
-
-
-
*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_msgno-low.
PERFORM f4_message.
*----
-
-
-
-
-
*
Selection Screen Output.
*----
-
-
-
-
-
*
AT SELECTION-SCREEN OUTPUT.
CHECK gt_returntab[] IS NOT INITIAL.
REFRESH s_msgno.
s_msgno-option = c_equal.
s_msgno-sign = c_include.
LOOP AT gt_returntab INTO gs_returntab.
s_msgno-low = gs_returntab-fieldval.
s_msgno-high = space.
APPEND s_msgno.
ENDLOOP.
**----
-
-
-
-
-
*
At Selection Screen for Validation
**----
-
-
-
-
-
*
AT SELECTION-SCREEN.
CLEAR gv_email_error.
*-Validate Object Type
PERFORM validate_objecttype.
*-Validate Exception ID
PERFORM fetch_exp_header.
*-Validate Exception Type
PERFORM validate_exptype.
*-Validate Message Number
PERFORM validate_msgno.
*-Validate Message Type
PERFORM validate_msgtype.
*-Validate Delta
PERFORM validate_delta.
*-Validate Email ID
PERFORM validate_email USING p_email
CHANGING gv_email_error.
IF gv_email_error IS NOT INITIAL.
MESSAGE e000(yhr_icm) WITH text-027.
ENDIF.
*----
-
-
-
-
-
*
Initialization
*----
-
-
-
-
-
*
INITIALIZATION.
Initialization
PERFORM initialization.
*----
-
-
-
-
-
*
Start Of Selection
*----
-
-
-
-
-
*
START-OF-SELECTION.
CLEAR : gv_email_error,
gv_email_sent,
gv_exit,
gs_lock.
Try locking the main program
PERFORM lock_generation_program.
CHECK gs_lock IS INITIAL.
*-Fetch the messages stored in table
PERFORM fetch_item_records.
Read object type text.
PERFORM read_text.
Get Object Text
PERFORM get_object_text.
*-Fetch the current SAP messages
PERFORM fetch_records.
*-Update Delta Flag
PERFORM update_delta_flag.
*-Compare messages in table & in SAP
PERFORM compare_message.
If receiver is not blank, try sending out mail
PERFORM send_mail USING p_email.
*----
-
-
-
-
-
*
End Of Selection
*----
-
-
-
-
-
*
END-OF-SELECTION.
IF gv_exit IS NOT INITIAL.
EXIT.
ENDIF.
*-Display ALV
PERFORM display_alv.
*-Build the event table for ALV display
PERFORM build_eventtab CHANGING gt_events[].
*-Fill the layout details
PERFORM layout_build .
Release all locks
PERFORM release_locks.
*-Finally call the grid display
PERFORM display_data.
*&----
-
-
-
-
-
*
*& Form set_pf_status
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
-->RT_EXTAB text
*----
-
-
-
-
-
*
FORM set_pf_status USING rt_extab TYPE slis_t_extab. "#EC *
Set PF Status
SET PF-STATUS 'STANDARD'.
ENDFORM. "Set_pf_status
*&----
-
-
-
-
-
*
*& Form DISPLAY_ALV
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM display_alv .
*- Use FM to create field catalog
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = c_tabname
i_structure_name = c_structname
CHANGING
ct_fieldcat = gt_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 1
OTHERS = 1.
IF sy-subrc = 1.
MESSAGE i000(yhr_icm) WITH text-001.
EXIT.
ENDIF.
*- Remove SEL Field Column as it is not required
DELETE gt_fieldcat WHERE fieldname = c_selfield.
*-If user chooses long text, activate icon
IF p_ltext IS INITIAL.
LOOP AT gt_fieldcat INTO gs_fieldcat WHERE fieldname = c_type.
gs_fieldcat-icon = c_true.
ENDLOOP.
ENDIF.
ENDFORM. " DISPLAY_ALV
*&----
-
-
-
-
-
*
*& Form BUILD_EVENTTAB
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
<--P_GT_EVENTS[] text
*----
-
-
-
-
-
*
FORM build_eventtab CHANGING p_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
*-Get the list of event for alv
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = p_events.
*-Add top of page event to event list
READ TABLE p_events
WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE c_topofpage TO ls_event-form.
APPEND ls_event TO p_events.
ENDIF.
ENDFORM. " BUILD_EVENTTAB
*&----
-
-
-
-
-
*
*& Form LAYOUT_BUILD
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM layout_build .
gs_layout-zebra = c_true.
gs_layout-colwidth_optimize = c_true.
gs_layout-detail_popup = c_true.
gs_layout-detail_initial_lines = c_true.
gs_layout-detail_titlebar = text-044.
gs_layout-box_fieldname = c_selfield.
ENDFORM. " LAYOUT_BUILD
*&----
-
-
-
-
-
*
*& Form DISPLAY_DATA
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM display_data .
*-Display ALV display
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_user_command = c_user_command
i_background_id = c_siwb_wallpaper
i_callback_program = sy-repid
i_callback_pf_status_set = c_pf_status
i_default = c_true
i_save = c_a
is_layout = gs_layout
it_fieldcat = gt_fieldcat
it_events = gt_events
TABLES
t_outtab = gt_records.
ENDFORM. " DISPLAY_DATA
*&----
-
-
-
-
-
*
*& Form FETCH_RECORDS
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM fetch_records .
REFRESH : gt_diff_tab,
gt_del_tab,
gr_pernr,
gt_exceptions.
CLEAR: gs_icm_exp_log.
*-Get Employee details
PERFORM get_person_data.
*-Get Position Details
PERFORM get_position_data.
*-Get Organization Details
PERFORM get_org_data.
*-Get Exception current SAP exception list.
PERFORM get_exception_list.
*-Add deletion records
PERFORM filter_deletions.
ENDFORM. " FETCH_RECORDS
*&----
-
-
-
-
-
*
*& Form top_of_page
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
FORM top_of_page. "#EC *
PERFORM build_comment USING gt_heading.
*-Display Use FM to display Top Of Page
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_heading[].
CLEAR gt_heading.
ENDFORM. "TOP_OF_PAGE
*&----
-
-
-
-
-
*
*& Form build_comment
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
-->P_HEADING text
*----
-
-
-
-
-
*
FORM build_comment USING p_heading TYPE slis_t_listheader.
DATA: ls_hline TYPE slis_listheader,
lv_text(120) TYPE c.
*-Display report title
ls_hline-typ = c_historical.
WRITE text-006 TO lv_text.
ls_hline-info = lv_text.
APPEND ls_hline TO p_heading.
CLEAR ls_hline.
ls_hline-typ = c_s.
*-Remove leading & trailing spaces
CONDENSE : gs_count-del, gs_count-exp, gs_count-hist.
*-If the count is space then pass 0
IF gs_count-del = space.
gs_count-del = 0.
ENDIF.
IF gs_count-exp = space.
gs_count-exp = 0.
ENDIF.
IF gs_count-hist = space.
gs_count-hist = 0.
ENDIF.
IF gs_lock IS INITIAL.
*-Display Deletion, Exception, Historical Count
CONCATENATE text-037 gs_count-del
text-032 gs_count-exp
text-039 gs_count-hist
INTO ls_hline-info SEPARATED BY space.
ELSEIF gs_lock-live IS NOT INITIAL.
ls_hline-info = text-007.
ELSEIF gs_lock-genr IS NOT INITIAL.
ls_hline-info = text-008.
ELSEIF gs_lock-exp IS NOT INITIAL.
ls_hline-info = text-009.
ENDIF.
APPEND ls_hline TO p_heading.
CLEAR ls_hline.
ENDFORM. "BUILD_COMMENT
*&----
-
-
-
-
-
*
*& Form INITIALIZATION
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM initialization .
Read Previous run
SELECT MAX( run_id )
INTO s_run_id-low
FROM yhr_icm_exp_hist. "#EC *
*
s_run_id-option = c_equal.
s_run_id-sign = c_include.
APPEND s_run_id.
*
s_rectyp-option = c_equal.
s_rectyp-sign = c_include.
s_rectyp-low = c_error.
APPEND s_rectyp.
s_rectyp-low = c_deletions.
APPEND s_rectyp.
PERFORM restrict_selections.
*Get the message from Message Class YHR_ICM
SELECT msgnr
text
FROM t100
INTO TABLE gt_message
WHERE arbgb = c_msg_class AND
msgnr GT '000'. "#EC *
ENDFORM. " INITIALIZATION
*&----
-
-
-
-
-
*
*& Form F4_MESSAGE
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
<--P_P_MSGNO text
*----
-
-
-
-
-
*
FORM f4_message.
F4 Help - Display all messages
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MSGNR'
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'S_MSGNR'
window_title = text-045
value_org = c_s
multiple_choice = c_true
TABLES
value_tab = gt_message
return_tab = gt_returntab
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 1.
IF sy-subrc = 1.
MESSAGE i000(yhr_icm) WITH text-002.
EXIT.
ELSEIF sy-subrc = 2.
MESSAGE i000(yhr_icm) WITH text-003.
EXIT.
ENDIF.
ENDFORM. " F4_MESSAGE
*&----
-
-
-
-
-
*
*& Form VALIDATE_OBJECTTYPE
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM validate_objecttype .
CHECK s_otype-low IS NOT INITIAL.
CONDENSE s_otype-low.
Validate object type to check whether user has entered only S, P or O
IF s_otype-low NE c_organization AND
s_otype-low NE c_position AND
s_otype-low NE c_participants .
MESSAGE e000(yhr_icm) WITH 'Enter either S(Position), P(Person) or O(Org Unit)'(021).
ENDIF.
ENDFORM. " VALIDATE_OBJECTTYPE
*&----
-
-
-
-
-
*
*& Form VALIDATE_OBJECTTYPE
*&----
-
-
-
-
-
*
FORM f01_alv_event_user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield."#EC *
DATA : lv_answer TYPE c,
lt_fields TYPE STANDARD TABLE OF sval,
ls_fields TYPE sval.
*-Get the row user has selected in ALV list
READ TABLE gt_records INTO gs_records INDEX rs_selfield-tabindex.
CASE r_ucomm.
WHEN 'DISP'.
CASE gs_records-otype.
WHEN 'S'.
SET PARAMETER ID 'POT' FIELD gs_records-otype.
SET PARAMETER ID 'PON' FIELD gs_records-objid.
CALL TRANSACTION 'PP01_DISP' AND SKIP FIRST SCREEN.
WHEN 'P'.
SET PARAMETER ID 'PER' FIELD gs_records-objid.
CALL TRANSACTION 'PA20' AND SKIP FIRST SCREEN.
WHEN 'O'.
SET PARAMETER ID 'POT' FIELD gs_records-otype.
SET PARAMETER ID 'PON' FIELD gs_records-objid.
CALL TRANSACTION 'PP01_DISP' AND SKIP FIRST SCREEN.
ENDCASE.
WHEN 'CHNG'.
CASE gs_records-otype.
WHEN 'S'.
SET PARAMETER ID 'POT' FIELD gs_records-otype.
SET PARAMETER ID 'PON' FIELD gs_records-objid.
CALL TRANSACTION 'PP01' AND SKIP FIRST SCREEN.
WHEN 'P'.
SET PARAMETER ID 'PER' FIELD gs_records-objid.
CALL TRANSACTION 'PA30' AND SKIP FIRST SCREEN.
WHEN 'O'.
SET PARAMETER ID 'POT' FIELD gs_records-otype.
SET PARAMETER ID 'PON' FIELD gs_records-objid.
CALL TRANSACTION 'PP01' AND SKIP FIRST SCREEN.
ENDCASE.
WHEN 'EMAIL'.
*- Check whether email has already been sent
IF gv_email_sent = c_true.
*- If yes, then display pop up to confirm for mailing again
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
text_question = text-041
text_button_1 = text-042
text_button_2 = text-043
IMPORTING
answer = lv_answer
EXCEPTIONS
text_not_found = 1
OTHERS = 1.
IF sy-subrc = 1.
MESSAGE i000(yhr_icm) WITH text-004.
EXIT.
ENDIF.
*- Continue only if user has selected Yes
CHECK lv_answer = '1'.
ENDIF.
*- Add Email Field & Table
ls_fields-tabname = 'SZA5_D0700'.
ls_fields-fieldname = 'SMTP_ADDR'.
APPEND ls_fields TO lt_fields.
*- Use FM to get new Email ID
CALL FUNCTION 'POPUP_GET_VALUES'
EXPORTING
popup_title = text-s09
start_column = '5'
start_row = '5'
TABLES
fields = lt_fields
EXCEPTIONS
error_in_fields = 1
OTHERS = 1.
IF sy-subrc = 1.
MESSAGE i000(yhr_icm) WITH text-004.
EXIT.
ENDIF.
*- Get the Email user has entered
READ TABLE lt_fields INTO ls_fields INDEX 1.
*- Validate Email ID
PERFORM validate_email USING ls_fields-value
CHANGING gv_email_error.
*- If the flag is not initial, indicates possible error
IF gv_email_error IS NOT INITIAL.
MESSAGE i000(yhr_icm) WITH text-027.
EXIT.
ELSE.
If no error, then try ending email
PERFORM send_mail USING ls_fields-value.
ENDIF.
WHEN 'REFRESH'.
*- Fetch the current SAP messages
PERFORM fetch_records.
*- Update Delta Flag
PERFORM update_delta_flag.
*- Compare messages in table & in SAP
PERFORM compare_message.
*- Refresh alv which is already displayed
rs_selfield-refresh = c_true.
ENDCASE.
ENDFORM. "F01_ALV_EVENT_USER_COMMAND
*&----
-
-
-
-
-
*
*& Form RESTRICT_SELECTIONS
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM restrict_selections .
TYPE-POOLS sscr.
STATICS: lt_restrict TYPE sscr_restrict,
lt_opt_list TYPE sscr_opt_list,
ls_ass TYPE sscr_ass.
Restrict the wage type selection so the user can only enter
values with the 'EQ' clause.
CLEAR lt_opt_list.
MOVE c_objectkey TO lt_opt_list.
MOVE c_true TO: lt_opt_list-options-eq,
lt_opt_list-options-bt,
lt_opt_list-options-cp,
lt_opt_list-options-eq,
lt_opt_list-options-ge,
lt_opt_list-options-gt,
lt_opt_list-options-le,
lt_opt_list-options-lt.
APPEND lt_opt_list TO lt_restrict-opt_list_tab.
MOVE: c_s TO ls_ass-kind,
c_rectype TO ls_ass-name,
c_include TO ls_ass-sg_main,
space TO ls_ass-sg_addy,
c_objectkey TO ls_ass-op_main.
APPEND ls_ass TO lt_restrict-ass_tab.
*-Restrict the values OTYPE
MOVE 'S_OTYPE' TO ls_ass-name.
APPEND ls_ass TO lt_restrict-ass_tab.
*-Restrict the values OBJID
MOVE 'S_OBJID' TO ls_ass-name.
APPEND ls_ass TO lt_restrict-ass_tab.
*-Use FM to restrict the values
CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
EXPORTING
restriction = lt_restrict.
ENDFORM. " RESTRICT_SELECTIONS
*&----
-
-
-
-
-
*
*& Form GET_PERSON_DATA
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM get_person_data .
DATA : lt_del_tab TYPE STANDARD TABLE OF yhr_icm_diff.
SORT gt_icm_exp_log BY msgno .
gr_pernr-sign = c_include.
gr_pernr-option = c_equal.
LOOP AT gt_icm_exp_log INTO gs_icm_exp_log WHERE otype = c_participants AND
record_type = c_error.
*- Sort the table based on msgno and collect pernr
gr_pernr-sign = c_include.
gr_pernr-option = c_equal.
gr_pernr-low = gs_icm_exp_log-objid.
APPEND gr_pernr.
CLEAR gr_pernr-low.
AT END OF msgno. "#EC *
*- For the list of Pernr having same PERNR get the current exp details
IF gs_icm_exp_log-msgno = c_msg_100.
*- Export the pernr list to memory id & import in the below FM
*- Selection of records should be based on values exported from here
EXPORT gr_pernr TO MEMORY ID 'PERNR_0001'.
Get Org Assignment 0001 Data
CALL FUNCTION 'Y_HR_DIFF_PERNR_0001_DATA'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_101. "Y_HR_DIFF_PERNR_0001_ORG_DATA
ELSEIF gs_icm_exp_log-msgno = c_msg_102 .
EXPORT gr_pernr TO MEMORY ID 'PERNR_0000'.
Get Actions 0000 Data
CALL FUNCTION 'Y_HR_DIFF_PERNR_0000_DATA'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_103.
EXPORT gr_pernr TO MEMORY ID 'PERNR_0002'.
Get Personal Details 0002 Data
CALL FUNCTION 'Y_HR_DIFF_PERNR_0002_DATA'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_104.
EXPORT gr_pernr TO MEMORY ID 'PERNR_0004'.
Get Disability 0004 Data
CALL FUNCTION 'Y_HR_DIFF_PERNR_0004_DATA'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_105.
EXPORT gr_pernr TO MEMORY ID 'PERNR_0006'.
Get Addresses 0006 Data
CALL FUNCTION 'Y_HR_DIFF_PERNR_0006_DATA'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_106.
EXPORT gr_pernr TO MEMORY ID 'PERNR_0007'.
Get Planned Time 0007 Data
CALL FUNCTION 'Y_HR_DIFF_PERNR_0007_DATA'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_107.
EXPORT gr_pernr TO MEMORY ID 'PERNR_0016'.
Get Contract Element 0016 Data
CALL FUNCTION 'Y_HR_DIFF_PERNR_0016_DATA'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_108.
EXPORT gr_pernr TO MEMORY ID 'PERNR_0077'.
Get Additional Personal 0077 Data
CALL FUNCTION 'Y_HR_DIFF_PERNR_0077_DATA'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_109 .
EXPORT gr_pernr TO MEMORY ID 'PERNR_0105'.
Get Communications 0105 Data
CALL FUNCTION 'Y_HR_DIFF_PERNR_0105_DATA'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_110.
EXPORT gr_pernr TO MEMORY ID 'PERNR_2001'.
Get Absences 2001 Data
CALL FUNCTION 'Y_HR_DIFF_PERNR_2001_DATA'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_111.
EXPORT gr_pernr TO MEMORY ID 'PERNR_APPR'.
Get Person recevies Appraisal 1045
CALL FUNCTION 'Y_HR_DIFF_PERNR_RECEIVES_APPR'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ENDIF.
REFRESH gr_pernr.
ENDAT.
ENDLOOP.
ENDFORM. " GET_PERSON_DATA
*&----
-
-
-
-
-
*
*& Form FETCH_EXP_HEADER
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM fetch_exp_header .
Get the header details from history table
SELECT run_id
delta_run_id
run_date
begda
endda
INTO CORRESPONDING FIELDS OF gs_icm_exp_hist
UP TO 1 ROWS
FROM yhr_icm_exp_hist
WHERE run_id IN s_run_id.
ENDSELECT.
IF sy-subrc IS NOT INITIAL.
MESSAGE e000(yhr_icm) WITH text-023.
ENDIF.
ENDFORM. " FETCH_EXP_HEADER
*&----
-
-
-
-
-
*
*& Form VALIDATE_EXPTYPE
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM validate_exptype .
IF NOT ( 'E' IN s_rectyp OR
'H' IN s_rectyp OR
'D' IN s_rectyp ).
MESSAGE e000(yhr_icm) WITH text-024.
ENDIF.
ENDFORM. " VALIDATE_EXPTYPE
*&----
-
-
-
-
-
*
*& Form VALIDATE_MSGNO
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM validate_msgno .
*-Validate message number
LOOP AT gt_message INTO gs_message
WHERE msgnr IN s_msgno.
ENDLOOP.
IF sy-subrc IS NOT INITIAL.
MESSAGE e000(yhr_icm) WITH text-025.
ENDIF.
ENDFORM. " VALIDATE_MSGNO
*&----
-
-
-
-
-
*
*& Form VALIDATE_DELTA
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM validate_delta .
*-Validate delta - should be eithere Y or N
IF NOT ( 'Y' IN s_relv OR
'N' IN s_relv ).
MESSAGE e000(yhr_icm) WITH text-026 .
ENDIF.
ENDFORM. " VALIDATE_DELTA
*&----
-
-
-
-
-
*
*& Form VALIDATE_EMAIL
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM validate_email USING lv_us_mail TYPE c
CHANGING lv_chg_flag TYPE c.
CONSTANTS : c_specialchar TYPE string VALUE
'''¬_<>!"&/=?:;,-()#%^$|~*+[]`{}£\u00AC'.
DATA: lv_search TYPE sy-fdpos,
lv_length TYPE i,
lv_len_name TYPE i, "#EC *
lv_len_domain TYPE i, "#EC *
lv_name(100) TYPE c,
lv_domain(100) TYPE c.
CHECK lv_us_mail IS NOT INITIAL.
*-Display message if email has special characters
IF lv_us_mail CA c_specialchar.
lv_chg_flag = 1.
EXIT.
ENDIF.
Calculate the length of the email field.
lv_length = STRLEN( lv_us_mail ) - 1.
If the first or last letter is '@' or '.', terminate the subroutine.
IF lv_us_mail(1) = '@' OR lv_us_mail(1) = '.'.
lv_chg_flag = 1.
EXIT.
ELSEIF lv_us_mail+lv_length(1) = '@'
OR lv_us_mail+lv_length(1) = '.'.
lv_chg_flag = 1.
EXIT.
ENDIF.
Check for white space in email field.
IF lv_us_mail(lv_length) CA ' '.
lv_chg_flag = 1.
EXIT.
ENDIF.
Look for '@' and separate name, domain for validations.
SEARCH lv_us_mail FOR '@'.
IF sy-subrc = 0.
lv_search = sy-fdpos.
lv_name = lv_us_mail+0(lv_search).
lv_search = lv_search + 1.
lv_domain = lv_us_mail+lv_search.
ENDIF.
Check if name or domain is empty.
IF lv_name IS INITIAL OR lv_domain IS INITIAL.
lv_chg_flag = 1.
EXIT.
ENDIF.
Calculate the length of each field.
lv_len_name = STRLEN( lv_name ).
lv_len_domain = STRLEN( lv_domain ).
Validate lv_name and lv_domain for second '@'.
IF lv_name CP '@' OR lv_domain CP '@'.
lv_chg_flag = 1.
EXIT.
ENDIF.
Validate for min. one dot and max. two dots in domain field.
IF lv_domain CA '.'.
CLEAR lv_search.
lv_search = sy-fdpos.
IF lv_search = 0.
lv_chg_flag = 1.
EXIT.
ELSE.
lv_search = lv_search + 1.
IF lv_domain+lv_search CP '.'.
IF sy-fdpos = 0.
lv_chg_flag = 1.
EXIT.
ELSE.
lv_search = lv_search + sy-fdpos + 1.
IF lv_domain+lv_search CP '.'.
lv_chg_flag = 1.
EXIT.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
lv_chg_flag = 1.
EXIT.
ENDIF.
ENDFORM. " VALIDATE_EMAIL
*&----
-
-
-
-
-
*
*& Form GET_POSITION_DATA
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM get_position_data .
DATA : lt_del_tab TYPE STANDARD TABLE OF yhr_icm_diff.
SORT gt_icm_exp_log BY msgno .
LOOP AT gt_icm_exp_log INTO gs_icm_exp_log WHERE otype = c_s AND
record_type = c_error.
gr_objid-sign = c_include.
gr_objid-option = c_equal.
gr_objid-low = gs_icm_exp_log-objid.
APPEND gr_objid.
CLEAR gr_objid-low.
AT END OF msgno. "#EC *
IF gs_icm_exp_log-msgno = c_msg_201.
EXPORT gr_objid TO MEMORY ID 'POS_DATA'.
Get Pos Data from 1000
CALL FUNCTION 'Y_HR_DIFF_POS_DATA'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_202.
EXPORT gr_objid TO MEMORY ID 'POS_REPORTS'.
Get Pos reports to Pos from 1001
CALL FUNCTION 'Y_HR_DIFF_POS_REPORTS_TO'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_203.
EXPORT gr_objid TO MEMORY ID 'POS_REPORTS_PERNR'.
Get Pos report to PERNR from 1001
CALL FUNCTION 'Y_HR_DIFF_POS_REPORTS_TO_PERNR'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_204.
EXPORT gr_objid TO MEMORY ID 'POS_REPORTS_ORG'.
CALL FUNCTION 'Y_HR_DIFF_POS_REPORTS_TO_ORG'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_205.
EXPORT gr_objid TO MEMORY ID 'POS_BELONGS'.
Get Pos belongs to Org from 1001
CALL FUNCTION 'Y_HR_DIFF_POS_BELONGS_TO'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_206. Y_HR_DIFF_POS_ORG_DATA
ELSEIF gs_icm_exp_log-msgno = c_msg_207.
EXPORT gr_objid TO MEMORY ID 'POS_HOLDER'.
Get Pos holder from 1001
CALL FUNCTION 'Y_HR_DIFF_POS_HOLDER'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_208.
EXPORT gr_objid TO MEMORY ID 'POS_DESC_JOB'.
Get Pos decribed by Job from 1001
CALL FUNCTION 'Y_HR_DIFF_POS_DESCRIBED_BY_JOB'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_209. Y_HR_DIFF_JOB_DATA
ELSEIF gs_icm_exp_log-msgno = c_msg_210.
EXPORT gr_objid TO MEMORY ID 'JOB_DESC_GEN'.
Get Job decribed by Generic Job from 1001
CALL FUNCTION 'Y_HR_DIFF_JOB_DESCRIBED_BY_GEN'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_211.
EXPORT gr_objid TO MEMORY ID 'JOB_DESC_PLN'.
Get Job decribed by Plan from 1001
CALL FUNCTION 'Y_HR_DIFF_JOB_DESCRIBED_BY_PLN'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_212. Y_HR_DIFF_GENJOB_DATA
ELSEIF gs_icm_exp_log-msgno = c_msg_213. Y_HR_DIFF_PLAN_DATA
ENDIF.
REFRESH gr_objid.
ENDAT.
ENDLOOP.
ENDFORM. " GET_POSITION_DATA
*&----
-
-
-
-
-
*
*& Form GET_ORG_DATA
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM get_org_data .
DATA : lt_del_tab TYPE STANDARD TABLE OF yhr_icm_diff.
LOOP AT gt_icm_exp_log INTO gs_icm_exp_log WHERE otype = c_o AND
record_type = c_error.
gr_objid-sign = c_include.
gr_objid-option = c_equal.
gr_objid-low = gs_icm_exp_log-objid.
APPEND gr_objid.
CLEAR gr_objid-low.
AT END OF msgno. "#EC *
IF gs_icm_exp_log-msgno = c_msg_301.
EXPORT gr_objid TO MEMORY ID 'ORG_DATA'.
CALL FUNCTION 'Y_HR_DIFF_ORG_DATA'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ELSEIF gs_icm_exp_log-msgno = c_msg_302.
EXPORT gr_objid TO MEMORY ID 'ORG_REPORTS_TO'.
Get Org reports to Org from 1001
CALL FUNCTION 'Y_HR_DIFF_ORG_REPORTS_TO'
EXPORTING
period_begda = gs_icm_exp_hist-begda
period_endda = gs_icm_exp_hist-endda
refresh = space
UPDATE = space
TABLES
diff_tab = gt_diff_tab
del_tab = lt_del_tab.
ENDIF.
REFRESH gr_objid.
ENDAT.
ENDLOOP.
ENDFORM. " GET_ORG_DATA
*&----
-
-
-
-
-
*
*& Form FETCH_ITEM_RECORDS
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM fetch_item_records .
Fetch OBJID & corresponding messages
SELECT run_id
delta_id
record_type
otype
objid
begda
msgno
msgxx
status
delta_relevance
INTO CORRESPONDING FIELDS OF TABLE gt_icm_exp_log
FROM yhr_icm_exp_log
WHERE run_id IN s_run_id AND
record_type IN s_rectyp AND
otype IN s_otype AND
objid IN s_objid AND
begda IN s_begda AND
msgno IN s_msgno AND
msgxx IN s_msgxx AND
delta_relevance IN s_relv.
IF sy-subrc IS NOT INITIAL.
MESSAGE i000(yhr_icm) WITH text-005.
gv_exit = c_true.
STOP.
ENDIF.
ENDFORM. " FETCH_ITEM_RECORDS
*&----
-
-
-
-
-
*
*& Form GET_EXCEPTION_LIST
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM get_exception_list .
Get the SAP Exceptions
CALL FUNCTION 'YHR_ICM_EXP_BUILD'
EXPORTING
im_begda = gs_icm_exp_hist-begda
im_endda = gs_icm_exp_hist-endda
IMPORTING
ex_exceptions = gt_exceptions.
ENDFORM. " GET_EXCEPTION_LIST
*&----
-
-
-
-
-
*
*& Form COMPARE_MESSAGE
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM compare_message.
REFRESH gt_records.
CLEAR gs_count.
*-Loop at old exception log
LOOP AT gt_icm_exp_log INTO gs_icm_exp_log.
MOVE-CORRESPONDING gs_icm_exp_log TO gs_records.
*- Get the count of deletion, historical deletion & exceptions
IF gs_records-record_type = c_deletions.
ADD 1 TO gs_count-del.
ELSEIF gs_records-record_type = c_historical.
ADD 1 TO gs_count-hist.
ELSE.
ADD 1 TO gs_count-exp.
ENDIF.
*- Now check whether exception still exists
READ TABLE gt_exceptions INTO gs_exceptions
WITH KEY objid = gs_icm_exp_log-objid
otype = gs_icm_exp_log-otype
record_type = gs_icm_exp_log-record_type
msgno = gs_icm_exp_log-msgno.
*- If no, indicates the exception has been removed
IF sy-subrc IS NOT INITIAL.
gs_records-status = '@08@'.
gs_records-delta_relevance = gs_exceptions-delta_relevance.
ELSE.
gs_records-status = gs_icm_exp_log-status.
ENDIF.
IF gs_records-delta_relevance = c_delta_yes .
gs_records-delta_relevance = c_yes.
ELSEIF gs_records-delta_relevance = c_delta_no.
gs_records-delta_relevance = c_no.
ENDIF.
IF p_ltext IS NOT INITIAL.
*- If long text is selected then display object type text
READ TABLE gt_t777o INTO gs_t777o WITH KEY otype = gs_icm_exp_log-otype .
gs_records-otype = gs_t777o-otext.
IF gs_records-record_type = c_deletions.
gs_records-record_type = text-028.
ELSEIF gs_records-record_type = c_historical.
gs_records-record_type = text-030.
ELSE.
gs_records-record_type = text-032.
ENDIF.
*- Display ICON if long text is selected
IF gs_records-status = c_icon_green.
gs_records-status = c_green.
ELSEIF gs_records-status = c_icon_red.
gs_records-status = c_red.
ELSEIF gs_records-status = c_icon_amber.
gs_records-status = c_amber.
ENDIF.
ELSE.
gs_records-otype = gs_icm_exp_log-otype .
ENDIF.
*- Get the object text
READ TABLE gt_objid_text INTO gs_objid_text
WITH KEY objid = gs_icm_exp_log-objid.
gs_records-objtxt = gs_objid_text-text.
D11K917251 - Start of Change
IF gs_records-status = c_icon_green AND p_stat_s IS INITIAL.
CONTINUE.
ENDIF.
IF gs_records-status = c_icon_amber AND p_stat_w IS INITIAL.
CONTINUE.
ENDIF.
IF gs_records-status = c_icon_red AND p_stat_e IS INITIAL.
CONTINUE.
ENDIF.
D11K917251 - End of Change
gs_records-run_id = gs_icm_exp_hist-run_id. "D11K917251
gs_records-run_date = gs_icm_exp_hist-run_date.
APPEND gs_records TO gt_records.
CLEAR gs_records.
ENDLOOP.
ENDFORM. " COMPARE_MESSAGE
*&----
-
-
-
-
-
*
*& Form UPDATE_DELTA_FLAG
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM update_delta_flag .
DATA : ls_diff_tab TYPE yhr_icm_diff.
LOOP AT gt_exceptions INTO gs_exceptions.
CLEAR ls_diff_tab.
READ TABLE gt_diff_tab INTO ls_diff_tab
WITH KEY objid = gs_exceptions-objid.
IF sy-subrc IS INITIAL AND ls_diff_tab IS INITIAL.
gs_exceptions-delta_relevance = c_delta_yes.
ELSE.
gs_exceptions-delta_relevance = c_delta_no.
ENDIF.
MODIFY gt_exceptions FROM gs_exceptions TRANSPORTING delta_relevance.
ENDLOOP.
ENDFORM. " UPDATE_DELTA_FLAG
*&----
-
-
-
-
-
*
*& Form READ_TEXT
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM read_text .
SELECT langu
otype
otext
INTO CORRESPONDING FIELDS OF TABLE gt_t777o
FROM t777o
WHERE langu = sy-langu AND
otype IN ('O', 'S', 'P').
ENDFORM. " READ_TEXT
*&----
-
-
-
-
-
*
*& Form GET_OBJECT_TEXT
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM get_object_text .
CHECK gt_icm_exp_log[] IS NOT INITIAL.
Get Employee Text
SELECT pernr
ename
INTO TABLE gt_objid_text
FROM pa0001
FOR ALL ENTRIES IN gt_icm_exp_log
WHERE pernr = gt_icm_exp_log-objid
AND begda LE gs_icm_exp_hist-run_date
AND endda GE gs_icm_exp_hist-run_date.
Get Position & Organization Text.
SELECT objid
mc_stext
FROM hrp1000
APPENDING TABLE gt_objid_text
FOR ALL ENTRIES IN gt_icm_exp_log
WHERE plvar = '01'
AND otype = gt_icm_exp_log-otype
AND objid = gt_icm_exp_log-objid
AND istat = '1'
AND begda LE gs_icm_exp_hist-run_date
AND endda GE gs_icm_exp_hist-run_date.
ENDFORM. " GET_OBJECT_TEXT
*&----
-
-
-
-
-
*
*& Form SEND_MAIL
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM send_mail USING lv_us_mail TYPE c.
DATA:
lt_imessage TYPE STANDARD TABLE OF solisti1 WITH HEADER LINE,
lt_ipacking_list TYPE STANDARD TABLE OF sopcklsti1 ,
lt_ireceivers TYPE STANDARD TABLE OF somlreci1,
lt_iattachment TYPE STANDARD TABLE OF solisti1.
DATA:
ls_ireceivers TYPE somlreci1,
ls_iattachment TYPE solisti1, "#EC *
ls_ipacking_list TYPE sopcklsti1,
ls_xdocdata LIKE sodocchgi1.
DATA: lv_xcnt TYPE i.
CHECK lv_us_mail IS NOT INITIAL.
Convert internal table to mail format
PERFORM conver_table.
Fill the document data.
ls_xdocdata-doc_size = 1.
Populate the subject/generic message attributes
ls_xdocdata-obj_langu = sy-langu.
ls_xdocdata-obj_name = 'SAPRPT'.
ls_xdocdata-obj_descr = text-006.
Fill the document data and get size of attachment
CLEAR ls_xdocdata.
READ TABLE gt_records INTO gs_records INDEX lv_xcnt.
ls_xdocdata-doc_size =
( lv_xcnt - 1 ) * 255 + 10.
ls_xdocdata-obj_langu = sy-langu.
ls_xdocdata-obj_name = 'SAPRPT'.
ls_xdocdata-obj_descr = text-006.
CLEAR ls_iattachment.
REFRESH lt_iattachment.
lt_iattachment[] = gt_iattach[].
Describe the body of the message
CLEAR ls_ipacking_list.
REFRESH lt_ipacking_list.
ls_ipacking_list-transf_bin = space.
ls_ipacking_list-head_start = 1.
ls_ipacking_list-head_num = 0.
ls_ipacking_list-body_start = 1.
DESCRIBE TABLE lt_imessage LINES ls_ipacking_list-body_num.
ls_ipacking_list-doc_type = 'RAW'.
APPEND ls_ipacking_list TO lt_ipacking_list.
Create attachment notification
ls_ipacking_list-transf_bin = c_true.
ls_ipacking_list-head_start = 1.
ls_ipacking_list-head_num = 1.
ls_ipacking_list-body_start = 1.
DESCRIBE TABLE lt_iattachment LINES ls_ipacking_list-body_num.
ls_ipacking_list-doc_type = 'XLS'.
ls_ipacking_list-obj_descr = text-046.
ls_ipacking_list-obj_name = text-047.
ls_ipacking_list-doc_size = ls_ipacking_list-body_num * 255.
APPEND ls_ipacking_list TO lt_ipacking_list.
Add the recipients email address
CLEAR ls_ireceivers. REFRESH lt_ireceivers.
ls_ireceivers-receiver = lv_us_mail.
ls_ireceivers-rec_type = 'U'.
ls_ireceivers-com_type = 'INT'.
ls_ireceivers-notif_del = c_true.
ls_ireceivers-notif_ndel = c_true.
APPEND ls_ireceivers TO lt_ireceivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = ls_xdocdata
put_in_outbox = c_true
commit_work = c_true
TABLES
packing_list = lt_ipacking_list
contents_bin = lt_iattachment
contents_txt = lt_imessage
receivers = lt_ireceivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc = 0.
SUBMIT rsconn01 WITH mode EQ 'INT' AND RETURN.
COMMIT WORK .
MESSAGE i000(yhr_icm) WITH text-036.
gv_email_sent = c_true.
ENDIF.
ENDFORM. " SEND_MAIL
*&----
-
-
-
-
-
*
*& Form CONVER_TABLE
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM conver_table .
CLASS cl_abap_char_utilities DEFINITION LOAD.
CONSTANTS:
c_con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
c_con_cret TYPE c VALUE cl_abap_char_utilities=>cr_lf,
c_exp_report TYPE string VALUE 'YHR_ICM_EXP_REPORT'.
FIELD-SYMBOLS :
c_con_tab INTO ls_comp.
ENDIF.
CONCATENATE gs_iattach ls_comp INTO gs_iattach.
ELSE.
EXIT.
ENDIF.
ENDDO.
CONCATENATE c_con_cret gs_iattach INTO gs_iattach.
APPEND gs_iattach TO gt_iattach.
CLEAR gs_iattach.
ENDLOOP.
ENDFORM. " CONVER_TABLE
*&----
-
-
-
-
-
*
*& Form FILTER_DELETIONS
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM filter_deletions .
LOOP AT gt_icm_exp_log INTO gs_icm_exp_log
WHERE record_type = c_deletions OR
record_type = c_historical.
MOVE-CORRESPONDING gs_icm_exp_log TO gs_exceptions.
APPEND gs_exceptions TO gt_exceptions.
ENDLOOP.
ENDFORM. " FILTER_DELETIONS
*&----
-
-
-
-
-
*
*& Form LOCK_GENERATION_PROGRAM
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM lock_generation_program .
Try locking generation program .
CALL FUNCTION 'ENQUEUE_ES_PROG'
EXPORTING
name = c_genname
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc <> 0.
gs_lock-genr = c_true.
ENDIF.
Try locking generation program .
CALL FUNCTION 'ENQUEUE_ES_PROG'
EXPORTING
name = c_expname
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc <> 0.
gs_lock-exp = c_true.
ENDIF.
Check whether Main Callidus Program is running.
SELECT low
INTO gs_lock-live
FROM yhr_icm_tvarv
UP TO 1 ROWS
WHERE name = c_runlock AND
type = c_parameter.
ENDSELECT.
ENDFORM. " LOCK_GENERATION_PROGRAM
*&----
-
-
-
-
-
*
*& Form RELEASE_LOCKS
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM release_locks .
IF gs_lock-genr IS INITIAL.
Release Generation Program lock
CALL FUNCTION 'DEQUEUE_ES_PROG'
EXPORTING
name = c_genname.
ENDIF.
IF gs_lock-exp IS INITIAL.
Release Exception Report lock
CALL FUNCTION 'DEQUEUE_ES_PROG'
EXPORTING
name = c_expname.
ENDIF.
ENDFORM. " RELEASE_LOCKS
*&----
-
-
-
-
-
*
*& Form VALIDATE_MSGTYPE
*&----
-
-
-
-
-
*
text
*----
-
-
-
-
-
*
--> p1 text
<-- p2 text
*----
-
-
-
-
-
*
FORM validate_msgtype .
IF p_stat_s IS INITIAL AND
p_stat_e IS INITIAL AND
p_stat_w IS INITIAL.
MESSAGE e000(yhr_icm) WITH text-010.
ENDIF.
ENDFORM. " VALIDATE_MSGTYPE