Разработка технологического процесса по организации обработки информации для составления аналитических обзоров бизнес-процессов на базе системы SAP BW
Рефераты >> Программирование и компьютеры >> Разработка технологического процесса по организации обработки информации для составления аналитических обзоров бизнес-процессов на базе системы SAP BW

SELECTION-SCREEN BEGIN OF BLOCK type_fin

WITH FRAME TITLE text-012.

PARAMETERS: x001 RADIOBUTTON GROUP mw.

PARAMETERS: x002 RADIOBUTTON GROUP mw.

SELECTION-SCREEN END OF BLOCK type_fin.

SELECTION-SCREEN BEGIN OF BLOCK type_print

WITH FRAME TITLE text-014.

PARAMETERS: p001 RADIOBUTTON GROUP pr.

PARAMETERS: p002 RADIOBUTTON GROUP pr.

SELECTION-SCREEN END OF BLOCK type_print.

SELECTION-SCREEN BEGIN OF BLOCK type_choise

WITH FRAME TITLE text-016.

PARAMETERS: c001 RADIOBUTTON GROUP ch.

PARAMETERS: c002 RADIOBUTTON GROUP ch.

PARAMETERS: c003 RADIOBUTTON GROUP ch.

PARAMETERS: c004 RADIOBUTTON GROUP ch.

PARAMETERS: pexrt LIKE zextrheader-extrid.

SELECTION-SCREEN END OF BLOCK type_choise.

PARAMETERS: name_var(12).

AT SELECTION-SCREEN ON VALUE-REQUEST FOR name_var.

PERFORM alv_f4.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR pexrt.

PERFORM help_ext USING 'ZEXTRHEADER_S' 'EXTRID'.

END-OF-SELECTION.

IF c004 = 'X'. "Удалить экстракт

DELETE FROM zmt59_ext CLIENT SPECIFIED WHERE

mandt = sy-mandt AND extrid = pexrt.

DELETE FROM zextrheader CLIENT SPECIFIED WHERE

mandt = sy-mandt AND extrid = pexrt.

EXIT.

ENDIF.

IF NOT c001 IS INITIAL OR NOT c003 IS INITIAL.

IF w001 = 'X'.

sy-tvar3 = 'объекты НКС '.

ELSE.

sy-tvar3 = 'затраты и счета'.

ENDIF.

IF w002 = 'X'. " Если разницу на материалы, то услуги игнорируем

CLEAR: pr_usl.

ENDIF.

REFRESH tablends_copy.

* Если материалы не выбраны, то удаляем счет и дату прихода

IF pr_mat = ' '.

REFRESH: so_hkont,so_d_pr.

CLEAR: so_hkont,so_d_pr.

ENDIF.

* Формируем дату (Range), которая <= sodate-low-1

sodate_old-high = sodate-low - 1.

sodate_old-sign = 'I'.

sodate_old-option = 'BT'.

APPEND sodate_old.

z_ind_sfk = 0.

** Обрабатываем таблицу ZOST561 , подготовленном Макаревичем

** "Статинфотех" по остаткам материалов

IF pr_mat = 'X'. "Если по ТМЦ

SELECT * FROM zost561 INTO CORRESPONDING FIELDS OF TABLE ost561.

SORT ost561 BY bwtar lgort.

ENDIF.

ENDIF. "If not c001 is initial or not c003 is initial.

WRITE sodate-low TO sy-tvar1 DD/MM/YYYY.

WRITE sodate-high TO sy-tvar2 DD/MM/YYYY.

IF NOT c001 IS INITIAL OR NOT c003 IS INITIAL.

type_calc = 1.

* Ищем документы, созданные в данном периоде и смотрим, чтобы это был

* документ выравнивания

SELECT * INTO mybkpf FROM bkpf

WHERE bukrs = 'MNPZ' AND

bstat IN (' ','A') AND

budat IN sodate.

* Проверка на документ, сторно выравнивания

CLEAR fl_storno_zakr_per.

IF NOT ( mybkpf-stblg IS INITIAL ).

SELECT SINGLE stgrd INTO mystgrd FROM bkpf

WHERE bukrs = mybkpf-bukrs AND

belnr = mybkpf-stblg AND

gjahr = mybkpf-stjah.

IF ( sy-subrc = 0 ) AND

( mystgrd <> '01' ) AND

( NOT ( mystgrd IS INITIAL ) ) .

fl_storno_zakr_per = 'X'.

ENDIF.

ENDIF.

IF ( mybkpf-stblg IS INITIAL ) OR "Не сторно или

( ( mystgrd <> '01' ) AND

( NOT ( mystgrd IS INITIAL ) ) ) OR "Сторнировано в закрытом

" периоде или

( fl_storno_zakr_per = 'X' )."отмена выравнивания в закрытом периоде

IF fl_storno_zakr_per = 'X'. "отмена выравнивания в закрытом периоде

mybkpf-belnr = mybkpf-stblg.

mybkpf-gjahr = mybkpf-stjah.

ENDIF.

SELECT SINGLE * INTO mybse_clr FROM bse_clr

WHERE bukrs_clr = mybkpf-bukrs AND

belnr_clr = mybkpf-belnr AND

gjahr_clr = mybkpf-gjahr AND

koart = 'K'. "Выранивание кредитора

IF sy-subrc = 0. "Кредитор

* Определяем позиции фактуры

SELECT * INTO mybse_clr FROM bse_clr

WHERE bukrs_clr = mybkpf-bukrs AND

belnr_clr = mybkpf-belnr AND

gjahr_clr = mybkpf-gjahr AND

koart = 'K'.

SELECT SINGLE xnegp INTO tablesfk-xnegp FROM bseg

WHERE bukrs = mybse_clr-bukrs AND

belnr = mybse_clr-belnr AND

gjahr = mybse_clr-gjahr AND

buzei = mybse_clr-buzei.

* Не платеж

IF ( mybse_clr-shkzg = 'H' AND tablesfk-xnegp = 'X' ) OR

( mybse_clr-shkzg = 'S' AND tablesfk-xnegp = ' ' ).

* if myBSE_CLR-SHKZG = 'S' and tableSfk-xnegp = ' ' .

CONTINUE.

ENDIF.

* Убираем позиции выравнивания

SELECT SINGLE * INTO mybse_clr2 FROM bse_clr

WHERE bukrs_clr = mybse_clr-bukrs AND

belnr_clr = mybse_clr-belnr AND

gjahr_clr = mybse_clr-gjahr AND

koart <> 'S'.

IF sy-subrc <> 0. " Если не документ выравнивания

* Проверяем на обработку документиа фактуры

READ TABLE tablesfk WITH KEY belnr_sfk = mybse_clr-belnr

gjahr_sfk = mybse_clr-gjahr.

IF sy-subrc <> 0. "Документ не найден

tablesfk-belnr_sfk = mybse_clr-belnr.

tablesfk-gjahr_sfk = mybse_clr-gjahr.

tablesfk-fl_storno_zakr_per = fl_storno_zakr_per.

CLEAR: tablesfk-anln1,

tablesfk-anln2,

tablesfk-fl_usl_fi,

tablesfk-txz01,

tablesfk-lifnr.

PERFORM ch_storno_mm_fakt USING tablesfk-belnr_sfk

tablesfk-gjahr_sfk

CHANGING ttt.

IF ttt = 'X'.

CONTINUE.

ENDIF.

IF pr_usl = 'X'. " Если по услугам

PERFORM ch_fakt_fi_nks USING mybkpf-bukrs

tablesfk-belnr_sfk

tablesfk-gjahr_sfk

CHANGING tablesfk-anln1

tablesfk-anln2

tablesfk-txz01

tablesfk-fl_usl_fi.

IF tablesfk-fl_usl_fi = 'X'.

PERFORM ch_klass_os

USING

tablesfk-anln1

tablesfk-anln2

CHANGING

fl_mbp.

IF fl_mbp = 'X'.

CONTINUE.

ENDIF.

SELECT SINGLE lifnr INTO tablesfk-lifnr FROM bseg

WHERE bukrs = mybse_clr-bukrs AND

belnr = mybse_clr-belnr AND

gjahr = mybse_clr-gjahr AND

buzei = mybse_clr-buzei.

ENDIF.

ENDIF.

SELECT SINGLE tcode waers budat

INTO (mytcode,tablesfk-waers,tablesfk-d_sfk)

FROM bkpf

WHERE bukrs = mybkpf-bukrs AND

belnr = tablesfk-belnr_sfk AND

gjahr = tablesfk-gjahr_sfk.

IF ( mytcode = 'MIRO' ) OR

( mytcode = 'MR01' ) OR

( tablesfk-fl_usl_fi = 'X' ).

IF tablesfk-fl_storno_zakr_per = ' '.

PERFORM croplfakt TABLES sodate

USING tablesfk-belnr_sfk

tablesfk-gjahr_sfk

mybse_clr-buzei

emptybelnr

emptygjahr.

ELSE.

PERFORM croplfakt TABLES sodate_old

USING tablesfk-belnr_sfk

tablesfk-gjahr_sfk

mybse_clr-buzei

mybkpf-belnr

mybkpf-gjahr.

ENDIF.

IF tablesfk-fl_usl_fi = 'X'. " Если фактура FI, то НДС

* Определяем сумму оплаты за исключением НДС и НДС

snds = 0.

CLEAR tablesfk-hkont_nds_clr.

SELECT * INTO mybset FROM bset " Сумма НДС

WHERE bukrs = mybkpf-bukrs AND

belnr = tablesfk-belnr_sfk AND

gjahr = tablesfk-gjahr_sfk AND

hwste <> 0.

snds = snds + mybset-hwste.

ENDSELECT.

SELECT SINGLE * INTO mybseg FROM bseg

WHERE bukrs = mybkpf-bukrs AND


Страница: