*&---------------------------------------------------------------------**& Report ZDM_ICM_POLICY_WITH_POL*&Created by James on 2018/07/16*&---------------------------------------------------------------------**& the report for query the dirty data with policy*& 1 policy has been been released but doesn't have POL/PAC*& 2 policy haven't be released but have POL/PAC*& 3 policy have pol/pac but no policy released.*&---------------------------------------------------------------------*
REPORTZDM_ICM_POLICY_WITH_POL.*&---------------------------------------------------------------------**& DATA DEFINE*&---------------------------------------------------------------------*
TYPES:BEGIN OFTY_RANGE,
SIGN(1) type C,
OPTION(2) type C,
LOW type MATNR,
HIGH type MATNR,END OFTY_RANGE,BEGIN OFTY_POLNR_RFC,
POLICYNR_TTTYPECHAR30,
TMP_DEL_FGTYPECHAR3,END OFTY_POLNR_RFC,BEGIN OFTY_POLNR_RFC_PM,
POLICYNR_TTTYPECHAR17,
TMP_DEL_FGTYPECHAR1,END OFTY_POLNR_RFC_PM,BEGIN OFTY_CAS,
BUSOBJ_TYPETYPECHAR3,
BUSOBJ_IDTYPECHAR30,END OFTY_CAS.DATA:
GT_CAS_NO_RETYPE TABLE OFTY_CAS,
GT_CAS_YE_RETYPE TABLE OFTY_CAS,
GT_CAS_HAVE_POTYPE TABLE OFTY_CAS,
GT_FIELDCATTYPElVC_T_FCAT,
GS_FIELDCATTYPElVC_S_FCAT,
GS_LAYOUTTYPElVC_S_LAYO,*temporary storage
GT_POLNR_YE_RFC TYPE TABLE OFTY_POLNR_RFC,
GT_POLNR_NO_RFCTYPE TABLE OFTY_POLNR_RFC.*&---------------------------------------------------------------------**& PARAMETERS DEFINITION*&---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK B01 WITH FRAME TITLE TEXT-B01.PARAMETERS:
P_RELERADIOBUTTON GROUP RD1 TYPECHAR1,
P_NULLRADIOBUTTON GROUP RD1 TYPE CHAR1 DEFAULT 'X',
P_POLRADIOBUTTON GROUP RD1 TYPECHAR1,
P_DESTTYPE RFCDES-RFCDEST.SELECTION-SCREEN END OF BLOCKB01.*&---------------------------------------------------------------------**& INITIALIZATION*&---------------------------------------------------------------------*
INITIALIZATION.CLEAR:
GT_CAS_NO_RE,
GT_CAS_YE_RE,
GT_CAS_HAVE_PO,
GT_FIELDCAT,
GS_FIELDCAT,
GS_LAYOUT.*&---------------------------------------------------------------------**& START-OF-SELECTION*&---------------------------------------------------------------------*
START-OF-SELECTION.PERFORMCALL_RFC.PERFORMEDIT_POLNR.IF GT_CAS_NO_RE IS INITIAL ANDGT_CAS_YE_REIS INITIAL ANDGT_CAS_HAVE_POIS INITIAL.EXIT.ENDIF.PERFORMALV_SHOW.*&---------------------------------------------------------------------**& Form CALL_RFC*&---------------------------------------------------------------------**text*----------------------------------------------------------------------**
FORMCALL_RFC .DATA:
LT_RFCTYPE TABLE OFTY_POLNR_RFC_PM,
LT_POLNR_YE_RFCTYPE TABLE OFTY_POLNR_RFC,
LT_POLNR_NO_RFCTYPE TABLE OFTY_POLNR_RFC,
LS_POLNR_YE_RFCTYPETY_POLNR_RFC,
LS_POLNR_NO_RFCTYPETY_POLNR_RFC.FIELD-SYMBOLS: TYPETY_POLNR_RFC_PM.CLEAR:
LT_RFC,
LT_POLNR_YE_RFC,
LT_POLNR_NO_RFC,
LS_POLNR_YE_RFC,
LS_POLNR_NO_RFC.UNASSIGN:.*Call RFC
CALL FUNCTION 'ZDM_ICM_GET_POLICY'
DESTINATIONP_DESTTABLESTT_POLNR_RCF=LT_RFC.*divide policy as released and not yet
IF LT_RFC IS NOT INITIAL.*has been released
IF P_RELE =ABAP_TRUE.SORT LT_RFC BYTMP_DEL_FG DESCENDING.LOOP AT LT_RFC ASSIGNING
WHERE TMP_DEL_FG =ABAP_TRUE.
LS_POLNR_YE_RFC-POLICYNR_TT = -POLICYNR_TT.CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTINGINPUT= LS_POLNR_YE_RFC-POLICYNR_TTIMPORTING
OUTPUT = LS_POLNR_YE_RFC-POLICYNR_TT.
LS_POLNR_YE_RFC-TMP_DEL_FG = -TMP_DEL_FG.APPEND LS_POLNR_YE_RFC TOLT_POLNR_YE_RFC.CLEARLS_POLNR_YE_RFC.ENDLOOP.MOVE-CORRESPONDING LT_POLNR_YE_RFC TOGT_POLNR_YE_RFC.IF GT_POLNR_YE_RFC IS INITIAL.MESSAGE 'Can not find Policy which already be released from /PM0/ABDQMIGJOUR' TYPE 'E'.EXIT.ENDIF.*hasn't be released
ELSEIF P_NULL = ABAP_TRUE OR P_POL =ABAP_TRUE.SORT LT_RFC BYTMP_DEL_FG ASCENDING.LOOP AT LT_RFC ASSIGNING
WHERE TMP_DEL_FG =ABAP_FALSE.
LS_POLNR_NO_RFC-POLICYNR_TT = -POLICYNR_TT.CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTINGINPUT= LS_POLNR_NO_RFC-POLICYNR_TTIMPORTING
OUTPUT = LS_POLNR_NO_RFC-POLICYNR_TT.
LS_POLNR_NO_RFC-TMP_DEL_FG = -TMP_DEL_FG.APPEND LS_POLNR_NO_RFC TOLT_POLNR_NO_RFC.CLEARLS_POLNR_NO_RFC.ENDLOOP.MOVE-CORRESPONDING LT_POLNR_NO_RFC TOGT_POLNR_NO_RFC.IF GT_POLNR_NO_RFC IS INITIAL.MESSAGE 'Can not find Policy which has not be released from /PM0/ABDQMIGJOUR' TYPE 'E'.EXIT.ENDIF.ENDIF.ELSE.MESSAGE 'Can not get any Polict from /PM0/ABDQMIGJOUR' TYPE 'E'.EXIT.ENDIF.ENDFORM.*&---------------------------------------------------------------------**& Form EDIT_POLNR*&---------------------------------------------------------------------**text*----------------------------------------------------------------------**--> GT_POLNR_YE_RFC Released yes*--> GT_POLNR_NO_RFC Released no*
FORMEDIT_POLNR .DATA:
LT_CAS_NO_RETYPE TABLE OFTY_CAS,
LT_CAS_YE_RETYPE TABLE OFTY_CAS,
LT_CAS_HAVE_POTYPE TABLE OFTY_CAS,
LT_RANGETYPE TABLE OFTY_RANGE,
LS_RANGETYPETY_RANGE,
LT_POLNR_NO_RETYPE TABLE OF TY_POLNR_RFC, "Released yes
LT_POLNR_YE_RE TYPE TABLE OF TY_POLNR_RFC, "Released no
LS_POLNR_YE_RE TYPETY_CAS,*----------start add by james in 2018/08/02 DE1K9A028J-----------
LV_PACKGE TYPE I VALUE '500000',
LV_COUNTTYPEi,
LV_STARTTYPE i VALUE '1',
LV_ENDTYPEI.*----------end add by james in 2018/08/02 DE1K9A028J-----------
FIELD-SYMBOLS: TYPETY_POLNR_RFC, TYPETY_CAS.CLEAR:
LT_CAS_NO_RE,
LT_CAS_YE_RE,
LT_CAS_HAVE_PO,
LT_RANGE,
LS_RANGE,
LT_POLNR_NO_RE,
LT_POLNR_YE_RE.UNASSIGN:,.*define range
LS_RANGE-sign = 'I'.
LS_RANGE-option = 'EQ'.
LS_RANGE-low = 'POL'.APPEND LS_RANGE TOLT_RANGE.CLEARLS_RANGE.
LS_RANGE-sign = 'I'.
LS_RANGE-option = 'EQ'.
LS_RANGE-low = 'PAC'.APPEND LS_RANGE TOLT_RANGE.*case1 for released
IF P_RELE =ABAP_TRUE.*----------start add by james in 2018/08/02 DE1K9A028J-----------
DESCRIBE TABLE GT_POLNR_YE_RFC LINESLV_COUNT.WHILE LV_START <=LV_COUNT.
LV_END= LV_START + LV_PACKGE - 1.APPEND LINES OF GT_POLNR_YE_RFC FROM LV_START TO LV_END TOLT_POLNR_YE_RE .
LV_START= LV_END + 1.*IF SY-TABIX MOD LV_PACKGE = 0 OR SY-TABIX = LV_COUNT.
IF LT_POLNR_YE_RE IS NOT INITIAL.SELECTBUSOBJ_TYPE
BUSOBJ_IDINTO CORRESPONDING FIELDS OF TABLELT_CAS_YE_REFROMZICNSL_CASFOR ALL ENTRIES INLT_POLNR_YE_REWHERE BUSOBJ_ID = LT_POLNR_YE_RE-POLICYNR_TTAND BUSOBJ_TYPE INLT_RANGE.*policy has been been released but doesn't have POL/PAC
IF LT_CAS_YE_RE IS NOT INITIAL.SORT LT_CAS_YE_RE BYBUSOBJ_ID.DELETE ADJACENT DUPLICATES FROMLT_CAS_YE_RE COMPARING BUSOBJ_ID.SORT LT_POLNR_YE_RE BYPOLICYNR_TT.SORT LT_CAS_YE_RE BYBUSOBJ_ID .LOOP AT LT_POLNR_YE_RE ASSIGNING .READ TABLE LT_CAS_YE_RE ASSIGNING
WITH KEY BUSOBJ_ID = -POLICYNR_TT BINARY SEARCH.IF SY-SUBRC <> 0.
LS_POLNR_YE_RE-BUSOBJ_ID = -POLICYNR_TT.
LS_POLNR_YE_RE-BUSOBJ_TYPE = 'No'.APPEND LS_POLNR_YE_RE TOGT_CAS_YE_RE.CLEAR:LS_POLNR_YE_RE.ENDIF.ENDLOOP.ENDIF.ENDIF.CLEAR:
LT_POLNR_YE_RE,
LT_CAS_YE_RE.ENDWHILE.
IF GT_CAS_YE_RE IS INITIAL.MESSAGE 'according to released policy, haven not find pol/pac' TYPE 'E'.EXIT.ENDIF.*----------end add by james in 2018/08/02 DE1K9A028J-----------
ENDIF.*case2 for haven't be released
IF P_NULL =ABAP_TRUE.*----------start add by james in 2018/08/02 DE1K9A028J-----------
DESCRIBE TABLE GT_POLNR_NO_RFC LINESLV_COUNT.WHILE LV_START <=LV_COUNT.
LV_END= LV_START + LV_PACKGE - 1.APPEND LINES OF GT_POLNR_NO_RFC FROM LV_START TO LV_END TOLT_POLNR_NO_RE .
LV_START= LV_END + 1.*IF SY-TABIX MOD LV_PACKGE = 0 OR SY-TABIX = LV_COUNT.
IF LT_POLNR_NO_RE IS NOT INITIAL.SELECTBUSOBJ_TYPE
BUSOBJ_IDINTO CORRESPONDING FIELDS OF TABLELT_CAS_NO_REFROMZICNSL_CASFOR ALL ENTRIES INLT_POLNR_NO_REWHERE BUSOBJ_ID = LT_POLNR_NO_RE-POLICYNR_TTAND BUSOBJ_TYPE INLT_RANGE.*policy haven't be released but have POL/PAC
IF LT_CAS_NO_RE IS NOT INITIAL.SORT LT_CAS_NO_RE BYBUSOBJ_TYPE BUSOBJ_ID.DELETE ADJACENT DUPLICATES FROMLT_CAS_NO_RE COMPARING BUSOBJ_TYPE BUSOBJ_ID.APPEND LINES OF LT_CAS_NO_RE TOGT_CAS_NO_RE .ENDIF.ENDIF.CLEAR:
LT_POLNR_NO_RE,
LT_CAS_NO_RE.ENDWHILE.
IF GT_CAS_NO_RE IS INITIAL.MESSAGE 'do not have the policy already be released but still have POL/PAC' TYPE 'S'.EXIT.ENDIF.*----------end add by james in 2018/08/02 DE1K9A028J-----------
ENDIF.*case3 for have pol/pac but no policy released.
IF P_POL =ABAP_TRUE.
LT_POLNR_NO_RE=GT_POLNR_NO_RFC.FREE:GT_POLNR_NO_RFC.SELECTBUSOBJ_TYPE
BUSOBJ_IDINTO CORRESPONDING FIELDS OF TABLELT_CAS_HAVE_POFROMZICNSL_CASFOR ALL ENTRIES INLT_POLNR_NO_REWHERE BUSOBJ_ID = LT_POLNR_NO_RE-POLICYNR_TTAND BUSOBJ_TYPE INLT_RANGE.IF LT_CAS_HAVE_PO IS NOT INITIAL.SORT LT_CAS_HAVE_PO BYBUSOBJ_TYPE BUSOBJ_ID.DELETE ADJACENT DUPLICATES FROMLT_CAS_HAVE_PO COMPARING BUSOBJ_TYPE BUSOBJ_ID.
GT_CAS_HAVE_PO=LT_CAS_NO_RE.ENDIF.ENDIF.ENDFORM.*&---------------------------------------------------------------------**& Form ALV_SHOW*&---------------------------------------------------------------------**text*----------------------------------------------------------------------**--> GT_CAS_YE_RE policy has been been released but doesn't have POL/PAC*--> GT_CAS_NO_RE policy haven't be released but have POL/PAC*--> GT_CAS_HAVE_PO policy have pol/pac but no policy released.*----------------------------------------------------------------------*
FORMALV_SHOW .
GS_LAYOUT-CWIDTH_OPT = 'X'.
GS_LAYOUT-ZEBRA = 'X'.
GS_LAYOUT-SEL_MODE = 'D'.
gs_fieldcat-fieldname = 'BUSOBJ_TYPE'.
gs_fieldcat-coltext = 'BUSOBJ_TYPE'.
gs_fieldcat-outputlen = '20'.APPEND gs_fieldcat TOgt_fieldcat.CLEARgs_fieldcat.
gs_fieldcat-fieldname = 'BUSOBJ_ID'.
gs_fieldcat-coltext = 'BUSOBJ_ID'.
gs_fieldcat-outputlen = '20'.APPEND gs_fieldcat TOgt_fieldcat.CLEARgs_fieldcat.IF P_RELE =ABAP_TRUE .CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTINGi_callback_program= sy-repid
is_layout_lvc=gs_layout
it_fieldcat_lvc=gt_fieldcat
I_SAVE= 'A'
TABLESt_outtab=GT_CAS_YE_REEXCEPTIONSprogram_error= 1OTHERS= 2.ELSEIF P_NULL =ABAP_TRUE.CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTINGi_callback_program= sy-repid
is_layout_lvc=gs_layout
it_fieldcat_lvc=gt_fieldcat
I_SAVE= 'A'
TABLESt_outtab=GT_CAS_NO_REEXCEPTIONSprogram_error= 1OTHERS= 2.ELSEIF P_POL =ABAP_TRUE.CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTINGi_callback_program= sy-repid
is_layout_lvc=gs_layout
it_fieldcat_lvc=gt_fieldcat
I_SAVE= 'A'
TABLESt_outtab=GT_CAS_HAVE_POEXCEPTIONSprogram_error= 1OTHERS= 2.ENDIF.ENDFORM.