Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *&--------------------------------------------------------------------*
- *& Номер спецификации: КШ_EXT_ CA_REP_291
- *& Наименование спецификации: Отчет сравнения фактов хозяйственной деятельности,
- *& между различными методами учета БУ/ НУ/ МСФО.
- *& Дата создания: 20.03.2023
- *& Проект: Внедрение S/4HANA
- *& Функциональный консультант: Рафаилова А.
- *& Разработчик: Григорович Р.В.
- *&---------------------------------------------------------------------*
- REPORT ztx_pt_cmp MESSAGE-ID ztax_291.
- INCLUDE ztx_pt_cmp_t01.
- INCLUDE ztx_pt_cmp_s01.
- INCLUDE ztx_pt_cmp_cd01.
- INCLUDE ztx_pt_cmp_ci01.
- INCLUDE ztx_pt_cmp_e01.
- *&---------------------------------------------------------------------*
- *& Include ZTX_PT_CMP_T01
- *&---------------------------------------------------------------------*
- TABLES:
- zstx_pt_cmp_ss,
- sscrfields.
- *&---------------------------------------------------------------------*
- *& Include ZTX_PT_CMP_S01
- *&---------------------------------------------------------------------*
- PARAMETERS:
- p_bukrs TYPE zstx_pt_cmp_ss-bukrs MEMORY ID buk VALUE CHECK OBLIGATORY,
- p_ryear TYPE zstx_pt_cmp_ss-ryear OBLIGATORY.
- SELECT-OPTIONS:
- s_poper FOR zstx_pt_cmp_ss-poper OBLIGATORY NO-EXTENSION.
- SELECTION-SCREEN:
- SKIP.
- SELECT-OPTIONS:
- s_diffty FOR zstx_pt_cmp_ss-difftyp,
- s_taxdif FOR zstx_pt_cmp_ss-taxdiff.
- SELECTION-SCREEN:
- SKIP.
- SELECTION-SCREEN BEGIN OF BLOCK sb0 WITH FRAME TITLE TEXT-sb0.
- PARAMETERS p_dop TYPE flag NO-DISPLAY.
- SELECTION-SCREEN PUSHBUTTON /1(5) bb0 USER-COMMAND bb0.
- SELECT-OPTIONS:
- s_racct FOR zstx_pt_cmp_ss-racct MODIF ID dop,
- s_rcntr FOR zstx_pt_cmp_ss-rcntr MODIF ID dop,
- s_aufnr FOR zstx_pt_cmp_ss-aufnr MODIF ID dop,
- s_pspnr FOR zstx_pt_cmp_ss-ps_psp_pnr MODIF ID dop,
- s_vptnr FOR zstx_pt_cmp_ss-vptnr MODIF ID dop,
- s_zuonr FOR zstx_pt_cmp_ss-zuonr MODIF ID dop,
- s_anln1 FOR zstx_pt_cmp_ss-anln1 MODIF ID dop,
- s_matnr FOR zstx_pt_cmp_ss-matnr MODIF ID dop,
- s_werks FOR zstx_pt_cmp_ss-werks MODIF ID dop.
- SELECTION-SCREEN BEGIN OF BLOCK sb8 WITH FRAME.
- SELECT-OPTIONS:
- s_belnr FOR zstx_pt_cmp_ss-belnr MODIF ID dop,
- s_blart FOR zstx_pt_cmp_ss-blart MODIF ID dop,
- s_xrev FOR zstx_pt_cmp_ss-xreversed MODIF ID dop,
- s_budat FOR zstx_pt_cmp_ss-budat MODIF ID dop,
- s_cpudt FOR zstx_pt_cmp_ss-cpudt MODIF ID dop.
- SELECTION-SCREEN END OF BLOCK sb8.
- SELECTION-SCREEN END OF BLOCK sb0.
- SELECTION-SCREEN:
- SKIP.
- PARAMETERS:
- p_init TYPE xfeld,
- p_sbeg AS CHECKBOX,
- p_nmax LIKE zstx_pt_cmp_ss-nmax_it DEFAULT '99999'.
- *&---------------------------------------------------------------------*
- *& CLASS LCL_APPLICATION DEFINITION
- *&---------------------------------------------------------------------*
- * Класс работы с приложением
- *----------------------------------------------------------------------*
- CLASS lcl_application DEFINITION FINAL.
- PUBLIC SECTION.
- CLASS-METHODS:
- INITIALIZATION,
- at_selection_screen,
- start_of_selection,
- end_of_selection,
- check_bukrs IMPORTING iv_bukrs TYPE bukrs,
- at_selection_output.
- PRIVATE SECTION.
- CLASS-DATA:
- go_ptcmp TYPE REF TO zcl_tx_ptcmp.
- ENDCLASS. " LCL_APPLICATION DEFINITION
- *&---------------------------------------------------------------------*
- * Класс приложения
- *----------------------------------------------------------------------*
- CLASS lcl_application IMPLEMENTATION.
- *----------------------------------------------------------------------*
- * Проверка БЕ
- *----------------------------------------------------------------------*
- METHOD check_bukrs.
- " Проверка полномочий на БЕ
- AUTHORITY-CHECK OBJECT 'F_BKPF_BUK'
- ID 'BUKRS' FIELD iv_bukrs
- ID 'ACTVT' FIELD '03'.
- IF sy-subrc <> 0.
- *Нет полномочий на БЕ &1
- MESSAGE e004 WITH iv_bukrs.
- ENDIF.
- ENDMETHOD.
- *----------------------------------------------------------------------*
- * Метод для обработки события INITIALIZATION
- *----------------------------------------------------------------------*
- METHOD INITIALIZATION.
- IF sy-datum+4(2) = '01'.
- p_ryear = sy-datum(4) - 1.
- s_poper[] = VALUE #( ( SIGN = 'I' OPTION = 'BT' LOW = '001' HIGH = '012' ) ).
- ELSE.
- p_ryear = sy-datum(4).
- s_poper[] = VALUE #( ( SIGN = 'I' OPTION = 'BT' LOW = '001' HIGH = CONV #( sy-datum+4(2) - 1 ) ) ).
- ENDIF.
- ENDMETHOD. " AT_SELECTION_SREEN
- *----------------------------------------------------------------------*
- * Метод для обработки события AT_SELECTION_SREEN
- *----------------------------------------------------------------------*
- METHOD at_selection_screen.
- IF sscrfields-ucomm = 'BB0'.
- CASE p_dop.
- WHEN abap_true.
- p_dop = abap_false.
- WHEN abap_false.
- p_dop = abap_true.
- ENDCASE.
- ENDIF.
- CASE sscrfields-ucomm.
- WHEN 'DOP'.
- IF p_dop = abap_false.
- CLEAR: s_rcntr[],s_aufnr[],s_pspnr[],s_vptnr,s_zuonr,s_anln1[],s_matnr[],s_werks[]. "s_taxprt[].
- ENDIF.
- ENDCASE.
- ENDMETHOD. " AT_SELECTION_SREEN
- *----------------------------------------------------------------------*
- * Метод для обработки события AT_SELECTION_OUTPUT
- *----------------------------------------------------------------------*
- METHOD at_selection_output.
- CASE p_dop.
- WHEN abap_true.
- bb0 = icon_data_area_collapse.
- WHEN abap_false.
- bb0 = icon_data_area_expand.
- ENDCASE.
- LOOP AT SCREEN.
- IF p_dop = abap_false.
- IF screen-group1 = 'DOP'.
- *При не установленном флаге 'Дополнительные признаки'
- screen-active = 0.
- MODIFY SCREEN.
- ENDIF.
- ENDIF.
- ENDLOOP.
- ENDMETHOD. " AT_SELECTION_SREEN
- *----------------------------------------------------------------------*
- * Метод для обработки события START-OF-SELECTION.
- *----------------------------------------------------------------------*
- METHOD start_of_selection.
- DATA:
- lv_sbeg TYPE flag.
- IF s_poper-low = 1.
- lv_sbeg = p_sbeg.
- ENDIF.
- go_ptcmp = NEW #( "iv_rldnr = p_rldnr
- iv_nmax_it = p_nmax
- iv_init = p_init
- iv_sbeg = lv_sbeg
- is_reppar = VALUE #( bukrs = p_bukrs
- ryear = p_ryear
- rpoper = VALUE #( s_poper[ 1 ] OPTIONAL )
- )
- is_selcrit = VALUE #( r_difty = s_diffty[]
- r_racct = s_racct[]
- r_rcntr = s_rcntr[]
- r_aufnr = s_aufnr[]
- r_pspnr = s_pspnr[]
- r_vptnr = s_vptnr[]
- r_zuonr = s_zuonr[]
- r_anln1 = s_anln1[]
- r_matnr = s_matnr[]
- r_werks = s_werks[]
- r_taxdif = s_taxdif[]
- r_belnr = s_belnr[]
- r_blart = s_blart[]
- xrevers = s_xrev[]
- r_budat = s_budat[]
- r_cpudt = s_cpudt[]
- )
- ).
- ENDMETHOD. " START_OF_SELECTION
- *----------------------------------------------------------------------*
- * Метод для обработки события END-OF-SELECTION.
- *----------------------------------------------------------------------*
- METHOD end_of_selection.
- go_ptcmp->show_report( ).
- ENDMETHOD. " START_OF_SELECTION
- ENDCLASS.
- *&---------------------------------------------------------------------*
- *& Include ZTX_PT_CMP_E01
- *&---------------------------------------------------------------------*
- INITIALIZATION.
- lcl_application=>INITIALIZATION( ).
- AT SELECTION-SCREEN OUTPUT.
- lcl_application=>at_selection_output( ).
- AT SELECTION-SCREEN ON p_bukrs.
- lcl_application=>check_bukrs( p_bukrs ).
- AT SELECTION-SCREEN.
- lcl_application=>at_selection_screen( ).
- START-OF-SELECTION.
- lcl_application=>start_of_selection( ).
- END-OF-SELECTION.
- lcl_application=>end_of_selection( ).
- CLASS ZCL_TX_PTCMP DEFINITION
- PUBLIC
- FINAL
- CREATE PUBLIC .
- PUBLIC SECTION.
- METHODS CONSTRUCTOR
- IMPORTING
- !IV_RLDNR TYPE RLDNR OPTIONAL
- !IS_REPPAR TYPE ZSTX_REGKEYPAR
- !IS_SELCRIT TYPE ZSTX_REGSELCRIT OPTIONAL
- !IS_DRLREPSTR TYPE ZSTX_JNODRLSRC OPTIONAL
- !IV_NMAX_IT TYPE ZSTX_PT_CMP_SS-NMAX_IT DEFAULT '99999'
- !IT_SELCRIT_DYN TYPE RSDS_FRANGE_T OPTIONAL
- !IV_INIT TYPE XFELD
- !IV_SBEG TYPE XFELD .
- METHODS SHOW_REPORT
- IMPORTING
- !IV_VARREPORT TYPE SY-REPID OPTIONAL
- !IV_VARHANDLE TYPE SLIS_HANDL DEFAULT 'JNO'
- PREFERRED PARAMETER IV_VARREPORT .
- METHODS TOP_OF_PAGE
- IMPORTING
- !IO_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT
- !IV_TABLE_INDEX TYPE SYINDEX .
- METHODS DRILL_DOWN
- IMPORTING
- !IV_FIELDNAME TYPE FIELDNAME
- !IS_REP_LINE TYPE ZVTX_PTDATA_CMP
- !IS_ROW_NO TYPE LVC_S_ROID
- !IS_ROW TYPE LVC_S_ROW .
- PROTECTED SECTION.
- PRIVATE SECTION.
- DATA MV_RLDNR TYPE RLDNR .
- DATA MS_REPPAR TYPE ZSTX_REGKEYPAR .
- DATA MS_SELCRIT TYPE ZSTX_REGSELCRIT .
- DATA MS_DRL_REPSTR TYPE ZSTX_JNODRLSRC .
- DATA MT_DATA TYPE ZTTTX_PTDATA_CMP .
- DATA MV_SEL_DATE TYPE SYST_DATUM .
- DATA MV_SEL_TIME TYPE SYST_UZEIT .
- DATA MI_LOG TYPE REF TO ZIF_RA_SLOG .
- DATA MO_ALV TYPE REF TO ZCL_TX_PTCMP_ALV .
- DATA MV_NMAX_IT TYPE ZSTX_PT_CMP_SS-NMAX_IT .
- DATA MV_KOKRS TYPE KOKRS .
- CONSTANTS GCOV_TEMPLATE TYPE ZERA_REPORT_TEMPLATE VALUE 'ZTAX_291_CMP' ##NO_TEXT.
- DATA MTD_SELCRIT_DYN TYPE RSDS_FRANGE_T .
- DATA MV_BUTXT TYPE BUTXT .
- DATA MV_INIT TYPE XFELD .
- DATA MV_SBEG TYPE XFELD .
- CONSTANTS GCOV_BSTAT TYPE ACDOCA-BSTAT VALUE 'C' ##NO_TEXT.
- CONSTANTS GCOV_EQ TYPE CHAR2 VALUE 'EQ' ##NO_TEXT.
- METHODS READ_DATA .
- METHODS STORNO_DOCS .
- METHODS AUTH_RACCT .
- METHODS ON_USER_COMMAND
- FOR event COMMAND OF ZIF_RA_ALV
- IMPORTING
- !EV_COMMAND_NAME .
- METHODS EXCEL_REP .
- METHODS FILL_HEADER_XLS
- EXPORTING
- !ES_DATA TYPE ZSTX_PTDATA_CMP_HEADER_XLS .
- METHODS FILL_TABLE_XLS
- EXPORTING
- !ET_TABLE TYPE ZTTTX_PTDATA_CMP_ITEM_XLS
- !ES_ITOGO TYPE ZSTX_PTDATA_CMP_ITEM_XLS .
- METHODS SHOW_PARTNR
- IMPORTING
- !IV_PARTNR TYPE LIFNR .
- METHODS GET_CREATOR
- RETURNING
- VALUE(RV_FIO) TYPE TEXT100 .
- ENDCLASS.
- CLASS ZCL_TX_PTCMP IMPLEMENTATION.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Instance Private Method ZCL_TX_PTCMP->AUTH_RACCT
- * +-------------------------------------------------------------------------------------------------+
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD auth_racct.
- TYPES:
- BEGIN OF ltys_skb1_key,
- saknr TYPE skb1-saknr,
- END OF ltys_skb1_key,
- BEGIN OF ltys_skb1,
- saknr TYPE skb1-saknr,
- begru TYPE skb1-begru,
- END OF ltys_skb1.
- DATA:
- lt_skb1_key TYPE STANDARD TABLE OF ltys_skb1_key,
- lt_skb1 TYPE STANDARD TABLE OF ltys_skb1,
- lt_racct_r TYPE RANGE OF acdoca-racct,
- ls_racct_r LIKE LINE OF lt_racct_r.
- lt_skb1_key = VALUE #( FOR GROUPS ls_racct OF <ls_data> IN mt_data
- USING KEY racct_key
- GROUP BY ( racct = <ls_data>-racct )
- ASCENDING WITHOUT MEMBERS ( ls_racct ) ).
- IF lt_skb1_key[] IS INITIAL.
- RETURN.
- ENDIF.
- SELECT skb1~saknr, skb1~begru
- FROM skb1
- JOIN @lt_skb1_key AS TAB
- ON skb1~saknr = TAB~saknr
- WHERE bukrs = @ms_reppar-bukrs
- AND NOT begru IS INITIAL
- INTO TABLE @lt_skb1.
- IF sy-subrc <> 0.
- RETURN.
- ENDIF.
- LOOP AT lt_skb1 ASSIGNING FIELD-SYMBOL(<ls_skb1>).
- AUTHORITY-CHECK OBJECT 'F_BKPF_BES'
- ID 'BRGRU' FIELD <ls_skb1>
- ID 'ACTVT' FIELD '03'.
- CHECK sy-subrc <> 0.
- ls_racct_r(3) = 'IEQ'.
- ls_racct_r-LOW = <ls_skb1>-saknr.
- APPEND ls_racct_r TO lt_racct_r.
- ENDLOOP.
- IF lt_racct_r[] IS INITIAL.
- RETURN.
- ENDIF.
- DELETE mt_data WHERE racct IN lt_racct_r[].
- MESSAGE w003 INTO zcl_ra_slog=>mv_dummy.
- mi_log->add_msg( ).
- ENDMETHOD.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Instance Public Method ZCL_TX_PTCMP->CONSTRUCTOR
- * +-------------------------------------------------------------------------------------------------+
- * | [--->] IV_RLDNR TYPE RLDNR(optional)
- * | [--->] IS_REPPAR TYPE ZSTX_REGKEYPAR
- * | [--->] IS_SELCRIT TYPE ZSTX_REGSELCRIT(optional)
- * | [--->] IS_DRLREPSTR TYPE ZSTX_JNODRLSRC(optional)
- * | [--->] IV_NMAX_IT TYPE ZSTX_PT_CMP_SS-NMAX_IT (default ='99999')
- * | [--->] IT_SELCRIT_DYN TYPE RSDS_FRANGE_T(optional)
- * | [--->] IV_INIT TYPE XFELD
- * | [--->] IV_SBEG TYPE XFELD
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD constructor.
- *Максимальное количество записей
- mv_nmax_it = iv_nmax_it.
- mv_init = iv_init.
- mv_sbeg = iv_sbeg.
- *Параметры отчета
- ms_reppar = is_reppar.
- *Доп.параметры выбора данных
- ms_selcrit = is_selcrit.
- *Журнал сообщений
- mi_log = zcl_ra_slog=>get_general_log( ).
- ENDMETHOD.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Instance Public Method ZCL_TX_PTCMP->DRILL_DOWN
- * +-------------------------------------------------------------------------------------------------+
- * | [--->] IV_FIELDNAME TYPE FIELDNAME
- * | [--->] IS_REP_LINE TYPE ZVTX_PTDATA_CMP
- * | [--->] IS_ROW_NO TYPE LVC_S_ROID
- * | [--->] IS_ROW TYPE LVC_S_ROW
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD drill_down.
- DATA:
- lt_budat_r TYPE RANGE OF bkpf-budat,
- lv_posid TYPE prps-posid,
- lt_field TYPE TABLE OF sval,
- lv_rc.
- ASSIGN is_rep_line TO FIELD-SYMBOL(<ls_data>).
- CHECK sy-subrc = 0.
- ASSIGN COMPONENT iv_fieldname OF STRUCTURE <ls_data> TO FIELD-SYMBOL(<lv_value>).
- IF sy-subrc <> 0.
- RETURN.
- ENDIF.
- IF <lv_value> IS INITIAL.
- RETURN.
- ENDIF.
- CASE iv_fieldname.
- WHEN 'RCNTR'.
- *МВЗ
- SET PARAMETER ID: 'CAC' FIELD mv_kokrs,
- 'KOS' FIELD <lv_value>.
- CALL TRANSACTION 'KS03' WITH AUTHORITY-CHECK "#EC CI_CALLTA
- AND SKIP FIRST SCREEN.
- WHEN 'AUFNR'.
- *Заказ
- SET PARAMETER ID: 'ANR' FIELD <lv_value>.
- CALL TRANSACTION 'KO03' WITH AUTHORITY-CHECK "#EC CI_CALLTA
- AND SKIP FIRST SCREEN.
- WHEN 'PS_PSP_PNR'.
- *СПП
- SET PARAMETER ID: 'CAC' FIELD mv_kokrs,
- 'PDB' FIELD '000000000001'.
- CALL FUNCTION 'CONVERSION_EXIT_ABPSP_OUTPUT'
- EXPORTING
- INPUT = <lv_value>
- IMPORTING
- OUTPUT = lv_posid.
- SUBMIT rkpep003 "#EC CI_SUBMIT
- WITH cn_pspnr = lv_posid
- WITH r_budat IN lt_budat_r[]
- AND RETURN.
- WHEN 'LIFNR' OR 'KUNNR' OR 'COR_PARTN'.
- *Партнер
- show_partnr( <lv_value> ).
- WHEN 'RACCT'.
- *Счет
- SET PARAMETER ID: 'BUK' FIELD ms_reppar-bukrs,
- 'SAK' FIELD <lv_value>.
- CALL TRANSACTION 'FS00' WITH AUTHORITY-CHECK "#EC CI_CALLTA
- AND SKIP FIRST SCREEN.
- WHEN 'ANLN1'.
- *ОС
- SET PARAMETER ID: 'BUK' FIELD ms_reppar-bukrs,
- 'AN1' FIELD <lv_value>.
- CALL TRANSACTION 'AS03' WITH AUTHORITY-CHECK "#EC CI_CALLTA
- AND SKIP FIRST SCREEN.
- WHEN 'MATNR'.
- *Материал
- SET PARAMETER ID: 'MAT' FIELD <lv_value>.
- CALL TRANSACTION 'MM03' WITH AUTHORITY-CHECK "#EC CI_CALLTA
- AND SKIP FIRST SCREEN.
- WHEN OTHERS.
- lt_field = VALUE #( ( tabname = 'ACDOCA' fieldname = 'RLDNR' field_obl = abap_true ) ).
- CALL FUNCTION 'POPUP_GET_VALUES'
- EXPORTING
- popup_title = 'Введите регистр'
- IMPORTING
- RETURNCODE = lv_rc
- TABLES
- FIELDS = lt_field.
- CHECK lv_rc IS INITIAL.
- READ TABLE lt_field INTO DATA(ls_rldnr) WITH KEY fieldname = 'RLDNR'.
- SET PARAMETER ID: 'BUK' FIELD ms_reppar-bukrs,
- 'GJR' FIELD <ls_data>-gjahr,
- 'BLN' FIELD <ls_data>-belnr,
- 'GLN' FIELD ls_rldnr-VALUE.
- CALL TRANSACTION 'FB03L' WITH AUTHORITY-CHECK "#EC CI_CALLTA
- AND SKIP FIRST SCREEN.
- ENDCASE.
- ENDMETHOD.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Instance Private Method ZCL_TX_PTCMP->EXCEL_REP
- * +-------------------------------------------------------------------------------------------------+
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD excel_rep.
- DATA:
- ls_context TYPE zstx_ptdata_cmp_xls,
- lo_format_xls TYPE REF TO zcl_ra_report_format_xls3.
- * lx_err TYPE REF TO zcx_ra_slog.
- fill_header_xls( IMPORTING es_data = ls_context-header ).
- fill_table_xls( IMPORTING et_table = ls_context-items
- es_itogo = ls_context-itogo ).
- TRY.
- lo_format_xls = NEW #( ).
- lo_format_xls->zif_ra_report_format~run(
- ia_data = ls_context
- iv_template = gcov_template
- iv_open = abap_true ).
- CATCH zcx_ra_slog INTO DATA(lx_err).
- lx_err->show_as_popup( ).
- ENDTRY.
- ENDMETHOD.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Instance Private Method ZCL_TX_PTCMP->FILL_HEADER_XLS
- * +-------------------------------------------------------------------------------------------------+
- * | [<---] ES_DATA TYPE ZSTX_PTDATA_CMP_HEADER_XLS
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD fill_header_xls.
- DATA:
- lt_month_name TYPE TABLE OF t247,
- lv_tax_und TYPE text30.
- CLEAR es_data.
- es_data = VALUE #(
- *Время
- sel_time = |{ mv_sel_time TIME = USER }|
- *Дата
- sel_date = |{ mv_sel_date DATE = USER }|
- *Год
- ryear = ms_reppar-ryear ).
- *УНД
- IF ms_reppar-rztaxund-HIGH IS NOT INITIAL.
- lv_tax_und = ms_reppar-rztaxund-HIGH.
- * SHIFT lv_tax_und LEFT DELETING LEADING '0'.
- lv_tax_und = SHIFT_LEFT( val = lv_tax_und sub = '0' ).
- es_data-taxund = |{ 'Уточнение №'(e01) }{ lv_tax_und }|.
- ENDIF.
- *Период
- CALL FUNCTION 'MONTH_NAMES_GET'
- TABLES
- month_names = lt_month_name
- EXCEPTIONS
- month_names_not_found = 1
- OTHERS = 2.
- IF sy-subrc <> 0.
- CLEAR lt_month_name[].
- ENDIF.
- es_data-poper = lt_month_name[ mnr = ms_reppar-rpoper-LOW+1 ]-ltx. "#EC CI_STDSEQ
- IF ms_reppar-rpoper-HIGH IS NOT INITIAL AND ms_reppar-rpoper-HIGH <> ms_reppar-rpoper-LOW.
- es_data-poper = |{ es_data-poper } - { lt_month_name[ mnr = ms_reppar-rpoper-HIGH+1 ]-ltx }|. "#EC CI_STDSEQ
- ENDIF.
- *Налогоплательщик
- es_data-buktxt = zcl_tx_utils=>get_excel_report_bukrs_txt( ms_reppar-bukrs ).
- * Имя пользователя
- es_data-username = get_creator( ).
- ENDMETHOD.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Instance Private Method ZCL_TX_PTCMP->FILL_TABLE_XLS
- * +-------------------------------------------------------------------------------------------------+
- * | [<---] ET_TABLE TYPE ZTTTX_PTDATA_CMP_ITEM_XLS
- * | [<---] ES_ITOGO TYPE ZSTX_PTDATA_CMP_ITEM_XLS
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD fill_table_xls.
- CLEAR:
- et_table, es_itogo.
- LOOP AT mt_data ASSIGNING FIELD-SYMBOL(<ls_data>).
- APPEND INITIAL LINE TO et_table ASSIGNING FIELD-SYMBOL(<ls_table>).
- <ls_table> = CORRESPONDING #( <ls_data> ).
- <ls_table>-znp = sy-tabix.
- *Контрагент
- IF <ls_data>-lifnr IS NOT INITIAL.
- <ls_table>-partn = <ls_data>-lifnr.
- ELSEIF <ls_data>-kunnr IS NOT INITIAL.
- <ls_table>-partn = <ls_data>-kunnr.
- ELSE.
- <ls_table>-partn = <ls_data>-cor_partn.
- ENDIF.
- es_itogo-hsl_ias = es_itogo-hsl_ias + <ls_data>-hsl_ias.
- es_itogo-hsl_ras = es_itogo-hsl_ras + <ls_data>-hsl_ras.
- es_itogo-hsl_tax = es_itogo-hsl_tax + <ls_data>-hsl_tax.
- es_itogo-zz_taxdif_ias = es_itogo-zz_taxdif_ias + <ls_data>-zz_taxdif_ias.
- es_itogo-zz_taxdif_pbu = es_itogo-zz_taxdif_pbu + <ls_data>-zz_taxdif_pbu.
- ENDLOOP.
- ENDMETHOD.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Instance Private Method ZCL_TX_PTCMP->GET_CREATOR
- * +-------------------------------------------------------------------------------------------------+
- * | [<-()] RV_FIO TYPE TEXT100
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD get_creator.
- *Поиск составителя
- DATA:
- ls_addr3_val TYPE addr3_val.
- CLEAR: rv_fio.
- CALL FUNCTION 'SUSR_USER_ADDRESS_READ'
- EXPORTING
- user_name = sy-uname
- IMPORTING
- user_address = ls_addr3_val
- EXCEPTIONS
- OTHERS = 0.
- rv_fio = CONV #( ls_addr3_val-name_text ).
- ENDMETHOD.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Instance Private Method ZCL_TX_PTCMP->ON_USER_COMMAND
- * +-------------------------------------------------------------------------------------------------+
- * | [--->] EV_COMMAND_NAME LIKE
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD on_user_command.
- CASE ev_command_name.
- WHEN 'EXCEL'.
- excel_rep( ).
- ENDCASE.
- ENDMETHOD.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Instance Private Method ZCL_TX_PTCMP->READ_DATA
- * +-------------------------------------------------------------------------------------------------+
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD read_data.
- CLEAR: mt_data.
- *Переменные даты и времени выборки
- mv_sel_date = sy-datum.
- mv_sel_time = sy-uzeit.
- " Выбор документов - основные
- IF mv_sbeg = abap_true.
- IF ms_reppar-rpoper-OPTION = 'EQ'.
- ms_reppar-rpoper-OPTION = 'BT'.
- ms_reppar-rpoper-HIGH = 1.
- ENDIF.
- ms_reppar-rpoper-LOW = 0.
- ENDIF.
- *Выбор данных
- SELECT *
- APPENDING CORRESPONDING FIELDS OF TABLE @mt_data
- FROM zc_ca_tax_ptdata_cmp
- WHERE rbukrs = @ms_reppar-bukrs
- AND gjahr = @ms_reppar-ryear
- AND poper BETWEEN @ms_reppar-rpoper-LOW AND @ms_reppar-rpoper-HIGH
- AND zzcorgjr = @SPACE
- AND zzcorprd = @SPACE
- AND racct IN @ms_selcrit-r_racct
- AND rcntr IN @ms_selcrit-r_rcntr
- AND aufnr IN @ms_selcrit-r_aufnr
- AND ps_psp_pnr IN @ms_selcrit-r_pspnr
- AND ( lifnr IN @ms_selcrit-r_vptnr
- OR kunnr IN @ms_selcrit-r_vptnr
- OR cor_partn IN @ms_selcrit-r_vptnr )
- AND zuonr IN @ms_selcrit-r_zuonr
- AND anln1 IN @ms_selcrit-r_anln1
- AND matnr IN @ms_selcrit-r_matnr
- AND werks IN @ms_selcrit-r_werks
- AND zztaxdif IN @ms_selcrit-r_taxdif
- AND zz_diffcode IN @ms_selcrit-r_difty
- AND blart IN @ms_selcrit-r_blart
- AND budat IN @ms_selcrit-r_budat
- AND belnr IN @ms_selcrit-r_belnr
- AND cpudt IN @ms_selcrit-r_cpudt
- ORDER BY rbukrs,gjahr,belnr,docln ##TOO_MANY_ITAB_FIELDS.
- LOOP AT mt_data ASSIGNING FIELD-SYMBOL(<fs>).
- <fs>-zz_taxdif_pbu = <fs>-hsl_ras - <fs>-hsl_tax.
- <fs>-zz_taxdif_ias = <fs>-hsl_ias - <fs>-hsl_tax.
- ENDLOOP.
- IF LINES( mt_data[] ) > mv_nmax_it.
- *Выбранные данные ограничены указанным количеством записей
- MESSAGE w002 INTO zcl_ra_slog=>mv_dummy.
- mi_log->add_msg( ).
- DATA(lv_rows) = CONV sy-tabix( mv_nmax_it + 1 ).
- DELETE mt_data INDEX lv_rows. "#EC CI_SEL_DEL
- ENDIF.
- IF mt_data[] IS INITIAL.
- MESSAGE e001 INTO zcl_ra_slog=>mv_dummy.
- mi_log->add_msg( ).
- RETURN.
- ENDIF.
- *Сторнируемые и сторнирующие документы
- storno_docs( ).
- *Полномочия на счет
- auth_racct( ).
- ENDMETHOD.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Instance Private Method ZCL_TX_PTCMP->SHOW_PARTNR
- * +-------------------------------------------------------------------------------------------------+
- * | [--->] IV_PARTNR TYPE LIFNR
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD show_partnr.
- SET PARAMETER ID 'BUK' FIELD ms_reppar-bukrs.
- DATA(lo_request) = NEW cl_bupa_navigation_request( ).
- lo_request->set_partner_number( iv_partnr ).
- lo_request->set_bupa_activity( '03' ).
- lo_request->set_maintenance_id( 'B' ).
- DATA(lo_options) = NEW cl_bupa_dialog_joel_options( ).
- lo_options->set_locator_visible( SPACE ).
- CALL METHOD cl_bupa_dialog_joel=>start_with_navigation
- EXPORTING
- iv_request = lo_request
- iv_options = lo_options
- iv_in_new_internal_mode = abap_true
- EXCEPTIONS
- already_started = 1
- not_allowed = 2
- OTHERS = 3.
- IF sy-subrc <> 0.
- ENDIF.
- ENDMETHOD.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Instance Public Method ZCL_TX_PTCMP->SHOW_REPORT
- * +-------------------------------------------------------------------------------------------------+
- * | [--->] IV_VARREPORT TYPE SY-REPID(optional)
- * | [--->] IV_VARHANDLE TYPE SLIS_HANDL (default ='JNO')
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD show_report.
- DATA ls_variant TYPE disvariant.
- mo_alv = NEW #( io_model = me ).
- read_data( ).
- IF mi_log->has_messages( iv_has_any = abap_true ) = abap_true.
- mi_log->show_as_popup( ).
- mi_log->CLEAR( ).
- ENDIF.
- IF mt_data[] IS INITIAL.
- MESSAGE s001. "Данные не выбраны
- RETURN.
- ENDIF.
- TRY.
- " Обработчик событий
- SET HANDLER: me->on_user_command FOR mo_alv.
- mo_alv->zif_ra_alv~set_html( iv_set_top_of_page = abap_true
- iv_top_of_page_height = 6 ).
- ls_variant-REPORT = COND #( WHEN iv_varreport IS NOT INITIAL
- THEN iv_varreport ELSE sy-cprog ).
- ls_variant-HANDLE = iv_varhandle.
- mo_alv->zif_ra_alv~alv_show( it_a_table = mt_data
- is_variant = ls_variant
- iv_title = TEXT-t01 ).
- CATCH zcx_ra_slog INTO DATA(lx_err).
- lx_err->show_as_popup( ).
- ENDTRY.
- ENDMETHOD.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Instance Private Method ZCL_TX_PTCMP->STORNO_DOCS
- * +-------------------------------------------------------------------------------------------------+
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD storno_docs.
- IF abap_true NOT IN ms_selcrit-xrevers[] OR ms_selcrit-xrevers[] IS INITIAL.
- RETURN.
- ENDIF.
- LOOP AT mt_data ASSIGNING FIELD-SYMBOL(<ls_data_x>)
- USING KEY xreversed WHERE xreversed = abap_true.
- READ TABLE mt_data ASSIGNING FIELD-SYMBOL(<ls_data>)
- WITH TABLE KEY storno_key
- COMPONENTS awtyp_rev = <ls_data_x>-awtyp
- aworg_rev = <ls_data_x>-aworg
- awref_rev = <ls_data_x>-awref.
- * hsl = - <ls_data_x>-hsl.
- CHECK sy-subrc = 0.
- CHECK <ls_data_x>-budat(6) = <ls_data>-budat(6).
- DELETE mt_data USING KEY primary_key
- WHERE rbukrs = <ls_data_x>-rbukrs
- AND gjahr = <ls_data_x>-gjahr
- AND belnr = <ls_data_x>-belnr
- AND docln = <ls_data_x>-docln.
- DELETE mt_data USING KEY primary_key
- WHERE rbukrs = <ls_data>-rbukrs
- AND gjahr = <ls_data>-gjahr
- AND belnr = <ls_data>-belnr
- AND docln = <ls_data>-docln.
- ENDLOOP.
- ENDMETHOD.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Instance Public Method ZCL_TX_PTCMP->TOP_OF_PAGE
- * +-------------------------------------------------------------------------------------------------+
- * | [--->] IO_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT
- * | [--->] IV_TABLE_INDEX TYPE SYINDEX
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD top_of_page.
- io_dyndoc_id->add_text( text = CONV #( |БЕ| )
- sap_emphasis = 'Strong' ).
- io_dyndoc_id->add_gap( WIDTH = 1 ).
- io_dyndoc_id->add_text( text = CONV #( |{ ms_reppar-bukrs } { mv_butxt },| ) ).
- io_dyndoc_id->add_gap( WIDTH = 2 ).
- io_dyndoc_id->add_text( text = CONV #( |Год| )
- sap_emphasis = 'Strong' ).
- io_dyndoc_id->add_gap( WIDTH = 1 ).
- io_dyndoc_id->add_text( text = CONV #( |{ ms_reppar-ryear },| ) ).
- io_dyndoc_id->add_gap( WIDTH = 2 ).
- io_dyndoc_id->add_text( text = CONV #( |Период с| )
- sap_emphasis = 'Strong' ).
- io_dyndoc_id->add_gap( WIDTH = 1 ).
- io_dyndoc_id->add_text( text = CONV #( |{ ms_reppar-rpoper-LOW }| ) ).
- io_dyndoc_id->add_gap( WIDTH = 1 ).
- io_dyndoc_id->add_text( text = CONV #( |по| )
- sap_emphasis = 'Strong' ).
- io_dyndoc_id->add_gap( WIDTH = 1 ).
- io_dyndoc_id->add_text( text = CONV #( |{ ms_reppar-rpoper-HIGH }| ) ).
- ENDMETHOD.
- ENDCLASS.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement