*----------------------------------------------------------------------* * FORM DOCUM_MODIF_DEBI * *----------------------------------------------------------------------* FORM docum_modif_debi. DATA: lv_objectid LIKE CDHDR-OBJECTID, ls_n_kna1 LIKE KNA1, ls_o_kna1 LIKE KNA1, dummy_knb1 LIKE KNB1, * ls_n_knvv LIKE knvv, * ls_o_knvv LIKE knvv, lt_dummy_knas TYPE FKNAS OCCURS 0, lt_dummy_knat TYPE FKNAT OCCURS 0, lt_dummy_knb5 TYPE FKNB5 OCCURS 0, lt_dummy_knbk TYPE FKNBK OCCURS 0, lt_dummy_knbw TYPE FKNBW OCCURS 0, lt_dummy_knex TYPE FKNEX OCCURS 0, lt_dummy_knva TYPE FKNVA OCCURS 0, lt_dummy_knvd TYPE FKNVD OCCURS 0, lt_dummy_knvi TYPE FKNVI OCCURS 0, lt_dummy_knvk TYPE FKNVK OCCURS 0, lt_dummy_knvl TYPE FKNVL OCCURS 0, lt_dummy_knvp TYPE FKNVP OCCURS 0, lt_dummy_knvs TYPE FKNVS OCCURS 0, lt_dummy_knza TYPE FKNZA OCCURS 0, lt_dummy_lfas TYPE FLFAS OCCURS 0, lt_dummy_lfat TYPE FLFAT OCCURS 0, lt_dummy_lfb5 TYPE FLFB5 OCCURS 0, lt_dummy_lfbk TYPE FLFBK OCCURS 0, lt_dummy_lfbw TYPE FLFBW OCCURS 0, lt_dummy_lfei TYPE FLFEI OCCURS 0, lt_dummy_lflr TYPE FLFLR OCCURS 0, lt_dummy_lfm2 TYPE FLFM2 OCCURS 0, lt_dummy_lfza TYPE FLFZA OCCURS 0, lt_dummy_wyt1 TYPE FWYT1 OCCURS 0, lt_dummy_wyt1t TYPE FWYT1T OCCURS 0, lt_dummy_wyt3 TYPE FWYT3 OCCURS 0. DATA: t_cp_data LIKE BDI_CHPTR OCCURS 0 WITH HEADER LINE. DATA: BEGIN OF t_tbd62 OCCURS 10. INCLUDE STRUCTURE TBD62. DATA: END OF t_tbd62. IF ls_o_kna1 = ls_n_kna1 AND gs_o_knvv = gs_n_knvv. *Modifica fittizia per forzare la creazione del change document gs_o_knvv-vsort = '*'. ENDIF. lv_objectid = gt_out-kunnr. CALL FUNCTION 'DEBI_WRITE_DOCUMENT' EXPORTING OBJECTID = lv_objectid TCODE = SY-TCODE UTIME = SY-UZEIT UDATE = SY-DATLO USERNAME = SY-UNAME OBJECT_CHANGE_INDICATOR = 'U' N_KNA1 = ls_n_kna1 O_YKNA1 = ls_o_kna1 UPD_KNA1 = '' N_KNB1 = dummy_knb1 O_YKNB1 = dummy_knb1 N_KNVV = gs_n_knvv O_YKNVV = gs_o_knvv UPD_KNVV = 'U' TABLES XKNAS = lt_dummy_knas YKNAS = lt_dummy_knas XKNAT = lt_dummy_knat YKNAT = lt_dummy_knat XKNB5 = lt_dummy_knb5 YKNB5 = lt_dummy_knb5 XKNBK = lt_dummy_knbk YKNBK = lt_dummy_knbk XKNBW = lt_dummy_knbw YKNBW = lt_dummy_knbw XKNEX = lt_dummy_knex YKNEX = lt_dummy_knex XKNVA = lt_dummy_knva YKNVA = lt_dummy_knva XKNVD = lt_dummy_knvd YKNVD = lt_dummy_knvd XKNVI = lt_dummy_knvi YKNVI = lt_dummy_knvi XKNVK = lt_dummy_knvk YKNVK = lt_dummy_knvk XKNVL = lt_dummy_knvl YKNVL = lt_dummy_knvl XKNVP = lt_dummy_knvp YKNVP = lt_dummy_knvp XKNVS = lt_dummy_knvs YKNVS = lt_dummy_knvs XKNZA = lt_dummy_knza YKNZA = lt_dummy_knza. * scrittura indicatori di modifica * Ricerca modifiche campo campo * IF gs_pai-kna1 NE gs_pbo-kna1. * CONCATENATE sy-mandt gs_pai-key-kunnr INTO t_cp_data-tabkey. * PERFORM t_cp_data_fill TABLES t_cp_data * USING 'KNA1' gs_pbo-kna1 gs_pai-kna1 * 'DEBI'. * ENDIF. * * IF gs_pai-knvv NE gs_pbo-knvv. * CONCATENATE sy-mandt gs_pai-key-kunnr gs_pai-key-vkorg * gs_pai-key-vtweg gs_pai-key-spart * INTO t_cp_data-tabkey. * PERFORM t_cp_data_fill TABLES t_cp_data * USING 'KNVV' gs_pbo-knvv gs_pai-knvv * 'DEBI'. * ENDIF. * * IF gs_pai-blc_st NE gs_pbo-blc_st. * CONCATENATE sy-mandt gs_pai-key-kunnr gs_pai-key-j_3asean * INTO t_cp_data-tabkey. * PERFORM t_cp_data_fill TABLES t_cp_data * USING 'ZSBP_BLC_ST' gs_pbo-blc_st gs_pai-blc_st * 'Z_SBPBLCCL'. * ENDIF. * * IF gs_pai-chs_st NE gs_pbo-chs_st. * CONCATENATE sy-mandt gs_pai-key-kunnr gs_pai-key-j_3asean * INTO t_cp_data-tabkey. * PERFORM t_cp_data_fill TABLES t_cp_data * USING 'ZSBP_BLC_ST' gs_pbo-chs_st gs_pai-chs_st * 'Z_SBPBLCCL'. * ENDIF. * * IF gs_pai-blc_av_st NE gs_pbo-blc_av_st. * CONCATENATE sy-mandt gs_pai-key-kunnr gs_pai-key-vkorg * gs_pai-key-vtweg gs_pai-key-spart gs_pai-key-j_3asean * INTO t_cp_data-tabkey. * PERFORM t_cp_data_fill TABLES t_cp_data * USING 'ZSBP_BLC_AV_ST' gs_pbo-blc_av_st gs_pai-blc_av_st * 'Z_SBPBLCCL'. * ENDIF. * * SELECT * FROM tbd62 APPENDING TABLE t_tbd62 * WHERE mestyp = 'DEBMAS'. * * SORT t_tbd62 BY cdobjcl tabname fldname. * * LOOP AT t_cp_data. * READ TABLE t_tbd62 WITH KEY cdobjcl = t_cp_data-cdobjcl * tabname = t_cp_data-tabname * fldname = t_cp_data-fldname * BINARY SEARCH. * IF sy-subrc NE 0. * DELETE t_cp_data. * ENDIF. * ENDLOOP. * **<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< * * IF NOT t_cp_data[] IS INITIAL. * ** scrive indicatore di modifica di tipo listing ** (facilità di gestione per gli indicatori di modifica) * * REFRESH t_cp_data. * * t_cp_data-tabname = 'KNA1'. * CONCATENATE sy-mandt lv_objectid INTO t_cp_data-tabkey. * t_cp_data-fldname = 'NAME1'. * t_cp_data-cdobjcl = 'DEBITOR'. * t_cp_data-cdobjid = 'P'. * t_cp_data-cdchgid = 'U'. * APPEND t_cp_data. * * CALL FUNCTION 'CHANGE_POINTERS_CREATE_DIRECT' * EXPORTING * message_type = 'DEBMAS' * TABLES * t_cp_data = t_cp_data. * ENDIF. ENDFORM. " docum_modif_debi *----------------------------------------------------------------------* * FORM T_CP_DATA_FILL * *----------------------------------------------------------------------* FORM t_cp_data_fill TABLES t_cp_data STRUCTURE BDI_CHPTR USING VALUE(tabname) gs_pbo_tab gs_pai_tab VALUE(cdobjcl). DATA: ls_ref TYPE REF TO CL_ABAP_STRUCTDESCR. FIELD-SYMBOLS: <old>, <new>, <comp> TYPE ABAP_COMPDESCR. ls_ref ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_DATA( gs_pbo_tab ). DO. ASSIGN COMPONENT SY-INDEX OF STRUCTURE gs_pai_tab TO <new>. IF SY-SUBRC NE 0. EXIT. ENDIF. ASSIGN COMPONENT SY-INDEX OF STRUCTURE gs_pbo_tab TO <old>. IF <new> <> <old>. LOOP AT ls_ref->components ASSIGNING <comp> FROM SY-INDEX TO SY-INDEX. t_cp_data-tabname = tabname. t_cp_data-fldname = <comp>-name. t_cp_data-cdobjcl = cdobjcl. t_cp_data-cdobjid = <new>. t_cp_data-cdchgid = 'U'. APPEND t_cp_data. ENDLOOP. ENDIF. ENDDO. ENDFORM. " t_cp_data_fill *----------------------------------------------------------------------*
martedì 29 novembre 2016
Scrittura dei documenti di modifica per KNA1 e KNVV
Iscriviti a:
Commenti sul post (Atom)
Nessun commento:
Posta un commento