*&---------------------------------------------------------------------*
*& Report YPS_SD_SYSTEM_HEALTH_CHECK_2
*&
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& CTI Confidential *
*&---------------------------------------------------------------------*
*& History and Purpose behind the development : - *
*& This report is used to send a list of Trades/WBS WBS that *
*& are INST (confirmed) status and are not billed/cancelled *
*& or the line only partially billed. The report output is *
*& needed to be send as mail to the HDS Outlook Inbox. *
*& This report comes under system health check 2 *
*& *
*&---------------------------------------------------------------------*
REPORT yps_sd_system_health_check_2 NO STANDARD PAGE HEADING
LINE-SIZE 120.
.
TYPE-POOLS: slis.
INCLUDE <list>.
TABLES: vmpa, prps.
***********************************************************************
* G L O B A L V A R I A B L E S
***********************************************************************
CONSTANTS: gc_objnr TYPE jcds-objnr VALUE 'PR%',
gc_stat TYPE jcds-stat VALUE 'E0002',
gc_vbtyp_m TYPE vbfa-vbtyp_n VALUE 'M',
gc_indicator TYPE ysd_parameter-indicator1
VALUE 'YPS_SD_SYSTEM_HEALTH_CHECK_2',
gc_param1 TYPE ysd_parameter-param1 VALUE 'WBS_INST',
gc_netwr TYPE vbap-netwr VALUE 0.
DATA: gv_to_date TYPE sy-datum.
DATA: gv_from_date TYPE sy-datum.
DATA: gv_no_wbs_processed TYPE p,
gv_no_wbs_cancel TYPE p,
gv_no_wbs_not_yet_processed TYPE p,
gv_no_wbs_partially_processed TYPE p.
DATA : gi_fieldcat TYPE slis_t_fieldcat_alv,
gw_fieldcat TYPE slis_fieldcat_alv,
gi_layout TYPE slis_layout_alv,
gi_events TYPE slis_t_event,
gw_events TYPE slis_alv_event.
DATA : gi_fieldcat_j TYPE slis_t_fieldcat_alv,
gw_fieldcat_j TYPE slis_fieldcat_alv,
gi_layout_j TYPE slis_layout_alv,
gi_events_j TYPE slis_t_event,
gw_events_j TYPE slis_alv_event.
DATA : formname_top_of_page TYPE slis_formname VALUE
'GENERATE_TOP_OF_PAGE',
formname_end_of_list TYPE slis_formname VALUE
'GENERATE_END_OF_PAGE',
formname_top_of_page_j TYPE slis_formname VALUE
'GENERATE_TOP_OF_PAGE_J',
formname_end_of_list_j TYPE slis_formname VALUE
'GENERATE_END_OF_PAGE',
formname_user_command TYPE slis_formname VALUE 'USER_COMMAND'.
CONSTANTS: lc_bcbatch TYPE syuname VALUE 'BC-BATCH',
gc_bg_repid TYPE sy-repid VALUE 'yps_shc_send_mail_2'.
***********************************************************************
* T A B L E T Y P E D E C L A R A T I O N
***********************************************************************
TYPES: BEGIN OF ty_jcds,
objnr TYPE jcds-objnr,
END OF ty_jcds.
TYPES: BEGIN OF ty_vmpa,
ps_psp_pnr TYPE vmpa-ps_psp_pnr,
vbeln TYPE vmpa-vbeln,
posnr TYPE vmpa-posnr,
fksaa TYPE vbup-fksaa,
END OF ty_vmpa.
TYPES: BEGIN OF ty_prps,
pspnr TYPE prps-pspnr,
objnr TYPE prps-objnr,
post1 TYPE prps-post1,
END OF ty_prps.
TYPES: BEGIN OF ty_vbup,
vbeln TYPE vbup-vbeln,
posnr TYPE vbup-posnr,
fksaa TYPE vbup-fksaa,
END OF ty_vbup.
TYPES: BEGIN OF ty_vbap,
vbeln TYPE vbap-vbeln,
posnr TYPE vbap-posnr,
netwr TYPE vbap-netwr,
werks TYPE vbap-werks, "Added by Defect#2351 DS6K903071
END OF ty_vbap.
TYPES: BEGIN OF ty_vbfark,
vbelv TYPE vbfa-vbelv,
posnv TYPE vbfa-posnv,
vbeln TYPE vbfa-vbeln,
posnr TYPE vbfa-posnn,
fksto TYPE vbrk-fksto,
END OF ty_vbfark.
TYPES: BEGIN OF ty_vbrk,
vbeln TYPE vbrk-vbeln,
ernam TYPE vbrk-ernam,
erdat TYPE vbrk-erdat,
sfakn TYPE vbrk-sfakn,
zzjobid TYPE vbrk-zzjobid,
END OF ty_vbrk.
TYPES : BEGIN OF ty_username,
bname TYPE user_addr-bname,
name_textc TYPE user_addr-name_textc,
END OF ty_username.
TYPES: BEGIN OF ty_final,
vbeln TYPE vbup-vbeln,
posnr TYPE vbup-posnr,
ps_psp_pnr TYPE vmpa-ps_psp_pnr,
post1 TYPE prps-post1,
werks TYPE vbap-werks, "Added by Defect#2351 DS6K903071
conf_date TYPE vbrk-erdat, "Added by Defect#2351 DS6K903071
abtei TYPE yca_werks_distr-abtei, "Added by Defect#2351 DS6K903071
fksaa TYPE vbup-fksaa,
statv(20),
netwr TYPE vbap-netwr,
canc_flg(1),
END OF ty_final.
TYPES: BEGIN OF ty_history,
vbelv TYPE vbfa-vbelv,
posnv TYPE vbfa-posnv,
vbeln TYPE vbfa-vbeln,
posnr TYPE vbfa-posnn,
fksto TYPE vbrk-fksto,
canc_doc TYPE vbrk-vbeln,
ernam TYPE vbrk-ernam,
erdat TYPE vbrk-erdat,
zzjobid TYPE vbrk-zzjobid,
name_textc TYPE user_addr-name_textc,
END OF ty_history.
TYPES: BEGIN OF ty_remarks,
remarks TYPE ysd_parameter-remarks,
END OF ty_remarks.
*" Start of changes Defect#2351
TYPES: BEGIN OF ty_afvc_afvu,
projn TYPE afvc-projn,
aufpl TYPE afvv-aufpl,
aplzl TYPE afvv-aplzl,
END OF ty_afvc_afvu.
TYPES: BEGIN OF ty_afvc_afvv,
projn TYPE afvc-projn,
aufpl TYPE afvv-aufpl,
aplzl TYPE afvv-aplzl,
ieavd TYPE afvv-ieavd,
END OF ty_afvc_afvv.
TYPES: BEGIN OF ty_region,
werks TYPE yca_werks_distr-werks,
abtei TYPE yca_werks_distr-abtei,
END OF ty_region.
*" End of changes Defect#2351
***********************************************************************
* I N T E R N A L T A B L E S D E C L A R A T I O N
***********************************************************************
DATA: gi_jcds TYPE STANDARD TABLE OF ty_jcds.
DATA: gw_jcds TYPE ty_jcds.
DATA: gi_vmpa TYPE STANDARD TABLE OF ty_vmpa.
DATA: gw_vmpa TYPE ty_vmpa.
DATA: gi_vmpa_c TYPE STANDARD TABLE OF ty_vmpa.
DATA: gw_vmpa_c TYPE ty_vmpa.
DATA: gi_prps TYPE STANDARD TABLE OF ty_prps.
DATA: gw_prps TYPE ty_prps.
DATA: gi_vbup TYPE STANDARD TABLE OF ty_vbup.
DATA: gw_vbup TYPE ty_vbup.
DATA: gi_vbap TYPE STANDARD TABLE OF ty_vbap.
DATA: gw_vbap TYPE ty_vbap.
DATA: gi_vbfark TYPE STANDARD TABLE OF ty_vbfark.
DATA: gw_vbfark TYPE ty_vbfark.
DATA: gi_vbrk TYPE STANDARD TABLE OF ty_vbrk.
DATA: gw_vbrk TYPE ty_vbrk.
DATA: gi_username TYPE STANDARD TABLE OF ty_username.
DATA: gw_username TYPE ty_username.
DATA: gi_final TYPE STANDARD TABLE OF ty_final.
DATA: gw_final TYPE ty_final.
DATA: gi_final_temp TYPE STANDARD TABLE OF ty_final.
DATA: gw_final_temp TYPE ty_final.
DATA: gi_history TYPE STANDARD TABLE OF ty_history.
DATA: gw_history TYPE ty_history.
DATA: gi_remarks TYPE TABLE OF ty_remarks,
gw_remarks TYPE ty_remarks.
*" Start of changes Defect#2351
DATA: gi_afvc_afvu TYPE STANDARD TABLE OF ty_afvc_afvu,
gw_afvc_afvu TYPE ty_afvc_afvu,
gi_afvc_afvv TYPE STANDARD TABLE OF ty_afvc_afvv,
gw_afvc_afvv TYPE ty_afvc_afvv,
gi_region TYPE STANDARD TABLE OF ty_region,
gw_region TYPE ty_region.
*" End of changes Defect#2351
***********************************************************************
* data declaration for job settings
***********************************************************************
DATA: gv_jobcount TYPE tbtcjob-jobcount.
DATA: gv_jobname TYPE tbtcjob-jobname.
DATA: gv_job_was_released TYPE btch0000-char1.
***********************************************************************
* V A R I A B L E S F O R S E L E C T - O P T I O N S
***********************************************************************
DATA: lv_udate TYPE jcds-udate.
DATA: lv_mailid TYPE ad_smtpadr.
***********************************************************************
* S E L E C T I O N S C R E E N
***********************************************************************
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS: s_udate FOR lv_udate.
SELECT-OPTIONS: s_mailid FOR lv_mailid NO INTERVALS.
SELECTION-SCREEN END OF BLOCK b1.
***********************************************************************
* A T S E L E C T I O N S C R E E N
***********************************************************************
AT SELECTION-SCREEN ON s_mailid.
IF s_mailid-low IS INITIAL.
MESSAGE e001(00) WITH text-m08.
LEAVE LIST-PROCESSING.
ENDIF.
***********************************************************************
* S T A R T O F S E L E C T I O N
***********************************************************************
START-OF-SELECTION.
PERFORM f_select_wbs.
PERFORM f_data_mine.
PERFORM f_create_statistics .
PERFORM f_create_fieldcat.
PERFORM f_create_events.
PERFORM f_write_report.
IF sy-batch = 'X'.
PERFORM f_send_mail.
ENDIF.
END-OF-SELECTION.
************************************************************************
************************************************************************
** Form.............: f_select_wbs.
** Description......: this subroutine dynamically displays the
**..................: selection screen according to the radio button
************************************************************************
************************************************************************
FORM f_select_wbs.
*** select the object number from jcds table which is not having status 'INST'.
SELECT objnr
FROM jcds
INTO TABLE gi_jcds
WHERE objnr LIKE gc_objnr AND
stat = gc_stat AND
inact = ' ' AND
udate IN s_udate.
IF gi_jcds IS NOT INITIAL.
*** select wbs from the PRPS table
SELECT pspnr objnr post1
FROM prps
INTO TABLE gi_prps
FOR ALL ENTRIES IN gi_jcds
WHERE objnr = gi_jcds-objnr.
IF gi_prps IS NOT INITIAL.
*** select sale order and items from vmpa
*** select sale orders and items from vbup having billing status
*** Not yet processed(A) or Partially processed(B)
SELECT a~ps_psp_pnr a~vbeln a~posnr p~fksaa
FROM vmpa AS a INNER JOIN vbup AS p ON
a~vbeln = p~vbeln AND
a~posnr = p~posnr
INTO TABLE gi_vmpa
FOR ALL ENTRIES IN gi_prps
WHERE a~ps_psp_pnr = gi_prps-pspnr AND
fksaa IN ('A', 'B').
IF gi_vmpa IS NOT INITIAL.
SORT gi_vmpa BY vbeln posnr.
SELECT a~ps_psp_pnr a~vbeln a~posnr p~fksaa
FROM vmpa AS a INNER JOIN vbup AS p ON
a~vbeln = p~vbeln AND
a~posnr = p~posnr
INTO TABLE gi_vmpa_c
FOR ALL ENTRIES IN gi_prps
WHERE a~ps_psp_pnr = gi_prps-pspnr AND
fksaa IN ('C').
IF gi_vmpa_c IS NOT INITIAL.
SORT gi_vmpa_c BY vbeln ps_psp_pnr.
ENDIF.
*" Start of changes Defect#2351 DS6K903071
SELECT p~projn
q~aufpl
q~aplzl
FROM afvc AS p INNER JOIN afvu AS q ON
p~aufpl = q~aufpl AND
p~aplzl = q~aplzl
INTO TABLE gi_afvc_afvu
FOR ALL ENTRIES IN gi_vmpa
WHERE p~projn = gi_vmpa-ps_psp_pnr AND
q~usr10 = 'X'.
IF gi_afvc_afvu IS NOT INITIAL.
SELECT a~projn
b~aufpl
b~aplzl
b~ieavd
FROM afvc AS a INNER JOIN afvv AS b ON
a~aufpl = b~aufpl AND
a~aplzl = b~aplzl
INTO TABLE gi_afvc_afvv
FOR ALL ENTRIES IN gi_afvc_afvu
WHERE a~projn = gi_afvc_afvu-projn AND
a~aufpl = gi_afvc_afvu-aufpl AND
a~aplzl = gi_afvc_afvu-aplzl.
IF NOT gi_afvc_afvv IS INITIAL.
DELETE gi_afvc_afvv WHERE ieavd IS INITIAL.
SORT gi_afvc_afvv BY projn ieavd DESCENDING.
ENDIF.
ENDIF.
*" End of changes Defect#2351
SELECT vbeln posnr netwr
werks " Added for Defect#2351 DS6K903071
FROM vbap
INTO TABLE gi_vbap
FOR ALL ENTRIES IN gi_vmpa
WHERE vbeln = gi_vmpa-vbeln AND
posnr = gi_vmpa-posnr AND
netwr GT '0'.
IF gi_vbap IS NOT INITIAL.
SORT gi_vbap BY vbeln posnr.
*" Start of changes Defect#2351 DS6K903071
*" To get the region
SELECT werks
abtei
FROM yca_werks_distr
INTO TABLE gi_region
FOR ALL ENTRIES IN gi_vbap
WHERE werks = gi_vbap-werks.
SORT gi_region BY werks.
*" End of changes Defect#2351 DS6K903071
SELECT a~vbelv a~posnv a~vbeln a~posnn k~fksto
FROM vbfa AS a INNER JOIN vbrk AS k ON
a~vbeln = k~vbeln
INTO TABLE gi_vbfark
FOR ALL ENTRIES IN gi_vbap
WHERE a~vbelv = gi_vbap-vbeln AND
a~posnv = gi_vbap-posnr AND
a~vbtyp_n = gc_vbtyp_m AND
k~fksto = 'X'.
IF sy-subrc = 0.
SORT gi_vbfark BY vbelv posnv.
SELECT vbeln ernam erdat sfakn zzjobid
FROM vbrk
INTO TABLE gi_vbrk
FOR ALL ENTRIES IN gi_vbfark
WHERE sfakn = gi_vbfark-vbeln.
IF gi_vbrk IS NOT INITIAL.
SORT gi_vbrk BY sfakn.
SELECT bname name_textc
FROM user_addr
INTO TABLE gi_username
FOR ALL ENTRIES IN gi_vbrk
WHERE bname = gi_vbrk-ernam.
IF gi_username IS NOT INITIAL.
SORT gi_username BY bname.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
MESSAGE s001(00) WITH text-cm1.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. "f_select_wbs
************************************************************************
************************************************************************
** Form.............: f_data_mine
** Description......: this subroutine create
**..................:
************************************************************************
************************************************************************
FORM f_data_mine.
CLEAR: gi_final, gw_final.
LOOP AT gi_vmpa INTO gw_vmpa.
CLEAR: gw_final.
gw_final-vbeln = gw_vmpa-vbeln.
gw_final-posnr = gw_vmpa-posnr.
gw_final-ps_psp_pnr = gw_vmpa-ps_psp_pnr.
READ TABLE gi_vmpa_c INTO gw_vmpa_c WITH KEY vbeln = gw_vmpa-vbeln
ps_psp_pnr = gw_vmpa-ps_psp_pnr
BINARY SEARCH.
IF sy-subrc = 0.
gw_final-fksaa = 'B'.
gw_final-statv = text-st2.
ELSE.
gw_final-fksaa = 'A'.
gw_final-statv = text-st1.
ENDIF.
CLEAR: gw_prps.
READ TABLE gi_prps INTO gw_prps WITH KEY pspnr = gw_vmpa-ps_psp_pnr.
IF sy-subrc = 0.
gw_final-post1 = gw_prps-post1.
ENDIF.
CLEAR: gw_vbap.
READ TABLE gi_vbap INTO gw_vbap WITH KEY vbeln = gw_vmpa-vbeln
posnr = gw_vmpa-posnr
BINARY SEARCH.
IF sy-subrc = 0.
gw_final-netwr = gw_vbap-netwr.
gw_final-werks = gw_vbap-werks. "Added by Defect#2351 DS6K90307
ENDIF.
*" Start of changes Defect#2351
READ TABLE gi_region INTO gw_region WITH KEY werks = gw_vbap-werks.
IF sy-subrc = 0.
gw_final-abtei = gw_region-abtei.
ENDIF.
CLEAR gw_afvc_afvv.
READ TABLE gi_afvc_afvv INTO gw_afvc_afvv WITH KEY projn = gw_vmpa-ps_psp_pnr.
IF sy-subrc = 0 AND gw_afvc_afvv-ieavd IS NOT INITIAL.
gw_final-conf_date = gw_afvc_afvv-ieavd. "Added by Defect#2351 DS6K903071
ENDIF.
*" End of changes Defect#2351
CLEAR: gw_vbfark.
READ TABLE gi_vbfark INTO gw_vbfark WITH KEY vbelv = gw_vmpa-vbeln
posnv = gw_vmpa-posnr
BINARY SEARCH.
IF sy-subrc = 0.
CLEAR: gw_vbrk.
READ TABLE gi_vbrk INTO gw_vbrk WITH KEY sfakn = gw_vbfark-vbeln
BINARY SEARCH.
IF sy-subrc = 0.
gw_final-canc_flg = 'X'.
ENDIF.
ENDIF.
APPEND gw_final TO gi_final.
ENDLOOP.
*** delete the items which has Zero netvalue
DELETE gi_final WHERE netwr LE gc_netwr.
************************************************************************
*** start of code for the history of the billing doc
************************************************************************
LOOP AT gi_vbfark INTO gw_vbfark.
CLEAR: gw_vbrk, gw_history.
READ TABLE gi_vbrk INTO gw_vbrk WITH KEY sfakn = gw_vbfark-vbeln
BINARY SEARCH.
IF sy-subrc = 0.
gw_history-vbelv = gw_vbfark-vbelv.
gw_history-posnv = gw_vbfark-posnv.
gw_history-vbeln = gw_vbfark-vbeln.
gw_history-posnr = gw_vbfark-posnr.
gw_history-fksto = gw_vbfark-fksto.
gw_history-canc_doc = gw_vbrk-vbeln.
gw_history-ernam = gw_vbrk-ernam.
gw_history-erdat = gw_vbrk-erdat.
gw_history-zzjobid = gw_vbrk-zzjobid.
CLEAR: gw_username.
READ TABLE gi_username INTO gw_username WITH KEY bname = gw_vbrk-ernam
BINARY SEARCH.
IF sy-subrc = 0.
gw_history-name_textc = gw_username-name_textc.
ENDIF.
ENDIF.
APPEND gw_history TO gi_history.
ENDLOOP.
ENDFORM. "f_data_mine
************************************************************************
************************************************************************
** Form.............: f_create_statistics
** Description......: this subroutine create
**..................:
************************************************************************
************************************************************************
FORM f_create_statistics.
CLEAR:gv_no_wbs_processed, gv_no_wbs_not_yet_processed,
gv_no_wbs_partially_processed, gv_no_wbs_cancel.
***total no of WBS processed.
DESCRIBE TABLE gi_final LINES gv_no_wbs_processed.
***Number of SO having not yet processed
gi_final_temp[] = gi_final[].
DELETE gi_final_temp WHERE fksaa NE 'A'.
DESCRIBE TABLE gi_final_temp LINES gv_no_wbs_not_yet_processed.
CLEAR: gi_final_temp, gi_final_temp[].
*** Number of SO Partially processed
gi_final_temp[] = gi_final[].
DELETE gi_final_temp WHERE fksaa NE 'B'.
DESCRIBE TABLE gi_final_temp LINES gv_no_wbs_partially_processed.
CLEAR: gi_final_temp, gi_final_temp[].
gi_final_temp[] = gi_final[].
DELETE gi_final_temp WHERE canc_flg EQ ' '.
DESCRIBE TABLE gi_final_temp LINES gv_no_wbs_cancel.
CLEAR: gi_final_temp, gi_final_temp[].
ENDFORM. " f_create_Statistics
************************************************************************
************************************************************************
** Form.............: f_create_fieldcat
** Description......: this subroutine create
**..................:
************************************************************************
************************************************************************
FORM f_create_fieldcat .
DATA: gv_colpos TYPE i VALUE 1.
DATA: gv_colpos_j TYPE i VALUE 1.
gw_fieldcat-fieldname = 'VBELN'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 12.
gw_fieldcat-seltext_m = 'SO#'.
gw_fieldcat-seltext_l = 'Sales Order'.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
gw_fieldcat-fieldname = 'POSNR'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 8.
gw_fieldcat-seltext_l = 'Item'.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
gw_fieldcat-fieldname = 'PS_PSP_PNR'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 24.
gw_fieldcat-seltext_m = 'Trades'.
gw_fieldcat-seltext_l = 'Trades (WBS)'.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
gw_fieldcat-fieldname = 'POST1'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 30.
gw_fieldcat-fix_column = 'X'.
gw_fieldcat-seltext_m = 'Trade Desc.'.
gw_fieldcat-seltext_l = 'Trade(WBS) Description '.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
* Start of change Defect#2351 sj010474 DS6K903071
gw_fieldcat-fieldname = 'WERKS'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 6.
gw_fieldcat-fix_column = 'X'.
gw_fieldcat-seltext_m = 'Plant'.
gw_fieldcat-seltext_l = 'Plant'.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
gw_fieldcat-fieldname = 'ABTEI'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 6.
gw_fieldcat-fix_column = 'X'.
gw_fieldcat-seltext_m = 'Regn.'.
gw_fieldcat-seltext_l = 'Region'.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
gw_fieldcat-fieldname = 'CONF_DATE'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 10.
gw_fieldcat-fix_column = 'X'.
gw_fieldcat-no_zero = 'X'.
gw_fieldcat-seltext_m = 'Conf.Date'.
gw_fieldcat-seltext_l = 'Confirmation Date'.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
* End of change Defect#2351 sj010474 DS6K903071
gw_fieldcat-fieldname = 'FKSAA'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 2.
gw_fieldcat-no_out = 'X'.
gw_fieldcat-fix_column = 'X'.
gw_fieldcat-seltext_m = ' '.
gw_fieldcat-seltext_l = ' '.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
gw_fieldcat-fieldname = 'STATV'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 20.
gw_fieldcat-fix_column = 'X'.
gw_fieldcat-seltext_m = 'Bill.Status'.
gw_fieldcat-seltext_l = 'Billing status '.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
gw_fieldcat-fieldname = 'NETWR'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 16.
gw_fieldcat-seltext_m = 'Net value'.
gw_fieldcat-seltext_l = 'Net value of the order item'.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
gw_fieldcat-fieldname = 'CANC_FLG'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 4.
gw_fieldcat-seltext_m = 'Canc.'.
gw_fieldcat-seltext_l = 'Cancelled'.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
*** for second alv
gw_fieldcat_j-fieldname = 'VBELV'.
gw_fieldcat_j-col_pos = gv_colpos_j.
gw_fieldcat_j-outputlen = 12.
gw_fieldcat_j-seltext_m = 'Sales Order'.
gw_fieldcat_j-seltext_l = text-t07.
APPEND gw_fieldcat_j TO gi_fieldcat_j.
CLEAR gw_fieldcat_j.
ADD 1 TO gv_colpos_j.
gw_fieldcat_j-fieldname = 'POSNV'.
gw_fieldcat_j-col_pos = gv_colpos_j.
* gw_fieldcat_j-outputlen = 7. " Commented by Defect#2351 DS6K903071
gw_fieldcat_j-outputlen = 10. " Added by Defect#2351 DS6K903071
gw_fieldcat_j-seltext_m = 'SO.Item'.
gw_fieldcat_j-seltext_l = text-t08.
APPEND gw_fieldcat_j TO gi_fieldcat_j.
CLEAR gw_fieldcat_j.
ADD 1 TO gv_colpos_j.
gw_fieldcat_j-fieldname = 'ZZJOBID'.
gw_fieldcat_j-col_pos = gv_colpos_j.
* gw_fieldcat_j-outputlen = 21. " Commented by Defect#2351 DS6K903071
gw_fieldcat_j-outputlen = 29. " Added by Defect#2351 DS6K903071
gw_fieldcat_j-seltext_m = 'Job.ID'.
gw_fieldcat_j-seltext_l = text-t10.
APPEND gw_fieldcat_j TO gi_fieldcat_j.
CLEAR gw_fieldcat_j.
ADD 1 TO gv_colpos_j.
gw_fieldcat_j-fieldname = 'VBELN'.
gw_fieldcat_j-col_pos = gv_colpos_j.
* gw_fieldcat_j-outputlen = 12. " Commented by Defect#2351 DS6K903071
gw_fieldcat_j-outputlen = 16. " Added by Defect#2351 DS6K903071
gw_fieldcat_j-seltext_m = 'Bill.Doc'.
gw_fieldcat_j-seltext_l = text-t06.
APPEND gw_fieldcat_j TO gi_fieldcat_j.
CLEAR gw_fieldcat_j.
ADD 1 TO gv_colpos_j.
gw_fieldcat_j-fieldname = 'POSNR'.
gw_fieldcat_j-col_pos = gv_colpos_j.
* gw_fieldcat_j-outputlen = 7. " Commented by Defect#2351 DS6K903071
gw_fieldcat_j-outputlen = 11. " Added by Defect#2351 DS6K903071
gw_fieldcat_j-seltext_m = 'Bill.Item'.
gw_fieldcat_j-seltext_l = text-t12.
APPEND gw_fieldcat_j TO gi_fieldcat_j.
CLEAR gw_fieldcat_j.
ADD 1 TO gv_colpos_j.
gw_fieldcat_j-fieldname = 'CANC_DOC'.
gw_fieldcat_j-col_pos = gv_colpos_j.
gw_fieldcat_j-outputlen = 12.
gw_fieldcat_j-seltext_m = 'Canc.Doc'.
APPEND gw_fieldcat_j TO gi_fieldcat_j.
CLEAR gw_fieldcat_j.
ADD 1 TO gv_colpos_j.
gw_fieldcat_j-fieldname = 'NAME_TEXTC'.
gw_fieldcat_j-col_pos = gv_colpos_j.
* gw_fieldcat_j-outputlen = 32. " Commented by Defect#2351 DS6K903071
gw_fieldcat_j-outputlen = 38. " Added by Defect#2351 DS6K903071
gw_fieldcat_j-seltext_m = 'Cancelled By'.
APPEND gw_fieldcat_j TO gi_fieldcat_j.
CLEAR gw_fieldcat_j.
ADD 1 TO gv_colpos_j.
gw_fieldcat_j-fieldname = 'ERDAT'.
gw_fieldcat_j-col_pos = gv_colpos_j.
gw_fieldcat_j-outputlen = 10.
gw_fieldcat_j-seltext_m = 'Canc.Date'.
APPEND gw_fieldcat_j TO gi_fieldcat_j.
CLEAR gw_fieldcat_j.
ADD 1 TO gv_colpos_j.
ENDFORM. "f_create_fieldcat
************************************************************************
************************************************************************
** Form.............: f_create_events
** Description......: this subroutine create
**..................:
************************************************************************
************************************************************************
FORM f_create_events.
DATA: l_i_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = gi_events[].
*----- Pass top-of-page
READ TABLE gi_events WITH KEY name = slis_ev_top_of_page
INTO l_i_event.
IF sy-subrc = 0.
MOVE formname_top_of_page TO l_i_event-form.
APPEND l_i_event TO gi_events.
ENDIF.
CLEAR l_i_event.
IF gi_history IS INITIAL.
READ TABLE gi_events WITH KEY name = slis_ev_end_of_list
INTO l_i_event.
IF sy-subrc = 0.
MOVE formname_end_of_list TO l_i_event-form.
APPEND l_i_event TO gi_events.
ENDIF.
CLEAR l_i_event.
ENDIF.
*** for second alv
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = gi_events_j[].
*----- Pass top-of-page
READ TABLE gi_events_j WITH KEY name = slis_ev_top_of_page
INTO l_i_event.
IF sy-subrc = 0.
MOVE formname_top_of_page_j TO l_i_event-form.
APPEND l_i_event TO gi_events_j.
ENDIF.
CLEAR l_i_event.
*----- Pass top-of-page
READ TABLE gi_events_j WITH KEY name = slis_ev_end_of_list
INTO l_i_event.
IF sy-subrc = 0.
MOVE formname_end_of_list_j TO l_i_event-form.
APPEND l_i_event TO gi_events_j.
ENDIF.
CLEAR l_i_event.
ENDFORM. "f_create_events
************************************************************************
************************************************************************
** Form.............: generate_top_of_page
** Description......: this subroutine create
**..................:
************************************************************************
************************************************************************
FORM generate_top_of_page.
*" Start of change Defect#2351 sj010474 DS6K903071
* WRITE : /1(122) sy-uline.
* WRITE : /1 sy-vline, 45 text-t14,
* 122 sy-vline.
* WRITE : /1 sy-vline, 122 sy-vline.
* WRITE : /1 sy-vline, 8 text-t15,
* 122 sy-vline.
* WRITE : /1(122) sy-uline.
*
****total no of WBS processed.
* .
* WRITE : /1 sy-vline, AT 35(54) sy-uline, AT 122 sy-vline.
* WRITE : /1 sy-vline, AT 16 icon_led_green AS ICON,
* AT 20 icon_businav_value_chain AS ICON,
* AT 24 icon_businav_value_chain AS ICON,
* AT 28 icon_businav_value_chain AS ICON,
* AT 35 sy-vline,
* AT 37(30) text-001 COLOR COL_HEADING INTENSIFIED OFF,
* AT 70 sy-vline,
* gv_no_wbs_processed COLOR COL_NEGATIVE INVERSE ON,
* AT 88 sy-vline, AT 122 sy-vline.
* FORMAT INVERSE OFF.
* FORMAT COLOR OFF.
* WRITE : /1 sy-vline, AT 35(54) sy-uline, AT 122 sy-vline.
*
**** total no of SO Not yet processed
* WRITE : /1 sy-vline, AT 35(54) sy-uline, AT 122 sy-vline.
* WRITE : /1 sy-vline, AT 16 icon_led_green AS ICON,
* AT 20 icon_businav_value_chain AS ICON,
* AT 24 icon_businav_value_chain AS ICON,
* AT 28 icon_businav_value_chain AS ICON,
* AT 35 sy-vline,
* AT 37(30) text-002 COLOR COL_TOTAL INTENSIFIED ON,
* AT 70 sy-vline,
* gv_no_wbs_not_yet_processed COLOR COL_NEGATIVE INVERSE ON,
* AT 88 sy-vline, AT 122 sy-vline.
* FORMAT INVERSE OFF.
* FORMAT COLOR OFF.
* WRITE : /1 sy-vline, AT 35(54) sy-uline, AT 122 sy-vline.
*
**** total no Partially processed.
* WRITE : /1 sy-vline, AT 35(54) sy-uline, AT 122 sy-vline.
* WRITE : /1 sy-vline, AT 16 icon_led_green AS ICON,
* AT 20 icon_businav_value_chain AS ICON,
* AT 24 icon_businav_value_chain AS ICON,
* AT 28 icon_businav_value_chain AS ICON,
* AT 35 sy-vline,
* AT 37(30) text-003 COLOR COL_NEGATIVE INTENSIFIED OFF,
* AT 70 sy-vline,
* gv_no_wbs_partially_processed COLOR COL_NEGATIVE INVERSE ON,
* AT 88 sy-vline, AT 122 sy-vline.
* FORMAT INVERSE OFF.
* FORMAT COLOR OFF.
* WRITE : /1 sy-vline, AT 35(54) sy-uline, AT 122 sy-vline.
*
**** total no of WBS Rejected for FNBL.
* WRITE : /1 sy-vline, AT 35(54) sy-uline, AT 122 sy-vline.
* WRITE : /1 sy-vline, AT 16 icon_led_green AS ICON,
* AT 20 icon_businav_value_chain AS ICON,
* AT 24 icon_businav_value_chain AS ICON,
* AT 28 icon_businav_value_chain AS ICON,
* AT 35 sy-vline,
* AT 37(32) text-005 COLOR COL_POSITIVE INTENSIFIED OFF,
* AT 70 sy-vline,
* gv_no_wbs_cancel COLOR COL_NEGATIVE INVERSE ON,
* AT 88 sy-vline, AT 122 sy-vline.
* FORMAT INVERSE OFF.
* FORMAT COLOR OFF.
* WRITE : /1 sy-vline, AT 35(54) sy-uline, AT 122 sy-vline.
*
*
* WRITE : /1(122) sy-uline.
**** top of the page for the next alv.
*
* WRITE : /1(122) sy-uline.
* WRITE : /1 sy-vline, 32 text-h01,
* 122 sy-vline.
* WRITE : /1(122) sy-uline.
WRITE : /1(147) sy-uline.
WRITE : /1 sy-vline, 56 text-t14,
147 sy-vline.
WRITE : /1 sy-vline, 147 sy-vline.
WRITE : /1 sy-vline, 20 text-t15,
147 sy-vline.
WRITE : /1(147) sy-uline.
***total no of WBS processed.
.
WRITE : /1 sy-vline, AT 45(54) sy-uline, AT 147 sy-vline.
WRITE : /1 sy-vline, AT 26 icon_led_green AS ICON,
AT 30 icon_businav_value_chain AS ICON,
AT 34 icon_businav_value_chain AS ICON,
AT 38 icon_businav_value_chain AS ICON,
AT 45 sy-vline,
AT 47(30) text-001 COLOR COL_HEADING INTENSIFIED OFF,
AT 80 sy-vline,
gv_no_wbs_processed COLOR COL_NEGATIVE INVERSE ON,
AT 98 sy-vline, AT 147 sy-vline.
FORMAT INVERSE OFF.
FORMAT COLOR OFF.
WRITE : /1 sy-vline, AT 45(54) sy-uline, AT 147 sy-vline.
*** total no of SO Not yet processed
WRITE : /1 sy-vline, AT 45(54) sy-uline, AT 147 sy-vline.
WRITE : /1 sy-vline, AT 26 icon_led_green AS ICON,
AT 30 icon_businav_value_chain AS ICON,
AT 34 icon_businav_value_chain AS ICON,
AT 38 icon_businav_value_chain AS ICON,
AT 45 sy-vline,
AT 47(30) text-002 COLOR COL_TOTAL INTENSIFIED ON,
AT 80 sy-vline,
gv_no_wbs_not_yet_processed COLOR COL_NEGATIVE INVERSE ON,
AT 98 sy-vline, AT 147 sy-vline.
FORMAT INVERSE OFF.
FORMAT COLOR OFF.
WRITE : /1 sy-vline, AT 45(54) sy-uline, AT 147 sy-vline.
*** total no Partially processed.
WRITE : /1 sy-vline, AT 45(54) sy-uline, AT 147 sy-vline.
WRITE : /1 sy-vline, AT 26 icon_led_green AS ICON,
AT 30 icon_businav_value_chain AS ICON,
AT 34 icon_businav_value_chain AS ICON,
AT 38 icon_businav_value_chain AS ICON,
AT 45 sy-vline,
AT 47(30) text-003 COLOR COL_NEGATIVE INTENSIFIED OFF,
AT 80 sy-vline,
gv_no_wbs_partially_processed COLOR COL_NEGATIVE INVERSE ON,
AT 98 sy-vline, AT 147 sy-vline.
FORMAT INVERSE OFF.
FORMAT COLOR OFF.
WRITE : /1 sy-vline, AT 45(54) sy-uline, AT 147 sy-vline.
*** total no of WBS Rejected for FNBL.
WRITE : /1 sy-vline, AT 45(54) sy-uline, AT 147 sy-vline.
WRITE : /1 sy-vline, AT 26 icon_led_green AS ICON,
AT 30 icon_businav_value_chain AS ICON,
AT 34 icon_businav_value_chain AS ICON,
AT 38 icon_businav_value_chain AS ICON,
AT 45 sy-vline,
AT 47(32) text-005 COLOR COL_POSITIVE INTENSIFIED OFF,
AT 80 sy-vline,
gv_no_wbs_cancel COLOR COL_NEGATIVE INVERSE ON,
AT 98 sy-vline, AT 147 sy-vline.
FORMAT INVERSE OFF.
FORMAT COLOR OFF.
WRITE : /1 sy-vline, AT 45(54) sy-uline, AT 147 sy-vline.
WRITE : /1(147) sy-uline.
*** top of the page for the next alv.
WRITE : /1(147) sy-uline.
WRITE : /1 sy-vline, 43 text-h01,
147 sy-vline.
WRITE : /1(147) sy-uline.
*" End of change Defect#2351 sj010474 DS6K903071
ENDFORM. "GENERATE_TOP_OF_PAGE
************************************************************************
************************************************************************
** Form.............: generate_top_of_page_j
** Description......: this subroutine create
**..................:
************************************************************************
************************************************************************
FORM generate_top_of_page_j.
*" Start of change Defect#2351 sj010474 DS6K903071
* WRITE : /1(122) sy-uline.
* WRITE : /1 sy-vline, 32 text-h02,
* 122 sy-vline.
* WRITE : /1(122) sy-uline.
WRITE : /1(147) sy-uline.
WRITE : /1 sy-vline, 43 text-h02,
147 sy-vline.
WRITE : /1(147) sy-uline.
*" End of change Defect#2351 sj010474 DS6K903071
ENDFORM. "generate_top_of_page_j
************************************************************************
************************************************************************
** Form.............: f_write_report
** Description......: this subroutine create
**..................:
************************************************************************
************************************************************************
FORM f_write_report.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = 'YPS_SD_SYSTEM_HEALTH_CHECK_2'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = gi_layout
it_fieldcat = gi_fieldcat
i_tabname = ' '
it_events = gi_events
* IT_SORT =
* I_TEXT = ' '
TABLES
t_outtab = gi_final
* EXCEPTIONS
* PROGRAM_ERROR = 1
* MAXIMUM_OF_APPENDS_REACHED = 2
* OTHERS = 3
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF gi_history IS NOT INITIAL.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = gi_layout_j
it_fieldcat = gi_fieldcat_j
i_tabname = ' '
it_events = gi_events_j
* IT_SORT =
* I_TEXT = ' '
TABLES
t_outtab = gi_history
* EXCEPTIONS
* PROGRAM_ERROR = 1
* MAXIMUM_OF_APPENDS_REACHED = 2
* OTHERS = 3
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
ENDFORM. " f_write_report
*&---------------------------------------------------------------------*
*& Form f_send_mail
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_send_mail .
DATA: p_user TYPE sy-uname.
DATA: lv_repid TYPE sy-repid.
CLEAR: gv_jobname, gv_jobcount, gv_job_was_released,
lv_repid.
DATA: lv_uzeit TYPE sy-uzeit.
lv_uzeit = 30 + sy-uzeit.
*** assign the user name to the background job.
p_user = sy-uname.
*** assign the program name to the jobname.
lv_repid = gc_bg_repid.
CONCATENATE lv_repid sy-uzeit INTO gv_jobname SEPARATED BY '_'.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
* DELANFREP = ' '
jobgroup = 'YPS_SD_SHC_2'
jobname = gv_jobname
sdlstrtdt = sy-datum
sdlstrttm = sy-uzeit
jobclass = 'C'
IMPORTING
jobcount = gv_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
***--- Submiting the program with the job
SUBMIT yps_shc_send_mail_2
WITH s_mailid IN s_mailid
WITH p_user = p_user
USER lc_bcbatch
VIA JOB gv_jobname
NUMBER gv_jobcount
AND RETURN.
IF sy-subrc = 0.
***--- job close.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
at_opmode_periodic = 'X'
event_periodic = 'X'
jobcount = gv_jobcount
jobname = gv_jobname
sdlstrtdt = sy-datum
sdlstrttm = lv_uzeit
* strtimmed = 'X'
IMPORTING
job_was_released = gv_job_was_released
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
invalid_target = 8
OTHERS = 9.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF. "job_submit.
ENDIF. "job_open.
ENDFORM. " f_send_mail
************************************************************************
************************************************************************
** Form.............: generate_end_of_page
** Description......: this subroutine create
**..................:
************************************************************************
************************************************************************
FORM generate_end_of_page.
*** user instruction section
SELECT remarks
FROM ysd_parameter
INTO TABLE gi_remarks
WHERE indicator1 = gc_indicator AND
param1 = gc_param1.
IF gi_remarks IS NOT INITIAL.
SKIP 1.
*anges by Defect#2351 SJ010474 DS6K903071
*** write the heading.
* WRITE : /1(122) sy-uline.
* WRITE : /1 sy-vline, 50 text-t13,
* 122 sy-vline.
* WRITE : /1(122) sy-uline.
*
* LOOP AT gi_remarks INTO gw_remarks.
* WRITE : /1(122) sy-uline.
* WRITE : /1 sy-vline, AT 3 icon_checked AS ICON,
* 7(100) gw_remarks-remarks, AT 122 sy-vline.
* WRITE : /1(122) sy-uline.
WRITE : /1(147) sy-uline.
WRITE : /1 sy-vline, 60 text-t13,
147 sy-vline.
WRITE : /1(147) sy-uline.
LOOP AT gi_remarks INTO gw_remarks.
WRITE : /1(147) sy-uline.
WRITE : /1 sy-vline, AT 6 icon_checked AS ICON,
11(100) gw_remarks-remarks, AT 147 sy-vline.
WRITE : /1(147) sy-uline.
*"End of changes by Defect#2351 SJ010474 DS6K903071
ENDLOOP.
ENDIF.
ENDFORM. "GENERATE_END_OF_PAGE
*& Report YPS_SD_SYSTEM_HEALTH_CHECK_2
*&
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& CTI Confidential *
*&---------------------------------------------------------------------*
*& History and Purpose behind the development : - *
*& This report is used to send a list of Trades/WBS WBS that *
*& are INST (confirmed) status and are not billed/cancelled *
*& or the line only partially billed. The report output is *
*& needed to be send as mail to the HDS Outlook Inbox. *
*& This report comes under system health check 2 *
*& *
*&---------------------------------------------------------------------*
REPORT yps_sd_system_health_check_2 NO STANDARD PAGE HEADING
LINE-SIZE 120.
.
TYPE-POOLS: slis.
INCLUDE <list>.
TABLES: vmpa, prps.
***********************************************************************
* G L O B A L V A R I A B L E S
***********************************************************************
CONSTANTS: gc_objnr TYPE jcds-objnr VALUE 'PR%',
gc_stat TYPE jcds-stat VALUE 'E0002',
gc_vbtyp_m TYPE vbfa-vbtyp_n VALUE 'M',
gc_indicator TYPE ysd_parameter-indicator1
VALUE 'YPS_SD_SYSTEM_HEALTH_CHECK_2',
gc_param1 TYPE ysd_parameter-param1 VALUE 'WBS_INST',
gc_netwr TYPE vbap-netwr VALUE 0.
DATA: gv_to_date TYPE sy-datum.
DATA: gv_from_date TYPE sy-datum.
DATA: gv_no_wbs_processed TYPE p,
gv_no_wbs_cancel TYPE p,
gv_no_wbs_not_yet_processed TYPE p,
gv_no_wbs_partially_processed TYPE p.
DATA : gi_fieldcat TYPE slis_t_fieldcat_alv,
gw_fieldcat TYPE slis_fieldcat_alv,
gi_layout TYPE slis_layout_alv,
gi_events TYPE slis_t_event,
gw_events TYPE slis_alv_event.
DATA : gi_fieldcat_j TYPE slis_t_fieldcat_alv,
gw_fieldcat_j TYPE slis_fieldcat_alv,
gi_layout_j TYPE slis_layout_alv,
gi_events_j TYPE slis_t_event,
gw_events_j TYPE slis_alv_event.
DATA : formname_top_of_page TYPE slis_formname VALUE
'GENERATE_TOP_OF_PAGE',
formname_end_of_list TYPE slis_formname VALUE
'GENERATE_END_OF_PAGE',
formname_top_of_page_j TYPE slis_formname VALUE
'GENERATE_TOP_OF_PAGE_J',
formname_end_of_list_j TYPE slis_formname VALUE
'GENERATE_END_OF_PAGE',
formname_user_command TYPE slis_formname VALUE 'USER_COMMAND'.
CONSTANTS: lc_bcbatch TYPE syuname VALUE 'BC-BATCH',
gc_bg_repid TYPE sy-repid VALUE 'yps_shc_send_mail_2'.
***********************************************************************
* T A B L E T Y P E D E C L A R A T I O N
***********************************************************************
TYPES: BEGIN OF ty_jcds,
objnr TYPE jcds-objnr,
END OF ty_jcds.
TYPES: BEGIN OF ty_vmpa,
ps_psp_pnr TYPE vmpa-ps_psp_pnr,
vbeln TYPE vmpa-vbeln,
posnr TYPE vmpa-posnr,
fksaa TYPE vbup-fksaa,
END OF ty_vmpa.
TYPES: BEGIN OF ty_prps,
pspnr TYPE prps-pspnr,
objnr TYPE prps-objnr,
post1 TYPE prps-post1,
END OF ty_prps.
TYPES: BEGIN OF ty_vbup,
vbeln TYPE vbup-vbeln,
posnr TYPE vbup-posnr,
fksaa TYPE vbup-fksaa,
END OF ty_vbup.
TYPES: BEGIN OF ty_vbap,
vbeln TYPE vbap-vbeln,
posnr TYPE vbap-posnr,
netwr TYPE vbap-netwr,
werks TYPE vbap-werks, "Added by Defect#2351 DS6K903071
END OF ty_vbap.
TYPES: BEGIN OF ty_vbfark,
vbelv TYPE vbfa-vbelv,
posnv TYPE vbfa-posnv,
vbeln TYPE vbfa-vbeln,
posnr TYPE vbfa-posnn,
fksto TYPE vbrk-fksto,
END OF ty_vbfark.
TYPES: BEGIN OF ty_vbrk,
vbeln TYPE vbrk-vbeln,
ernam TYPE vbrk-ernam,
erdat TYPE vbrk-erdat,
sfakn TYPE vbrk-sfakn,
zzjobid TYPE vbrk-zzjobid,
END OF ty_vbrk.
TYPES : BEGIN OF ty_username,
bname TYPE user_addr-bname,
name_textc TYPE user_addr-name_textc,
END OF ty_username.
TYPES: BEGIN OF ty_final,
vbeln TYPE vbup-vbeln,
posnr TYPE vbup-posnr,
ps_psp_pnr TYPE vmpa-ps_psp_pnr,
post1 TYPE prps-post1,
werks TYPE vbap-werks, "Added by Defect#2351 DS6K903071
conf_date TYPE vbrk-erdat, "Added by Defect#2351 DS6K903071
abtei TYPE yca_werks_distr-abtei, "Added by Defect#2351 DS6K903071
fksaa TYPE vbup-fksaa,
statv(20),
netwr TYPE vbap-netwr,
canc_flg(1),
END OF ty_final.
TYPES: BEGIN OF ty_history,
vbelv TYPE vbfa-vbelv,
posnv TYPE vbfa-posnv,
vbeln TYPE vbfa-vbeln,
posnr TYPE vbfa-posnn,
fksto TYPE vbrk-fksto,
canc_doc TYPE vbrk-vbeln,
ernam TYPE vbrk-ernam,
erdat TYPE vbrk-erdat,
zzjobid TYPE vbrk-zzjobid,
name_textc TYPE user_addr-name_textc,
END OF ty_history.
TYPES: BEGIN OF ty_remarks,
remarks TYPE ysd_parameter-remarks,
END OF ty_remarks.
*" Start of changes Defect#2351
TYPES: BEGIN OF ty_afvc_afvu,
projn TYPE afvc-projn,
aufpl TYPE afvv-aufpl,
aplzl TYPE afvv-aplzl,
END OF ty_afvc_afvu.
TYPES: BEGIN OF ty_afvc_afvv,
projn TYPE afvc-projn,
aufpl TYPE afvv-aufpl,
aplzl TYPE afvv-aplzl,
ieavd TYPE afvv-ieavd,
END OF ty_afvc_afvv.
TYPES: BEGIN OF ty_region,
werks TYPE yca_werks_distr-werks,
abtei TYPE yca_werks_distr-abtei,
END OF ty_region.
*" End of changes Defect#2351
***********************************************************************
* I N T E R N A L T A B L E S D E C L A R A T I O N
***********************************************************************
DATA: gi_jcds TYPE STANDARD TABLE OF ty_jcds.
DATA: gw_jcds TYPE ty_jcds.
DATA: gi_vmpa TYPE STANDARD TABLE OF ty_vmpa.
DATA: gw_vmpa TYPE ty_vmpa.
DATA: gi_vmpa_c TYPE STANDARD TABLE OF ty_vmpa.
DATA: gw_vmpa_c TYPE ty_vmpa.
DATA: gi_prps TYPE STANDARD TABLE OF ty_prps.
DATA: gw_prps TYPE ty_prps.
DATA: gi_vbup TYPE STANDARD TABLE OF ty_vbup.
DATA: gw_vbup TYPE ty_vbup.
DATA: gi_vbap TYPE STANDARD TABLE OF ty_vbap.
DATA: gw_vbap TYPE ty_vbap.
DATA: gi_vbfark TYPE STANDARD TABLE OF ty_vbfark.
DATA: gw_vbfark TYPE ty_vbfark.
DATA: gi_vbrk TYPE STANDARD TABLE OF ty_vbrk.
DATA: gw_vbrk TYPE ty_vbrk.
DATA: gi_username TYPE STANDARD TABLE OF ty_username.
DATA: gw_username TYPE ty_username.
DATA: gi_final TYPE STANDARD TABLE OF ty_final.
DATA: gw_final TYPE ty_final.
DATA: gi_final_temp TYPE STANDARD TABLE OF ty_final.
DATA: gw_final_temp TYPE ty_final.
DATA: gi_history TYPE STANDARD TABLE OF ty_history.
DATA: gw_history TYPE ty_history.
DATA: gi_remarks TYPE TABLE OF ty_remarks,
gw_remarks TYPE ty_remarks.
*" Start of changes Defect#2351
DATA: gi_afvc_afvu TYPE STANDARD TABLE OF ty_afvc_afvu,
gw_afvc_afvu TYPE ty_afvc_afvu,
gi_afvc_afvv TYPE STANDARD TABLE OF ty_afvc_afvv,
gw_afvc_afvv TYPE ty_afvc_afvv,
gi_region TYPE STANDARD TABLE OF ty_region,
gw_region TYPE ty_region.
*" End of changes Defect#2351
***********************************************************************
* data declaration for job settings
***********************************************************************
DATA: gv_jobcount TYPE tbtcjob-jobcount.
DATA: gv_jobname TYPE tbtcjob-jobname.
DATA: gv_job_was_released TYPE btch0000-char1.
***********************************************************************
* V A R I A B L E S F O R S E L E C T - O P T I O N S
***********************************************************************
DATA: lv_udate TYPE jcds-udate.
DATA: lv_mailid TYPE ad_smtpadr.
***********************************************************************
* S E L E C T I O N S C R E E N
***********************************************************************
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS: s_udate FOR lv_udate.
SELECT-OPTIONS: s_mailid FOR lv_mailid NO INTERVALS.
SELECTION-SCREEN END OF BLOCK b1.
***********************************************************************
* A T S E L E C T I O N S C R E E N
***********************************************************************
AT SELECTION-SCREEN ON s_mailid.
IF s_mailid-low IS INITIAL.
MESSAGE e001(00) WITH text-m08.
LEAVE LIST-PROCESSING.
ENDIF.
***********************************************************************
* S T A R T O F S E L E C T I O N
***********************************************************************
START-OF-SELECTION.
PERFORM f_select_wbs.
PERFORM f_data_mine.
PERFORM f_create_statistics .
PERFORM f_create_fieldcat.
PERFORM f_create_events.
PERFORM f_write_report.
IF sy-batch = 'X'.
PERFORM f_send_mail.
ENDIF.
END-OF-SELECTION.
************************************************************************
************************************************************************
** Form.............: f_select_wbs.
** Description......: this subroutine dynamically displays the
**..................: selection screen according to the radio button
************************************************************************
************************************************************************
FORM f_select_wbs.
*** select the object number from jcds table which is not having status 'INST'.
SELECT objnr
FROM jcds
INTO TABLE gi_jcds
WHERE objnr LIKE gc_objnr AND
stat = gc_stat AND
inact = ' ' AND
udate IN s_udate.
IF gi_jcds IS NOT INITIAL.
*** select wbs from the PRPS table
SELECT pspnr objnr post1
FROM prps
INTO TABLE gi_prps
FOR ALL ENTRIES IN gi_jcds
WHERE objnr = gi_jcds-objnr.
IF gi_prps IS NOT INITIAL.
*** select sale order and items from vmpa
*** select sale orders and items from vbup having billing status
*** Not yet processed(A) or Partially processed(B)
SELECT a~ps_psp_pnr a~vbeln a~posnr p~fksaa
FROM vmpa AS a INNER JOIN vbup AS p ON
a~vbeln = p~vbeln AND
a~posnr = p~posnr
INTO TABLE gi_vmpa
FOR ALL ENTRIES IN gi_prps
WHERE a~ps_psp_pnr = gi_prps-pspnr AND
fksaa IN ('A', 'B').
IF gi_vmpa IS NOT INITIAL.
SORT gi_vmpa BY vbeln posnr.
SELECT a~ps_psp_pnr a~vbeln a~posnr p~fksaa
FROM vmpa AS a INNER JOIN vbup AS p ON
a~vbeln = p~vbeln AND
a~posnr = p~posnr
INTO TABLE gi_vmpa_c
FOR ALL ENTRIES IN gi_prps
WHERE a~ps_psp_pnr = gi_prps-pspnr AND
fksaa IN ('C').
IF gi_vmpa_c IS NOT INITIAL.
SORT gi_vmpa_c BY vbeln ps_psp_pnr.
ENDIF.
*" Start of changes Defect#2351 DS6K903071
SELECT p~projn
q~aufpl
q~aplzl
FROM afvc AS p INNER JOIN afvu AS q ON
p~aufpl = q~aufpl AND
p~aplzl = q~aplzl
INTO TABLE gi_afvc_afvu
FOR ALL ENTRIES IN gi_vmpa
WHERE p~projn = gi_vmpa-ps_psp_pnr AND
q~usr10 = 'X'.
IF gi_afvc_afvu IS NOT INITIAL.
SELECT a~projn
b~aufpl
b~aplzl
b~ieavd
FROM afvc AS a INNER JOIN afvv AS b ON
a~aufpl = b~aufpl AND
a~aplzl = b~aplzl
INTO TABLE gi_afvc_afvv
FOR ALL ENTRIES IN gi_afvc_afvu
WHERE a~projn = gi_afvc_afvu-projn AND
a~aufpl = gi_afvc_afvu-aufpl AND
a~aplzl = gi_afvc_afvu-aplzl.
IF NOT gi_afvc_afvv IS INITIAL.
DELETE gi_afvc_afvv WHERE ieavd IS INITIAL.
SORT gi_afvc_afvv BY projn ieavd DESCENDING.
ENDIF.
ENDIF.
*" End of changes Defect#2351
SELECT vbeln posnr netwr
werks " Added for Defect#2351 DS6K903071
FROM vbap
INTO TABLE gi_vbap
FOR ALL ENTRIES IN gi_vmpa
WHERE vbeln = gi_vmpa-vbeln AND
posnr = gi_vmpa-posnr AND
netwr GT '0'.
IF gi_vbap IS NOT INITIAL.
SORT gi_vbap BY vbeln posnr.
*" Start of changes Defect#2351 DS6K903071
*" To get the region
SELECT werks
abtei
FROM yca_werks_distr
INTO TABLE gi_region
FOR ALL ENTRIES IN gi_vbap
WHERE werks = gi_vbap-werks.
SORT gi_region BY werks.
*" End of changes Defect#2351 DS6K903071
SELECT a~vbelv a~posnv a~vbeln a~posnn k~fksto
FROM vbfa AS a INNER JOIN vbrk AS k ON
a~vbeln = k~vbeln
INTO TABLE gi_vbfark
FOR ALL ENTRIES IN gi_vbap
WHERE a~vbelv = gi_vbap-vbeln AND
a~posnv = gi_vbap-posnr AND
a~vbtyp_n = gc_vbtyp_m AND
k~fksto = 'X'.
IF sy-subrc = 0.
SORT gi_vbfark BY vbelv posnv.
SELECT vbeln ernam erdat sfakn zzjobid
FROM vbrk
INTO TABLE gi_vbrk
FOR ALL ENTRIES IN gi_vbfark
WHERE sfakn = gi_vbfark-vbeln.
IF gi_vbrk IS NOT INITIAL.
SORT gi_vbrk BY sfakn.
SELECT bname name_textc
FROM user_addr
INTO TABLE gi_username
FOR ALL ENTRIES IN gi_vbrk
WHERE bname = gi_vbrk-ernam.
IF gi_username IS NOT INITIAL.
SORT gi_username BY bname.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
MESSAGE s001(00) WITH text-cm1.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. "f_select_wbs
************************************************************************
************************************************************************
** Form.............: f_data_mine
** Description......: this subroutine create
**..................:
************************************************************************
************************************************************************
FORM f_data_mine.
CLEAR: gi_final, gw_final.
LOOP AT gi_vmpa INTO gw_vmpa.
CLEAR: gw_final.
gw_final-vbeln = gw_vmpa-vbeln.
gw_final-posnr = gw_vmpa-posnr.
gw_final-ps_psp_pnr = gw_vmpa-ps_psp_pnr.
READ TABLE gi_vmpa_c INTO gw_vmpa_c WITH KEY vbeln = gw_vmpa-vbeln
ps_psp_pnr = gw_vmpa-ps_psp_pnr
BINARY SEARCH.
IF sy-subrc = 0.
gw_final-fksaa = 'B'.
gw_final-statv = text-st2.
ELSE.
gw_final-fksaa = 'A'.
gw_final-statv = text-st1.
ENDIF.
CLEAR: gw_prps.
READ TABLE gi_prps INTO gw_prps WITH KEY pspnr = gw_vmpa-ps_psp_pnr.
IF sy-subrc = 0.
gw_final-post1 = gw_prps-post1.
ENDIF.
CLEAR: gw_vbap.
READ TABLE gi_vbap INTO gw_vbap WITH KEY vbeln = gw_vmpa-vbeln
posnr = gw_vmpa-posnr
BINARY SEARCH.
IF sy-subrc = 0.
gw_final-netwr = gw_vbap-netwr.
gw_final-werks = gw_vbap-werks. "Added by Defect#2351 DS6K90307
ENDIF.
*" Start of changes Defect#2351
READ TABLE gi_region INTO gw_region WITH KEY werks = gw_vbap-werks.
IF sy-subrc = 0.
gw_final-abtei = gw_region-abtei.
ENDIF.
CLEAR gw_afvc_afvv.
READ TABLE gi_afvc_afvv INTO gw_afvc_afvv WITH KEY projn = gw_vmpa-ps_psp_pnr.
IF sy-subrc = 0 AND gw_afvc_afvv-ieavd IS NOT INITIAL.
gw_final-conf_date = gw_afvc_afvv-ieavd. "Added by Defect#2351 DS6K903071
ENDIF.
*" End of changes Defect#2351
CLEAR: gw_vbfark.
READ TABLE gi_vbfark INTO gw_vbfark WITH KEY vbelv = gw_vmpa-vbeln
posnv = gw_vmpa-posnr
BINARY SEARCH.
IF sy-subrc = 0.
CLEAR: gw_vbrk.
READ TABLE gi_vbrk INTO gw_vbrk WITH KEY sfakn = gw_vbfark-vbeln
BINARY SEARCH.
IF sy-subrc = 0.
gw_final-canc_flg = 'X'.
ENDIF.
ENDIF.
APPEND gw_final TO gi_final.
ENDLOOP.
*** delete the items which has Zero netvalue
DELETE gi_final WHERE netwr LE gc_netwr.
************************************************************************
*** start of code for the history of the billing doc
************************************************************************
LOOP AT gi_vbfark INTO gw_vbfark.
CLEAR: gw_vbrk, gw_history.
READ TABLE gi_vbrk INTO gw_vbrk WITH KEY sfakn = gw_vbfark-vbeln
BINARY SEARCH.
IF sy-subrc = 0.
gw_history-vbelv = gw_vbfark-vbelv.
gw_history-posnv = gw_vbfark-posnv.
gw_history-vbeln = gw_vbfark-vbeln.
gw_history-posnr = gw_vbfark-posnr.
gw_history-fksto = gw_vbfark-fksto.
gw_history-canc_doc = gw_vbrk-vbeln.
gw_history-ernam = gw_vbrk-ernam.
gw_history-erdat = gw_vbrk-erdat.
gw_history-zzjobid = gw_vbrk-zzjobid.
CLEAR: gw_username.
READ TABLE gi_username INTO gw_username WITH KEY bname = gw_vbrk-ernam
BINARY SEARCH.
IF sy-subrc = 0.
gw_history-name_textc = gw_username-name_textc.
ENDIF.
ENDIF.
APPEND gw_history TO gi_history.
ENDLOOP.
ENDFORM. "f_data_mine
************************************************************************
************************************************************************
** Form.............: f_create_statistics
** Description......: this subroutine create
**..................:
************************************************************************
************************************************************************
FORM f_create_statistics.
CLEAR:gv_no_wbs_processed, gv_no_wbs_not_yet_processed,
gv_no_wbs_partially_processed, gv_no_wbs_cancel.
***total no of WBS processed.
DESCRIBE TABLE gi_final LINES gv_no_wbs_processed.
***Number of SO having not yet processed
gi_final_temp[] = gi_final[].
DELETE gi_final_temp WHERE fksaa NE 'A'.
DESCRIBE TABLE gi_final_temp LINES gv_no_wbs_not_yet_processed.
CLEAR: gi_final_temp, gi_final_temp[].
*** Number of SO Partially processed
gi_final_temp[] = gi_final[].
DELETE gi_final_temp WHERE fksaa NE 'B'.
DESCRIBE TABLE gi_final_temp LINES gv_no_wbs_partially_processed.
CLEAR: gi_final_temp, gi_final_temp[].
gi_final_temp[] = gi_final[].
DELETE gi_final_temp WHERE canc_flg EQ ' '.
DESCRIBE TABLE gi_final_temp LINES gv_no_wbs_cancel.
CLEAR: gi_final_temp, gi_final_temp[].
ENDFORM. " f_create_Statistics
************************************************************************
************************************************************************
** Form.............: f_create_fieldcat
** Description......: this subroutine create
**..................:
************************************************************************
************************************************************************
FORM f_create_fieldcat .
DATA: gv_colpos TYPE i VALUE 1.
DATA: gv_colpos_j TYPE i VALUE 1.
gw_fieldcat-fieldname = 'VBELN'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 12.
gw_fieldcat-seltext_m = 'SO#'.
gw_fieldcat-seltext_l = 'Sales Order'.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
gw_fieldcat-fieldname = 'POSNR'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 8.
gw_fieldcat-seltext_l = 'Item'.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
gw_fieldcat-fieldname = 'PS_PSP_PNR'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 24.
gw_fieldcat-seltext_m = 'Trades'.
gw_fieldcat-seltext_l = 'Trades (WBS)'.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
gw_fieldcat-fieldname = 'POST1'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 30.
gw_fieldcat-fix_column = 'X'.
gw_fieldcat-seltext_m = 'Trade Desc.'.
gw_fieldcat-seltext_l = 'Trade(WBS) Description '.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
* Start of change Defect#2351 sj010474 DS6K903071
gw_fieldcat-fieldname = 'WERKS'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 6.
gw_fieldcat-fix_column = 'X'.
gw_fieldcat-seltext_m = 'Plant'.
gw_fieldcat-seltext_l = 'Plant'.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
gw_fieldcat-fieldname = 'ABTEI'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 6.
gw_fieldcat-fix_column = 'X'.
gw_fieldcat-seltext_m = 'Regn.'.
gw_fieldcat-seltext_l = 'Region'.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
gw_fieldcat-fieldname = 'CONF_DATE'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 10.
gw_fieldcat-fix_column = 'X'.
gw_fieldcat-no_zero = 'X'.
gw_fieldcat-seltext_m = 'Conf.Date'.
gw_fieldcat-seltext_l = 'Confirmation Date'.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
* End of change Defect#2351 sj010474 DS6K903071
gw_fieldcat-fieldname = 'FKSAA'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 2.
gw_fieldcat-no_out = 'X'.
gw_fieldcat-fix_column = 'X'.
gw_fieldcat-seltext_m = ' '.
gw_fieldcat-seltext_l = ' '.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
gw_fieldcat-fieldname = 'STATV'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 20.
gw_fieldcat-fix_column = 'X'.
gw_fieldcat-seltext_m = 'Bill.Status'.
gw_fieldcat-seltext_l = 'Billing status '.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
gw_fieldcat-fieldname = 'NETWR'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 16.
gw_fieldcat-seltext_m = 'Net value'.
gw_fieldcat-seltext_l = 'Net value of the order item'.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
gw_fieldcat-fieldname = 'CANC_FLG'.
gw_fieldcat-col_pos = gv_colpos.
gw_fieldcat-outputlen = 4.
gw_fieldcat-seltext_m = 'Canc.'.
gw_fieldcat-seltext_l = 'Cancelled'.
APPEND gw_fieldcat TO gi_fieldcat.
CLEAR gw_fieldcat.
ADD 1 TO gv_colpos.
*** for second alv
gw_fieldcat_j-fieldname = 'VBELV'.
gw_fieldcat_j-col_pos = gv_colpos_j.
gw_fieldcat_j-outputlen = 12.
gw_fieldcat_j-seltext_m = 'Sales Order'.
gw_fieldcat_j-seltext_l = text-t07.
APPEND gw_fieldcat_j TO gi_fieldcat_j.
CLEAR gw_fieldcat_j.
ADD 1 TO gv_colpos_j.
gw_fieldcat_j-fieldname = 'POSNV'.
gw_fieldcat_j-col_pos = gv_colpos_j.
* gw_fieldcat_j-outputlen = 7. " Commented by Defect#2351 DS6K903071
gw_fieldcat_j-outputlen = 10. " Added by Defect#2351 DS6K903071
gw_fieldcat_j-seltext_m = 'SO.Item'.
gw_fieldcat_j-seltext_l = text-t08.
APPEND gw_fieldcat_j TO gi_fieldcat_j.
CLEAR gw_fieldcat_j.
ADD 1 TO gv_colpos_j.
gw_fieldcat_j-fieldname = 'ZZJOBID'.
gw_fieldcat_j-col_pos = gv_colpos_j.
* gw_fieldcat_j-outputlen = 21. " Commented by Defect#2351 DS6K903071
gw_fieldcat_j-outputlen = 29. " Added by Defect#2351 DS6K903071
gw_fieldcat_j-seltext_m = 'Job.ID'.
gw_fieldcat_j-seltext_l = text-t10.
APPEND gw_fieldcat_j TO gi_fieldcat_j.
CLEAR gw_fieldcat_j.
ADD 1 TO gv_colpos_j.
gw_fieldcat_j-fieldname = 'VBELN'.
gw_fieldcat_j-col_pos = gv_colpos_j.
* gw_fieldcat_j-outputlen = 12. " Commented by Defect#2351 DS6K903071
gw_fieldcat_j-outputlen = 16. " Added by Defect#2351 DS6K903071
gw_fieldcat_j-seltext_m = 'Bill.Doc'.
gw_fieldcat_j-seltext_l = text-t06.
APPEND gw_fieldcat_j TO gi_fieldcat_j.
CLEAR gw_fieldcat_j.
ADD 1 TO gv_colpos_j.
gw_fieldcat_j-fieldname = 'POSNR'.
gw_fieldcat_j-col_pos = gv_colpos_j.
* gw_fieldcat_j-outputlen = 7. " Commented by Defect#2351 DS6K903071
gw_fieldcat_j-outputlen = 11. " Added by Defect#2351 DS6K903071
gw_fieldcat_j-seltext_m = 'Bill.Item'.
gw_fieldcat_j-seltext_l = text-t12.
APPEND gw_fieldcat_j TO gi_fieldcat_j.
CLEAR gw_fieldcat_j.
ADD 1 TO gv_colpos_j.
gw_fieldcat_j-fieldname = 'CANC_DOC'.
gw_fieldcat_j-col_pos = gv_colpos_j.
gw_fieldcat_j-outputlen = 12.
gw_fieldcat_j-seltext_m = 'Canc.Doc'.
APPEND gw_fieldcat_j TO gi_fieldcat_j.
CLEAR gw_fieldcat_j.
ADD 1 TO gv_colpos_j.
gw_fieldcat_j-fieldname = 'NAME_TEXTC'.
gw_fieldcat_j-col_pos = gv_colpos_j.
* gw_fieldcat_j-outputlen = 32. " Commented by Defect#2351 DS6K903071
gw_fieldcat_j-outputlen = 38. " Added by Defect#2351 DS6K903071
gw_fieldcat_j-seltext_m = 'Cancelled By'.
APPEND gw_fieldcat_j TO gi_fieldcat_j.
CLEAR gw_fieldcat_j.
ADD 1 TO gv_colpos_j.
gw_fieldcat_j-fieldname = 'ERDAT'.
gw_fieldcat_j-col_pos = gv_colpos_j.
gw_fieldcat_j-outputlen = 10.
gw_fieldcat_j-seltext_m = 'Canc.Date'.
APPEND gw_fieldcat_j TO gi_fieldcat_j.
CLEAR gw_fieldcat_j.
ADD 1 TO gv_colpos_j.
ENDFORM. "f_create_fieldcat
************************************************************************
************************************************************************
** Form.............: f_create_events
** Description......: this subroutine create
**..................:
************************************************************************
************************************************************************
FORM f_create_events.
DATA: l_i_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = gi_events[].
*----- Pass top-of-page
READ TABLE gi_events WITH KEY name = slis_ev_top_of_page
INTO l_i_event.
IF sy-subrc = 0.
MOVE formname_top_of_page TO l_i_event-form.
APPEND l_i_event TO gi_events.
ENDIF.
CLEAR l_i_event.
IF gi_history IS INITIAL.
READ TABLE gi_events WITH KEY name = slis_ev_end_of_list
INTO l_i_event.
IF sy-subrc = 0.
MOVE formname_end_of_list TO l_i_event-form.
APPEND l_i_event TO gi_events.
ENDIF.
CLEAR l_i_event.
ENDIF.
*** for second alv
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = gi_events_j[].
*----- Pass top-of-page
READ TABLE gi_events_j WITH KEY name = slis_ev_top_of_page
INTO l_i_event.
IF sy-subrc = 0.
MOVE formname_top_of_page_j TO l_i_event-form.
APPEND l_i_event TO gi_events_j.
ENDIF.
CLEAR l_i_event.
*----- Pass top-of-page
READ TABLE gi_events_j WITH KEY name = slis_ev_end_of_list
INTO l_i_event.
IF sy-subrc = 0.
MOVE formname_end_of_list_j TO l_i_event-form.
APPEND l_i_event TO gi_events_j.
ENDIF.
CLEAR l_i_event.
ENDFORM. "f_create_events
************************************************************************
************************************************************************
** Form.............: generate_top_of_page
** Description......: this subroutine create
**..................:
************************************************************************
************************************************************************
FORM generate_top_of_page.
*" Start of change Defect#2351 sj010474 DS6K903071
* WRITE : /1(122) sy-uline.
* WRITE : /1 sy-vline, 45 text-t14,
* 122 sy-vline.
* WRITE : /1 sy-vline, 122 sy-vline.
* WRITE : /1 sy-vline, 8 text-t15,
* 122 sy-vline.
* WRITE : /1(122) sy-uline.
*
****total no of WBS processed.
* .
* WRITE : /1 sy-vline, AT 35(54) sy-uline, AT 122 sy-vline.
* WRITE : /1 sy-vline, AT 16 icon_led_green AS ICON,
* AT 20 icon_businav_value_chain AS ICON,
* AT 24 icon_businav_value_chain AS ICON,
* AT 28 icon_businav_value_chain AS ICON,
* AT 35 sy-vline,
* AT 37(30) text-001 COLOR COL_HEADING INTENSIFIED OFF,
* AT 70 sy-vline,
* gv_no_wbs_processed COLOR COL_NEGATIVE INVERSE ON,
* AT 88 sy-vline, AT 122 sy-vline.
* FORMAT INVERSE OFF.
* FORMAT COLOR OFF.
* WRITE : /1 sy-vline, AT 35(54) sy-uline, AT 122 sy-vline.
*
**** total no of SO Not yet processed
* WRITE : /1 sy-vline, AT 35(54) sy-uline, AT 122 sy-vline.
* WRITE : /1 sy-vline, AT 16 icon_led_green AS ICON,
* AT 20 icon_businav_value_chain AS ICON,
* AT 24 icon_businav_value_chain AS ICON,
* AT 28 icon_businav_value_chain AS ICON,
* AT 35 sy-vline,
* AT 37(30) text-002 COLOR COL_TOTAL INTENSIFIED ON,
* AT 70 sy-vline,
* gv_no_wbs_not_yet_processed COLOR COL_NEGATIVE INVERSE ON,
* AT 88 sy-vline, AT 122 sy-vline.
* FORMAT INVERSE OFF.
* FORMAT COLOR OFF.
* WRITE : /1 sy-vline, AT 35(54) sy-uline, AT 122 sy-vline.
*
**** total no Partially processed.
* WRITE : /1 sy-vline, AT 35(54) sy-uline, AT 122 sy-vline.
* WRITE : /1 sy-vline, AT 16 icon_led_green AS ICON,
* AT 20 icon_businav_value_chain AS ICON,
* AT 24 icon_businav_value_chain AS ICON,
* AT 28 icon_businav_value_chain AS ICON,
* AT 35 sy-vline,
* AT 37(30) text-003 COLOR COL_NEGATIVE INTENSIFIED OFF,
* AT 70 sy-vline,
* gv_no_wbs_partially_processed COLOR COL_NEGATIVE INVERSE ON,
* AT 88 sy-vline, AT 122 sy-vline.
* FORMAT INVERSE OFF.
* FORMAT COLOR OFF.
* WRITE : /1 sy-vline, AT 35(54) sy-uline, AT 122 sy-vline.
*
**** total no of WBS Rejected for FNBL.
* WRITE : /1 sy-vline, AT 35(54) sy-uline, AT 122 sy-vline.
* WRITE : /1 sy-vline, AT 16 icon_led_green AS ICON,
* AT 20 icon_businav_value_chain AS ICON,
* AT 24 icon_businav_value_chain AS ICON,
* AT 28 icon_businav_value_chain AS ICON,
* AT 35 sy-vline,
* AT 37(32) text-005 COLOR COL_POSITIVE INTENSIFIED OFF,
* AT 70 sy-vline,
* gv_no_wbs_cancel COLOR COL_NEGATIVE INVERSE ON,
* AT 88 sy-vline, AT 122 sy-vline.
* FORMAT INVERSE OFF.
* FORMAT COLOR OFF.
* WRITE : /1 sy-vline, AT 35(54) sy-uline, AT 122 sy-vline.
*
*
* WRITE : /1(122) sy-uline.
**** top of the page for the next alv.
*
* WRITE : /1(122) sy-uline.
* WRITE : /1 sy-vline, 32 text-h01,
* 122 sy-vline.
* WRITE : /1(122) sy-uline.
WRITE : /1(147) sy-uline.
WRITE : /1 sy-vline, 56 text-t14,
147 sy-vline.
WRITE : /1 sy-vline, 147 sy-vline.
WRITE : /1 sy-vline, 20 text-t15,
147 sy-vline.
WRITE : /1(147) sy-uline.
***total no of WBS processed.
.
WRITE : /1 sy-vline, AT 45(54) sy-uline, AT 147 sy-vline.
WRITE : /1 sy-vline, AT 26 icon_led_green AS ICON,
AT 30 icon_businav_value_chain AS ICON,
AT 34 icon_businav_value_chain AS ICON,
AT 38 icon_businav_value_chain AS ICON,
AT 45 sy-vline,
AT 47(30) text-001 COLOR COL_HEADING INTENSIFIED OFF,
AT 80 sy-vline,
gv_no_wbs_processed COLOR COL_NEGATIVE INVERSE ON,
AT 98 sy-vline, AT 147 sy-vline.
FORMAT INVERSE OFF.
FORMAT COLOR OFF.
WRITE : /1 sy-vline, AT 45(54) sy-uline, AT 147 sy-vline.
*** total no of SO Not yet processed
WRITE : /1 sy-vline, AT 45(54) sy-uline, AT 147 sy-vline.
WRITE : /1 sy-vline, AT 26 icon_led_green AS ICON,
AT 30 icon_businav_value_chain AS ICON,
AT 34 icon_businav_value_chain AS ICON,
AT 38 icon_businav_value_chain AS ICON,
AT 45 sy-vline,
AT 47(30) text-002 COLOR COL_TOTAL INTENSIFIED ON,
AT 80 sy-vline,
gv_no_wbs_not_yet_processed COLOR COL_NEGATIVE INVERSE ON,
AT 98 sy-vline, AT 147 sy-vline.
FORMAT INVERSE OFF.
FORMAT COLOR OFF.
WRITE : /1 sy-vline, AT 45(54) sy-uline, AT 147 sy-vline.
*** total no Partially processed.
WRITE : /1 sy-vline, AT 45(54) sy-uline, AT 147 sy-vline.
WRITE : /1 sy-vline, AT 26 icon_led_green AS ICON,
AT 30 icon_businav_value_chain AS ICON,
AT 34 icon_businav_value_chain AS ICON,
AT 38 icon_businav_value_chain AS ICON,
AT 45 sy-vline,
AT 47(30) text-003 COLOR COL_NEGATIVE INTENSIFIED OFF,
AT 80 sy-vline,
gv_no_wbs_partially_processed COLOR COL_NEGATIVE INVERSE ON,
AT 98 sy-vline, AT 147 sy-vline.
FORMAT INVERSE OFF.
FORMAT COLOR OFF.
WRITE : /1 sy-vline, AT 45(54) sy-uline, AT 147 sy-vline.
*** total no of WBS Rejected for FNBL.
WRITE : /1 sy-vline, AT 45(54) sy-uline, AT 147 sy-vline.
WRITE : /1 sy-vline, AT 26 icon_led_green AS ICON,
AT 30 icon_businav_value_chain AS ICON,
AT 34 icon_businav_value_chain AS ICON,
AT 38 icon_businav_value_chain AS ICON,
AT 45 sy-vline,
AT 47(32) text-005 COLOR COL_POSITIVE INTENSIFIED OFF,
AT 80 sy-vline,
gv_no_wbs_cancel COLOR COL_NEGATIVE INVERSE ON,
AT 98 sy-vline, AT 147 sy-vline.
FORMAT INVERSE OFF.
FORMAT COLOR OFF.
WRITE : /1 sy-vline, AT 45(54) sy-uline, AT 147 sy-vline.
WRITE : /1(147) sy-uline.
*** top of the page for the next alv.
WRITE : /1(147) sy-uline.
WRITE : /1 sy-vline, 43 text-h01,
147 sy-vline.
WRITE : /1(147) sy-uline.
*" End of change Defect#2351 sj010474 DS6K903071
ENDFORM. "GENERATE_TOP_OF_PAGE
************************************************************************
************************************************************************
** Form.............: generate_top_of_page_j
** Description......: this subroutine create
**..................:
************************************************************************
************************************************************************
FORM generate_top_of_page_j.
*" Start of change Defect#2351 sj010474 DS6K903071
* WRITE : /1(122) sy-uline.
* WRITE : /1 sy-vline, 32 text-h02,
* 122 sy-vline.
* WRITE : /1(122) sy-uline.
WRITE : /1(147) sy-uline.
WRITE : /1 sy-vline, 43 text-h02,
147 sy-vline.
WRITE : /1(147) sy-uline.
*" End of change Defect#2351 sj010474 DS6K903071
ENDFORM. "generate_top_of_page_j
************************************************************************
************************************************************************
** Form.............: f_write_report
** Description......: this subroutine create
**..................:
************************************************************************
************************************************************************
FORM f_write_report.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = 'YPS_SD_SYSTEM_HEALTH_CHECK_2'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = gi_layout
it_fieldcat = gi_fieldcat
i_tabname = ' '
it_events = gi_events
* IT_SORT =
* I_TEXT = ' '
TABLES
t_outtab = gi_final
* EXCEPTIONS
* PROGRAM_ERROR = 1
* MAXIMUM_OF_APPENDS_REACHED = 2
* OTHERS = 3
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF gi_history IS NOT INITIAL.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = gi_layout_j
it_fieldcat = gi_fieldcat_j
i_tabname = ' '
it_events = gi_events_j
* IT_SORT =
* I_TEXT = ' '
TABLES
t_outtab = gi_history
* EXCEPTIONS
* PROGRAM_ERROR = 1
* MAXIMUM_OF_APPENDS_REACHED = 2
* OTHERS = 3
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
ENDFORM. " f_write_report
*&---------------------------------------------------------------------*
*& Form f_send_mail
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f_send_mail .
DATA: p_user TYPE sy-uname.
DATA: lv_repid TYPE sy-repid.
CLEAR: gv_jobname, gv_jobcount, gv_job_was_released,
lv_repid.
DATA: lv_uzeit TYPE sy-uzeit.
lv_uzeit = 30 + sy-uzeit.
*** assign the user name to the background job.
p_user = sy-uname.
*** assign the program name to the jobname.
lv_repid = gc_bg_repid.
CONCATENATE lv_repid sy-uzeit INTO gv_jobname SEPARATED BY '_'.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
* DELANFREP = ' '
jobgroup = 'YPS_SD_SHC_2'
jobname = gv_jobname
sdlstrtdt = sy-datum
sdlstrttm = sy-uzeit
jobclass = 'C'
IMPORTING
jobcount = gv_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
***--- Submiting the program with the job
SUBMIT yps_shc_send_mail_2
WITH s_mailid IN s_mailid
WITH p_user = p_user
USER lc_bcbatch
VIA JOB gv_jobname
NUMBER gv_jobcount
AND RETURN.
IF sy-subrc = 0.
***--- job close.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
at_opmode_periodic = 'X'
event_periodic = 'X'
jobcount = gv_jobcount
jobname = gv_jobname
sdlstrtdt = sy-datum
sdlstrttm = lv_uzeit
* strtimmed = 'X'
IMPORTING
job_was_released = gv_job_was_released
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
invalid_target = 8
OTHERS = 9.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF. "job_submit.
ENDIF. "job_open.
ENDFORM. " f_send_mail
************************************************************************
************************************************************************
** Form.............: generate_end_of_page
** Description......: this subroutine create
**..................:
************************************************************************
************************************************************************
FORM generate_end_of_page.
*** user instruction section
SELECT remarks
FROM ysd_parameter
INTO TABLE gi_remarks
WHERE indicator1 = gc_indicator AND
param1 = gc_param1.
IF gi_remarks IS NOT INITIAL.
SKIP 1.
*anges by Defect#2351 SJ010474 DS6K903071
*** write the heading.
* WRITE : /1(122) sy-uline.
* WRITE : /1 sy-vline, 50 text-t13,
* 122 sy-vline.
* WRITE : /1(122) sy-uline.
*
* LOOP AT gi_remarks INTO gw_remarks.
* WRITE : /1(122) sy-uline.
* WRITE : /1 sy-vline, AT 3 icon_checked AS ICON,
* 7(100) gw_remarks-remarks, AT 122 sy-vline.
* WRITE : /1(122) sy-uline.
WRITE : /1(147) sy-uline.
WRITE : /1 sy-vline, 60 text-t13,
147 sy-vline.
WRITE : /1(147) sy-uline.
LOOP AT gi_remarks INTO gw_remarks.
WRITE : /1(147) sy-uline.
WRITE : /1 sy-vline, AT 6 icon_checked AS ICON,
11(100) gw_remarks-remarks, AT 147 sy-vline.
WRITE : /1(147) sy-uline.
*"End of changes by Defect#2351 SJ010474 DS6K903071
ENDLOOP.
ENDIF.
ENDFORM. "GENERATE_END_OF_PAGE
No comments:
Post a Comment