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

* exit.

* endif.

* endselect.

*

*ENDSELECT. "Mseg & Mkpf

*PERFORM DEL_DOUBLE_FAKTURE.

*

* PERFORM CRDOCMAT.

* Обрабатываем Все движения с ВД 241, чтобы вывести

* все необработанные документы

IF disp_nbr = 'X'.

WRITE: / 'Необработанные д-ты с 241 ВД:'.

SELECT * INTO CORRESPONDING FIELDS OF mymseg

FROM mseg AS mseg INNER JOIN mkpf AS mkpf

ON mseg~mblnr = mkpf~mblnr AND

mseg~mjahr = mkpf~mjahr

WHERE mkpf~budat IN sodate AND

mseg~bwart IN ('241','281').

* mseg~BWART in ('241', 'Z02').

IF mymseg-bwart = '281'. " если СПП

CALL FUNCTION 'Z_KOL_SPP_NAL'

EXPORTING

p_pspnr = mymseg-ps_psp_pnr

IMPORTING

p_anln1 = mymseg-anln1

p_anln2 = mymseg-anln2

EXCEPTIONS

neopr = 1

nespp = 2

nonks = 3

OTHERS = 4.

IF sy-subrc <> 0.

CONTINUE.

ENDIF.

ENDIF.

PERFORM ch_klass_os

USING

mymseg-anln1

mymseg-anln2

CHANGING

fl_mbp.

IF fl_mbp = 'X'. " МБП

CONTINUE.

ENDIF.

* Проверка на сторно

SELECT SINGLE * INTO mymseg2 FROM *mseg

WHERE smbln = mymseg-mblnr AND

sjahr = mymseg-mjahr AND

smblp = mymseg-zeile.

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

READ TABLE table241 WITH KEY mblnr = mymseg-mblnr

mjahr = mymseg-mjahr

zeile = mymseg-zeile.

IF ( sy-subrc <> 0 ). " Не найдено в обраб-х движениях

SELECT SINGLE * INTO mymkpf FROM mkpf

WHERE mblnr = mymseg-mblnr AND

mjahr = mymseg-mjahr.

WRITE: / '241 - ', mymkpf-budat DD/MM/YYYY,

mymseg-mblnr,

mymseg-zeile,

mymseg-matnr NO-ZERO,

mymseg-bwtar,

mymseg-menge,

table241-lifnr.

fl_err = '241'.

ELSE.

IF table241-fl_561 = 'X' . " Старый приход

WRITE: / '561 - ', mymkpf-budat DD/MM/YYYY,

mymseg-menge,

table241-lifnr.

fl_err = '561'.

out_err_mblnr = mymseg-mblnr.

out_err_mgahr = mymseg-mjahr.

HIDE: out_err_mblnr, out_err_mgahr, fl_err.

ENDIF.

IF table241-fl_z02 = 'X' . " ВД Z02

WRITE: / 'Z02 - ', mymkpf-budat DD/MM/YYYY,

mymseg-mblnr,

mymseg-zeile,

mymseg-matnr NO-ZERO,

mymseg-bwtar,

mymseg-menge,

table241-lifnr.

fl_err = '561'.

out_err_mblnr = mymseg-mblnr.

out_err_mgahr = mymseg-mjahr.

HIDE: out_err_mblnr, out_err_mgahr, fl_err.

ENDIF.

ENDIF.

ENDIF. " Не сторно документа материала

ENDSELECT. "Mseg & Mkpf

ENDIF." Вывод необработанных документов

pr_usl = old_pr_usl.

ENDIF. "PR_MAT

SORT tableout BY hkont_main mblnr mjahr zeile.

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

**-------

DATA: extrtext_info(20),

cnterr(10) TYPE p DECIMALS 0.

CONCATENATE sy-datum ' " ' sy-uzeit INTO extrtext_info.

IF c003 = 'X' AND NOT pexrt IS INITIAL.

DATA mzextrheader LIKE zextrheader.

mzextrheader-progid = sy-repid.

mzextrheader-strukid = 'MYTABLEOUT'.

mzextrheader-extrid = pexrt.

mzextrheader-exrttext = extrtext_info.

INSERT INTO zextrheader VALUES mzextrheader.

IF NOT sy-subrc IS INITIAL.

DELETE FROM zextrheader

WHERE progid = mzextrheader-progid

AND strukid = mzextrheader-strukid

AND extrid = mzextrheader-extrid.

IF NOT sy-subrc IS INITIAL.

DELETE FROM zmt59_ext

WHERE progid = mzextrheader-progid

AND strukid = mzextrheader-strukid

AND extrid = mzextrheader-extrid.

ENDIF.

INSERT INTO zextrheader VALUES mzextrheader.

ENDIF.

IF NOT sy-subrc IS INITIAL.

MESSAGE i001(zbasmessage) WITH 'ОшибкаДобавЭкстр' pexrt.

ELSE.

* Если запись в ZEXTRHEADER успешна

DATA mzmt59_ext LIKE zmt59_ext.

MOVE-CORRESPONDING mzextrheader TO mzmt59_ext.

LOOP AT tableout.

MOVE-CORRESPONDING tableout TO mzmt59_ext.

UNPACK sy-tabix TO mzmt59_ext-id_line.

INSERT INTO zmt59_ext VALUES mzmt59_ext.

IF NOT sy-subrc IS INITIAL.

ADD 1 TO cnterr.

ENDIF.

ENDLOOP.

IF NOT cnterr IS INITIAL.

MESSAGE i001(zbasmessage) WITH

cnterr 'Ошибок(и)ДобавПоз' pexrt.

ENDIF.

ENDIF.

ENDIF.

IF c002 = 'X' AND NOT pexrt IS INITIAL.

SELECT * FROM zmt59_ext INTO CORRESPONDING FIELDS OF TABLE tableout

WHERE progid = sy-repid

AND strukid = 'MYTABLEOUT'

AND extrid = pexrt.

ENDIF.


Страница: