FUNCTION-POOL ZFI98. "MESSAGE-ID ..
* RFBIBL02 Include 할것.
* Global data declarations
TABLES : BGR00, " Mappenvorsatz
BBKPF, " Belegkopf + Tcode
BBSEG, " Belegsegment.
BBTAX, " Belegsteuern.
BWITH, " Quellensteuer
BSELK, " Selektionsdaten Kopf
BSELP, " Selektionsdaten Position
BKPF,
BSEG,
TBSL, " Buchungsschl?sel
T041A, " Ausgleichsvorg?ge
T100. " Nachrichten
TABLES : T004F,
TMODF,
TMODG,
TMODO,
TMODP,
TMODU.
DATA : BEGIN OF FTPOST OCCURS 100.
INCLUDE STRUCTURE FTPOST.
DATA : END OF FTPOST.
DATA : BEGIN OF FTCLEAR OCCURS 20.
INCLUDE STRUCTURE FTCLEAR.
DATA : END OF FTCLEAR.
DATA : BEGIN OF FTTAX OCCURS 0.
INCLUDE STRUCTURE FTTAX.
DATA : END OF FTTAX.
DATA : BEGIN OF XBLNTAB OCCURS 2.
INCLUDE STRUCTURE BLNTAB.
DATA : END OF XBLNTAB.
DATA : BEGIN OF SAVE_FTCLEAR.
INCLUDE STRUCTURE FTCLEAR.
DATA : END OF SAVE_FTCLEAR.
*------- Tabelle XTBSL -------------------------------------------------
DATA: BEGIN OF XTBSL OCCURS 10.
INCLUDE STRUCTURE TBSL.
DATA: END OF XTBSL.
*---------------------------------------------------------------------*
* Strukturen
*---------------------------------------------------------------------*
*------- Initialstrukturen --------------------------------------------
DATA: BEGIN OF I_BBKPF.
INCLUDE STRUCTURE BBKPF. " Belegkopf
DATA: END OF I_BBKPF.
DATA: BEGIN OF I_BBSEG.
INCLUDE STRUCTURE BBSEG. " Belegsegment
DATA: END OF I_BBSEG.
DATA: BEGIN OF I_BBTAX.
INCLUDE STRUCTURE BBTAX. " Belegsteuern
DATA: END OF I_BBTAX.
DATA: BEGIN OF I_BSELK.
INCLUDE STRUCTURE BSELK. " Selektionsdaten Kopf
DATA: END OF I_BSELK.
DATA: BEGIN OF I_BSELP.
INCLUDE STRUCTURE BSELP. " Selektionsdaten Position
DATA: END OF I_BSELP.
DATA: BEGIN OF I_BWITH.
INCLUDE STRUCTURE BWITH. " Quellensteuer
DATA: END OF I_BWITH.
*------- Workarea zum Lesen der BI-S?ze -------------------------------
*------- wa, ertab, tfile und efile muessen mindestens so lang sein
*------- wie die laengste Batchinput-Struktur BBSEG + kundeneigene
*------- Felder im Include CI_COBL_BI.
*------- Laenge der BBSEG ohne CI_COBL_BI (Stand 3.0F) 1861 Bytes
DATA: BEGIN OF WA,
CHAR1(3300) TYPE C,
END OF WA.
*---------------------------------------------------------------------*
* Einzelfelder
*---------------------------------------------------------------------*
* B= BDC, C= Call Trans D-DIRECT INPUT
DATA: FUNCTION LIKE RFIPI-FUNCT.
DATA: MODE LIKE RFPDO-ALLGAZMD.
DATA: MSGVN LIKE SY-MSGV1, " Hilfsfeld Message-Variable
MSGID LIKE SY-MSGID,
MSGTY LIKE SY-MSGTY,
MSGNO LIKE SY-MSGNO,
MSGV1 LIKE SY-MSGV1,
MSGV2 LIKE SY-MSGV2,
MSGV3 LIKE SY-MSGV3,
MSGV4 LIKE SY-MSGV4.
DATA: N(2) TYPE N, " Hilfsfeld num.
NODATA(1) TYPE C. " Keine BI-Daten f? Feld
DATA: PREFIX_P LIKE TCURP-PREFIX_P, "price-based rate prefix
PREFIX_M LIKE TCURP-PREFIX_P. "quantity-based rate prefix
DATA: SUBRC LIKE SY-SUBRC, " Subrc
COUNT TYPE I. " Anz. Belege
DATA: XFTCLEAR(1). " Append FTCLEAR durchfuehren?
DATA: FL_CHECK LIKE RFPDO-RFBICHCK. " Datei nur pr?en
DATA: T_DD03L LIKE DD03L OCCURS 0 WITH HEADER LINE.
DATA: IT_PARTIAL LIKE ZSFI0999 OCCURS 0 WITH HEADER LINE.
*-- BDC
DATA : BDCDATA TYPE BDCDATA OCCURS 0 WITH HEADER LINE.
DATA : MESSTAB TYPE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : GV_MSGST. "MESSAGE STORE
DATA : GV_BDCMODE LIKE RFPDO-ALLGAZMD VALUE 'N', "BDC Mode
GV_BDCUP LIKE RFPDO-ALLGVBMD VALUE 'S'. "BDC Update
INCLUDE RFBIBL02 .
1. Z_FI_POSTING_DOCUMENT
FUNCTION Z_FI_POSTING_DOCUMENT.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" REFERENCE(I_BBKPF) LIKE BBKPF STRUCTURE BBKPF
*" REFERENCE(I_BDCMODE) LIKE RFPDO-ALLGAZMD DEFAULT 'N'
*" REFERENCE(I_TCODE) LIKE SY-TCODE
*" REFERENCE(I_NODATA) TYPE NO_CCHECK DEFAULT '/'
*" REFERENCE(I_CLRMODE) TYPE DDENQINFO OPTIONAL
*" REFERENCE(I_MSGSTORE) TYPE XFELD OPTIONAL
*" EXPORTING
*" REFERENCE(E_BUKRS) TYPE BUKRS
*" REFERENCE(E_BELNR) TYPE BELNR_D
*" REFERENCE(E_GJAHR) TYPE GJAHR
*" REFERENCE(E_MESSAGE) TYPE MSGTXT
*" TABLES
*" T_BBSEG STRUCTURE BBSEG OPTIONAL
*" T_BBTAX STRUCTURE BBTAX OPTIONAL
*" T_BWITH STRUCTURE BWITH OPTIONAL
*" T_FTCLEAR STRUCTURE FTCLEAR OPTIONAL
*"----------------------------------------------------------------------
* Global data declarations
* Global data declarations
REFRESH : FTPOST, FTTAX, XBLNTAB.
CLEAR : FTPOST, FTTAX, XBLNTAB,
E_BUKRS, E_BELNR, E_GJAHR.
MODE = I_BDCMODE.
NODATA = I_NODATA.
GV_MSGST = I_MSGSTORE.
*-- FTCLEAR St. CLEARING
* AGKOA - 계정유형
* AGKON - 계정
* AGBUK - 회사코드
* XNOPS - 'X' 정상미결항목
* AGUMS - 특별 G/L 지시자
* SELFD - 'BELNR'
* SELVON - BELNR+GJAHR+BUZEI
*-- Initial Field
PERFORM GET_FIELD_INFO.
*-- Header
CLEAR BBKPF.
BBKPF = I_BBKPF.
BBKPF-STYPE = '1'.
IF BBKPF-TCODE = SPACE.
BBKPF-TCODE = I_TCODE.
ENDIF.
IF BBKPF-TCODE = 'FB05'.
CASE I_CLRMODE.
WHEN 1.
BBKPF-AUGLV = 'AUSGZAHL'.
WHEN 2.
BBKPF-AUGLV = 'EINGZAHL'.
WHEN 3.
BBKPF-AUGLV = 'GUTSCHRI'.
WHEN 4.
BBKPF-AUGLV = 'UMBUCHNG'.
ENDCASE.
IF NOT T_FTCLEAR[] IS INITIAL.
FTCLEAR[] = T_FTCLEAR[].
ENDIF.
ENDIF.
*-- CHANGE TYPE FOR USER SETTING
PERFORM BBKPF_USER_SETTING USING BBKPF.
PERFORM FILL_HEADER USING BBKPF.
*-- ITEM
PERFORM FILL_ITEM TABLES T_BBSEG.
*-- VAT TAX
IF NOT T_BBTAX[] IS INITIAL.
PERFORM FILL_TAX TABLES T_BBTAX.
ENDIF.
*-- WITHHOLDING TAX
IF NOT T_BWITH[] IS INITIAL.
PERFORM FILL_WITH TABLES T_BWITH.
ENDIF.
PERFORM POSTING_DOCUMENT CHANGING E_BUKRS
E_BELNR
E_GJAHR
E_MESSAGE.
ENDFUNCTION.
2. Z_FI_REVERSE_DOCUMENT
FUNCTION Z_FI_REVERSE_DOCUMENT.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" REFERENCE(I_BUKRS) TYPE BUKRS
*" REFERENCE(I_BELNR) TYPE BELNR_D
*" REFERENCE(I_GJAHR) TYPE GJAHR
*" REFERENCE(I_STGRD) TYPE STGRD
*" REFERENCE(I_BUDAT) TYPE BUDAT OPTIONAL
*" REFERENCE(I_MONAT) TYPE MONAT OPTIONAL
*" REFERENCE(I_VOIDR) TYPE RF05A-VOIDR OPTIONAL
*" REFERENCE(I_MODE) TYPE RFPDO-ALLGAZMD DEFAULT 'N'
*" REFERENCE(I_MSGSTORE) TYPE XFELD OPTIONAL
*" EXPORTING
*" REFERENCE(E_MESSAGE) TYPE MSGTXT
*" REFERENCE(E_RESULT) TYPE BAPI_MTYPE
*" REFERENCE(E_STBLG) TYPE STBLG
*" REFERENCE(E_STJAH) TYPE STJAH
*"----------------------------------------------------------------------
* Global data declarations
* Global data declarations
DATA: LT_BLNTAB LIKE BLNTAB OCCURS 0 WITH HEADER LINE,
BEGIN OF LS_MESS,
MSGID LIKE SY-MSGID,
MSGNO LIKE SY-MSGNO,
MSGTY LIKE SY-MSGTY,
MSGV1 LIKE SY-MSGV1,
MSGV2 LIKE SY-MSGV2,
MSGV3 LIKE SY-MSGV3,
MSGV4 LIKE SY-MSGV4,
SUBRC LIKE SY-SUBRC,
END OF LS_MESS.
DATA: LV_BUDAT LIKE BKPF-BUDAT.
GV_MSGST = I_MSGSTORE.
SELECT SINGLE BUDAT INTO LV_BUDAT
FROM BKPF
WHERE BUKRS = I_BUKRS
AND BELNR = I_BELNR
AND GJAHR = I_GJAHR.
IF SY-SUBRC NE 0.
RAISE NO_BELNR.
ENDIF.
CLEAR : LT_BLNTAB, LT_BLNTAB[], LS_MESS.
CALL FUNCTION 'POSTING_INTERFACE_START'
EXPORTING
I_FUNCTION = 'C'
I_MODE = I_MODE.
CALL FUNCTION 'POSTING_INTERFACE_REVERSE_DOC'
EXPORTING
I_BELNS = I_BELNR
I_BUDAT = I_BUDAT
I_BUKRS = I_BUKRS
I_GJAHS = I_GJAHR
I_TCODE = 'FB08'
I_STGRD = I_STGRD
I_MONAT = I_MONAT
I_VOIDR = I_VOIDR
I_NO_AUTH = 'X'
IMPORTING
E_MSGID = LS_MESS-MSGID
E_MSGNO = LS_MESS-MSGNO
E_MSGTY = LS_MESS-MSGTY
E_MSGV1 = LS_MESS-MSGV1
E_MSGV2 = LS_MESS-MSGV2
E_MSGV3 = LS_MESS-MSGV3
E_MSGV4 = LS_MESS-MSGV4
E_SUBRC = LS_MESS-SUBRC
TABLES
T_BLNTAB = LT_BLNTAB
EXCEPTIONS
TRANSACTION_CODE_INVALID = 1
NO_AUTHORIZATION = 2
OTHERS = 3.
IF SY-SUBRC = 0 AND NOT LT_BLNTAB[] IS INITIAL.
E_RESULT = 'S'.
LOOP AT LT_BLNTAB.
E_STBLG = LT_BLNTAB-BELNR.
E_STJAH = LT_BLNTAB-GJAHR.
ENDLOOP.
ELSE.
E_RESULT = 'E'.
ENDIF.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
MSGID = LS_MESS-MSGID
MSGNR = LS_MESS-MSGNO
MSGV1 = LS_MESS-MSGV1
MSGV2 = LS_MESS-MSGV2
MSGV3 = LS_MESS-MSGV3
MSGV4 = LS_MESS-MSGV4
IMPORTING
MESSAGE_TEXT_OUTPUT = E_MESSAGE.
IF GV_MSGST = 'X'.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
ARBGB = LS_MESS-MSGID
MSGTY = LS_MESS-MSGTY
MSGV1 = LS_MESS-MSGV1
MSGV2 = LS_MESS-MSGV2
MSGV3 = LS_MESS-MSGV3
MSGV4 = LS_MESS-MSGV4
TXTNR = LS_MESS-MSGNO
EXCEPTIONS
OTHERS = 1.
ENDIF.
CALL FUNCTION 'POSTING_INTERFACE_END'.
IF E_RESULT = 'E'.
IF E_MESSAGE = SPACE.
E_MESSAGE = TEXT-M01. "역분개를 실패했습니다.
ENDIF.
ENDIF.
ENDFUNCTION.
3. Z_FI_PARTIAL_CLEARING_DOC
FUNCTION Z_FI_PARTIAL_CLEARING_DOC.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" REFERENCE(I_BBKPF) LIKE BBKPF STRUCTURE BBKPF
*" REFERENCE(I_BDCMODE) LIKE RFPDO-ALLGAZMD DEFAULT 'N'
*" REFERENCE(I_TCODE) LIKE SY-TCODE
*" REFERENCE(I_NODATA) TYPE NO_CCHECK DEFAULT '/'
*" REFERENCE(I_CLRMODE) TYPE DDENQINFO
*" REFERENCE(I_MSGSTORE) TYPE XFELD OPTIONAL
*" EXPORTING
*" REFERENCE(E_BUKRS) TYPE BUKRS
*" REFERENCE(E_BELNR) TYPE BELNR_D
*" REFERENCE(E_GJAHR) TYPE GJAHR
*" REFERENCE(E_MESSAGE) TYPE MSGTXT
*" TABLES
*" T_BBSEG STRUCTURE BBSEG OPTIONAL
*" T_FTCLEAR STRUCTURE FTCLEAR OPTIONAL
*" T_PARTIAL STRUCTURE ZSFI0999 OPTIONAL
*"----------------------------------------------------------------------
* Global data declarations
* Global data declarations
REFRESH : FTPOST, FTTAX, XBLNTAB.
CLEAR : FTPOST, FTTAX, XBLNTAB,
E_BUKRS, E_BELNR, E_GJAHR.
MODE = I_BDCMODE.
NODATA = I_NODATA.
GV_MSGST = I_MSGSTORE.
*-- FTCLEAR St. CLEARING
* AGKOA - 계정유형
* AGKON - 계정
* AGBUK - 회사코드
* XNOPS - 'X' 정상미결항목
* AGUMS - 특별 G/L 지시자
* SELFD - 'BELNR'
* SELVON - BELNR+GJAHR+BUZEI
*-- T_PARTIAL
* L_ABPOS = L_ABPOS + 1.
* IT_PART-BUKRS = BSID-BUKRS.
* IT_PART-BELNR = BSID-BELNR.
* IT_PART-BUDAT = BSID-BUDAT.
* IT_PART-BUZEI = BSID-BUZEI.
* IT_PART-ABPOS = L_ABPOS.
* IT_PART-XAKTP = 'X'.
* IT_PART-WAERS = BSID-WAERS.
* IT_PART-PSZAH = BSID-WRBTR. 반제 할 금액
* APPEND IT_PART.
*-------
*-- Initial Field
PERFORM GET_FIELD_INFO.
*-- Header
CLEAR BBKPF.
BBKPF = I_BBKPF.
BBKPF-STYPE = '1'.
IF BBKPF-TCODE = SPACE.
BBKPF-TCODE = I_TCODE.
ENDIF.
IF BBKPF-TCODE = 'FB05'.
CASE I_CLRMODE.
WHEN 1.
BBKPF-AUGLV = 'AUSGZAHL'.
WHEN 2.
BBKPF-AUGLV = 'EINGZAHL'.
WHEN 3.
BBKPF-AUGLV = 'GUTSCHRI'.
WHEN 4.
BBKPF-AUGLV = 'UMBUCHNG'.
ENDCASE.
IF NOT T_FTCLEAR[] IS INITIAL.
CLEAR : IT_PARTIAL[], IT_PARTIAL, FTCLEAR[], FTCLEAR.
FTCLEAR[] = T_FTCLEAR[].
IT_PARTIAL[] = T_PARTIAL[].
ENDIF.
ENDIF.
*-- CHANGE TYPE FOR USER SETTING
PERFORM BBKPF_USER_SETTING USING BBKPF.
PERFORM FILL_HEADER USING BBKPF.
*-- ITEM
PERFORM FILL_ITEM TABLES T_BBSEG.
PERFORM CLEARING_DOCUMENT CHANGING E_BUKRS
E_BELNR
E_GJAHR
E_MESSAGE.
ENDFUNCTION.
*----------------------------------------------------------------------*
***INCLUDE LZFI98F01 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form FILL_NODATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM FILL_NODATA USING P_TABNAME.
DATA LV_FIELDNAME(20).
FIELD-SYMBOLS <B>.
SORT T_DD03L BY POSITION.
LOOP AT T_DD03L WHERE TABNAME = P_TABNAME.
CONCATENATE T_DD03L-TABNAME '-' T_DD03L-FIELDNAME
INTO LV_FIELDNAME.
ASSIGN (LV_FIELDNAME) TO <B>.
IF LV_FIELDNAME = 'BBSEG-VALUT' AND BBSEG-VALUT = '00000000'.
MOVE NODATA TO <B>.
ENDIF.
IF LV_FIELDNAME = 'BBSEG-ZFBDT' AND BBSEG-ZFBDT = '00000000'.
MOVE NODATA TO <B>.
ENDIF.
IF LV_FIELDNAME = 'BBSEG-ZBD1T' AND BBSEG-ZBD1T = '000'.
MOVE NODATA TO <B>.
ENDIF.
IF LV_FIELDNAME = 'BBSEG-AUFNR' AND BBSEG-AUFNR = '000000000000'.
MOVE NODATA TO <B>.
ENDIF.
IF LV_FIELDNAME = 'BBSEG-REBZJ' AND BBSEG-REBZJ = '0000000000'.
MOVE NODATA TO <B>.
ENDIF.
IF LV_FIELDNAME = 'BBSEG-PROJK' AND BBSEG-PROJK = '00000000'.
MOVE NODATA TO <B>.
ENDIF.
IF LV_FIELDNAME = 'BBKPF-XBWAE' AND BBKPF-XBWAE = ''.
IF BBKPF-TCODE = 'FBV1'.
DATA : LV_WAERS LIKE T001-WAERS.
SELECT SINGLE WAERS INTO LV_WAERS
FROM T001 WHERE BUKRS = BBKPF-BUKRS.
IF LV_WAERS <> BBKPF-WAERS.
<B> = '!'.
ENDIF.
ENDIF.
ENDIF.
** //TAX CODE가 빈란일때 "**"로 들어가는 부분 SPACE로 들어가도록 수정
** BY CEY 2013.06.13 세금코드가 없는화면에서 오류가 발생되어 일단 원복함.
* IF LV_FIELDNAME = 'BBSEG-MWSKZ' AND BBSEG-MWSKZ = ''.
* <B> = '!'.
* ENDIF.
**/
IF <B> IS INITIAL.
<B> = NODATA.
ELSEIF <B> = '!'.
<B> = ' '.
ENDIF.
ENDLOOP.
ENDFORM. " FILL_NODATA
*&---------------------------------------------------------------------*
*& Form FILL_HEADER
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM FILL_HEADER USING BBKPF LIKE BBKPF.
PERFORM FILL_NODATA USING 'BBKPF'.
PERFORM FILL_FTPOST_WITH_BBKPF_DATA.
IF NODATA = '/'.
IF BBKPF-KURSF+1(2) NE SPACE.
CLEAR: FTPOST-FNAM, FTPOST-FVAL.
FTPOST-FNAM = 'BKPF-KURSF'.
CONCATENATE PREFIX_P BBKPF-KURSF INTO FTPOST-FVAL.
APPEND FTPOST.
ENDIF.
ENDIF.
ENDFORM. " FILL_HEADER
*&---------------------------------------------------------------------*
*& Form FILL_ITEM
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM FILL_ITEM TABLES FT_BSEG STRUCTURE BBSEG.
CLEAR COUNT.
LOOP AT FT_BSEG.
CLEAR : BBSEG, XTBSL[], XTBSL.
MOVE FT_BSEG TO BBSEG.
*-- CHANGE TYPE FOR USER SETTING START : 2012.03.16
PERFORM CHANGE_DATE_USER CHANGING : BBSEG-VALUT,
BBSEG-ZFBDT,
BBSEG-FDTAG,
BBSEG-BZDAT,
BBSEG-ZOLLD,
BBSEG-VRSDT,
BBSEG-MADAT,
BBSEG-WDATE,
BBSEG-DABRZ,
BBSEG-VALID_FROM,
BBSEG-DATEOFSERVICE.
*-- CHANGE TYPE FOR USER SETTING END
BBSEG-STYPE = '2'.
BBSEG-TBNAM = 'BBSEG'.
PERFORM FILL_NODATA USING 'BBSEG'.
COUNT = COUNT + 1.
SELECT * FROM TBSL INTO TABLE XTBSL
WHERE BSCHL = FT_BSEG-NEWBS.
READ TABLE XTBSL INDEX 1.
PERFORM FILL_FTPOST_WITH_BBSEG_DATA USING COUNT.
ENDLOOP.
ENDFORM. " FILL_ITEM
*&---------------------------------------------------------------------*
*& Form FILL_TAX
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM FILL_TAX TABLES FT_BTAX STRUCTURE BBTAX.
LOOP AT FT_BTAX.
CLEAR BBTAX.
MOVE FT_BTAX TO BBTAX.
BBTAX-STYPE = '2'.
BBTAX-TBNAM = 'BBTAX'.
PERFORM FILL_NODATA USING 'BBTAX'.
PERFORM FILL_FTTAX_WITH_BBTAX_DATA.
ENDLOOP.
ENDFORM. " FILL_TAX
*&---------------------------------------------------------------------*
*& Form FILL_WITH
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM FILL_WITH TABLES FT_WITH STRUCTURE BWITH.
CLEAR COUNT.
LOOP AT FT_WITH.
CLEAR BWITH.
MOVE FT_WITH TO BWITH.
BWITH-STYPE = '2'.
BWITH-TBNAM = 'BWITH'.
PERFORM FILL_NODATA USING 'BWITH'.
COUNT = COUNT + 1.
PERFORM FILL_FTPOST_WITH_BWITH_DATA USING COUNT.
ENDLOOP.
ENDFORM. " FILL_WITH
*&---------------------------------------------------------------------*
*& Form POSTING_DOCUMENT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM POSTING_DOCUMENT CHANGING FV_BUKRS
FV_BELNR
FV_GJAHR
FV_MESSAGE.
CALL FUNCTION 'POSTING_INTERFACE_START'
EXPORTING
I_FUNCTION = 'C'
I_MODE = MODE
I_UPDATE = 'S'
EXCEPTIONS
CLIENT_INCORRECT = 1
FUNCTION_INVALID = 2
GROUP_NAME_MISSING = 3
MODE_INVALID = 4
UPDATE_INVALID = 5
OTHERS = 6.
IF BBKPF-TCODE = 'FB01'
OR BBKPF-TCODE = 'FBB1' "P30K125019
OR BBKPF-TCODE = 'FBS1'
OR BBKPF-TCODE = 'FBV1'
OR BBKPF-TCODE = 'FB41'. "4.0
CALL FUNCTION 'POSTING_INTERFACE_DOCUMENT'
EXPORTING
I_TCODE = BBKPF-TCODE
I_NO_AUTH = 'X'
IMPORTING
E_SUBRC = SUBRC
E_MSGID = MSGID
E_MSGTY = MSGTY
E_MSGNO = MSGNO
E_MSGV1 = MSGV1
E_MSGV2 = MSGV2
E_MSGV3 = MSGV3
E_MSGV4 = MSGV4
TABLES
T_FTPOST = FTPOST
T_FTTAX = FTTAX
T_BLNTAB = XBLNTAB
EXCEPTIONS
OTHERS = 1.
ELSEIF BBKPF-TCODE = 'FB05'.
IF NOT XFTCLEAR IS INITIAL.
FTCLEAR = SAVE_FTCLEAR.
APPEND FTCLEAR.
ENDIF.
CALL FUNCTION 'POSTING_INTERFACE_CLEARING'
EXPORTING
I_AUGLV = BBKPF-AUGLV
I_TCODE = BBKPF-TCODE
IMPORTING
E_SUBRC = SUBRC
E_MSGID = MSGID
E_MSGTY = MSGTY
E_MSGNO = MSGNO
E_MSGV1 = MSGV1
E_MSGV2 = MSGV2
E_MSGV3 = MSGV3
E_MSGV4 = MSGV4
TABLES
T_FTPOST = FTPOST
T_FTCLEAR = FTCLEAR
T_FTTAX = FTTAX
T_BLNTAB = XBLNTAB
EXCEPTIONS
OTHERS = 1.
ENDIF.
READ TABLE XBLNTAB INDEX 1.
IF SY-SUBRC = 0.
FV_BELNR = XBLNTAB-BELNR.
FV_BUKRS = XBLNTAB-BUKRS.
FV_GJAHR = XBLNTAB-GJAHR.
ENDIF.
DATA : LV_MESSAGE LIKE CFGNL-MSGLIN.
CALL FUNCTION 'RKC_MSG_STRING' "#EC *
EXPORTING
ID = MSGID
MTYPE = MSGTY
NUMBER = MSGNO
PAR1 = MSGV1
PAR2 = MSGV2
PAR3 = MSGV3
PAR4 = MSGV4
IMPORTING
MSG_LIN = LV_MESSAGE.
FV_MESSAGE = LV_MESSAGE.
* FS_RETURN-TYPE = MSGTY.
* FS_RETURN-ID = MSGID.
* FS_RETURN-NUMBER = MSGNO.
IF GV_MSGST = 'X'.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
ARBGB = MSGID
MSGTY = MSGTY
MSGV1 = MSGV1
MSGV2 = MSGV2
MSGV3 = MSGV3
MSGV4 = MSGV4
TXTNR = MSGNO
EXCEPTIONS
OTHERS = 1.
ENDIF.
REFRESH: FTPOST, FTCLEAR, FTTAX, XBLNTAB.
CLEAR: FTPOST, FTCLEAR, FTTAX, XBLNTAB.
ENDFORM. " POSTING_DOCUMENT
*&---------------------------------------------------------------------*
*& Form GET_FIELD_INFO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM GET_FIELD_INFO .
CLEAR: T_DD03L, T_DD03L[].
SELECT * FROM DD03L INTO TABLE T_DD03L
WHERE TABNAME IN ('BBKPF','BBSEG','BBTAX','BWITH')
AND AS4LOCAL = 'A'.
ENDFORM. " GET_FIELD_INFO
*&---------------------------------------------------------------------*
*& Form CLEARING_DOCUMENT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM CLEARING_DOCUMENT CHANGING FV_BUKRS
FV_BELNR
FV_GJAHR
FV_MESSAGE.
IF NOT XFTCLEAR IS INITIAL.
FTCLEAR = SAVE_FTCLEAR.
APPEND FTCLEAR.
ENDIF.
CALL FUNCTION 'ZFI_POSTING_IF_START'
CALL FUNCTION 'POSTING_INTERFACE_START'
EXPORTING
I_FUNCTION = 'C'
I_MODE = MODE
I_UPDATE = 'S'
EXCEPTIONS
CLIENT_INCORRECT = 1
FUNCTION_INVALID = 2
GROUP_NAME_MISSING = 3
MODE_INVALID = 4
UPDATE_INVALID = 5
OTHERS = 6.
CALL FUNCTION 'ZFI_POSTING_IF_CLEARING'
CALL FUNCTION 'POSTING_INTERFACE_CLEARING'
EXPORTING
I_AUGLV = BBKPF-AUGLV
I_TCODE = BBKPF-TCODE
IMPORTING
E_SUBRC = SUBRC
E_MSGID = MSGID
E_MSGTY = MSGTY
E_MSGNO = MSGNO
E_MSGV1 = MSGV1
E_MSGV2 = MSGV2
E_MSGV3 = MSGV3
E_MSGV4 = MSGV4
TABLES
T_FTPOST = FTPOST
T_FTCLEAR = FTCLEAR
T_FTTAX = FTTAX
T_BLNTAB = XBLNTAB
T_PARTIAL = IT_PARTIAL
EXCEPTIONS
OTHERS = 1.
READ TABLE XBLNTAB INDEX 1.
IF SY-SUBRC = 0.
FV_BELNR = XBLNTAB-BELNR.
FV_BUKRS = XBLNTAB-BUKRS.
FV_GJAHR = XBLNTAB-GJAHR.
ENDIF.
DATA : LV_MESSAGE LIKE CFGNL-MSGLIN.
CALL FUNCTION 'RKC_MSG_STRING' "#EC *
EXPORTING
ID = MSGID
MTYPE = MSGTY
NUMBER = MSGNO
PAR1 = MSGV1
PAR2 = MSGV2
PAR3 = MSGV3
PAR4 = MSGV4
IMPORTING
MSG_LIN = LV_MESSAGE.
FV_MESSAGE = LV_MESSAGE.
IF GV_MSGST = 'X'.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
ARBGB = MSGID
MSGTY = MSGTY
MSGV1 = MSGV1
MSGV2 = MSGV2
MSGV3 = MSGV3
MSGV4 = MSGV4
TXTNR = MSGNO
EXCEPTIONS
OTHERS = 1.
ENDIF.
REFRESH: FTPOST, FTCLEAR, FTTAX, XBLNTAB, IT_PARTIAL.
CLEAR: FTPOST, FTCLEAR, FTTAX, XBLNTAB, IT_PARTIAL.
ENDFORM. " CLEARING_DOCUMENT
*&---------------------------------------------------------------------*
*& Form READ_USER_SETTING
*&---------------------------------------------------------------------*
FORM BBKPF_USER_SETTING USING P_BBKPF LIKE BBKPF.
PERFORM CHANGE_KURSF_USER CHANGING P_BBKPF-KURSF.
PERFORM CHANGE_DATE_USER CHANGING : P_BBKPF-BUDAT ,
P_BBKPF-BLDAT ,
P_BBKPF-WWERT ,
P_BBKPF-STODT ,
P_BBKPF-VATDATE .
ENDFORM. " READ_USER_SETTING
*&---------------------------------------------------------------------*
*& Form CHANGE_DATE_USER
*&---------------------------------------------------------------------*
FORM CHANGE_DATE_USER CHANGING P_DATE.
DATA: LV_TDAT8 TYPE CHAR10,
LV_IDATE TYPE SY-DATUM.
LV_IDATE = P_DATE.
CALL FUNCTION 'DATUMSAUFBEREITUNG'
EXPORTING
IDATE = LV_IDATE
IMPORTING
TDAT8 = LV_TDAT8.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
EXIT.
ENDIF.
TRANSLATE LV_TDAT8 USING ', . : - / _ '.
CONDENSE LV_TDAT8 NO-GAPS.
P_DATE = LV_TDAT8.
ENDFORM. " CHANGE_DATE_USER
*&---------------------------------------------------------------------*
*& Form CHANGE_KURSF_USER
*&---------------------------------------------------------------------*
FORM CHANGE_KURSF_USER CHANGING P_KURSF.
DATA : LV_KURSF LIKE BKPF-KURSF,
LV_CHAR TYPE BBKPF-KURSF.
LV_KURSF = P_KURSF.
WRITE LV_KURSF TO LV_CHAR.
CONDENSE LV_CHAR NO-GAPS.
P_KURSF = LV_CHAR.
ENDFORM. " CHANGE_KURSF_USER
*&---------------------------------------------------------------------*
*& Form PARK_ENJOY_SCREEN_CHECKING
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM PARK_ENJOY_SCREEN_CHECKING USING P_PI_BUKRS
P_PI_BELNR
P_PI_GJAHR
CHANGING P_LV_ISENJOY
P_LV_ENJSCRNO.
DATA: LV_TCODE LIKE BKPF-TCODE.
SELECT TCODE
INTO LV_TCODE
FROM BKPF
WHERE BUKRS = P_PI_BUKRS
AND BELNR = P_PI_BELNR
AND GJAHR = P_PI_GJAHR.
ENDSELECT.
*. T-Code
* FBV1
* FB01
* EnJoy
* FB50 G/L 1001
* FV50 G/L 1001
* FB60 AP 1100
* FV60 AP 1100
* FB70 AR 1200
* FV70 AR 1200
CASE LV_TCODE(3).
WHEN 'FB0' OR 'FBV'.
P_LV_ISENJOY = ''.
P_LV_ENJSCRNO = '0700'.
WHEN 'FB5' OR 'FV5'.
P_LV_ISENJOY = 'X'.
P_LV_ENJSCRNO = '1001'.
WHEN 'FB6' OR 'FV6'.
P_LV_ISENJOY = 'X'.
P_LV_ENJSCRNO = '1100'.
WHEN 'FB7' OR 'FV7'.
P_LV_ISENJOY = 'X'.
P_LV_ENJSCRNO = '1200'.
ENDCASE.
ENDFORM. " PARK_ENJOY_SCREEN_CHECKING
*&---------------------------------------------------------------------*
*& Form DYNPRO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM DYNPRO TABLES LT_BDC STRUCTURE BDCDATA
USING P_DYNBEGIN P_NAME P_VALUE.
IF P_DYNBEGIN = 'X'.
MOVE : P_NAME TO LT_BDC-PROGRAM,
P_VALUE TO LT_BDC-DYNPRO,
'X' TO LT_BDC-DYNBEGIN.
APPEND LT_BDC. CLEAR LT_BDC.
ELSE.
MOVE : P_NAME TO LT_BDC-FNAM,
P_VALUE TO LT_BDC-FVAL.
APPEND LT_BDC. CLEAR LT_BDC.
ENDIF.
ENDFORM. "DYNPRO
*&---------------------------------------------------------------------*
*& Form BDC_Message_Find
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM BDC_MESSAGE_FIND USING PA_MSGTYP
PA_MSGID
PA_MSGNR
CHANGING PA_MSG
PA_EXIST.
CLEAR: PA_EXIST, PA_MSG.
READ TABLE MESSTAB WITH KEY MSGTYP = PA_MSGTYP
MSGID = PA_MSGID
MSGNR = PA_MSGNR.
IF SY-SUBRC = 0.
PA_EXIST = 'S'.
ELSE.
PA_EXIST = 'E'.
READ TABLE MESSTAB WITH KEY MSGTYP = 'E'.
ENDIF.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
MSGID = MESSTAB-MSGID
MSGNR = MESSTAB-MSGNR
MSGV1 = MESSTAB-MSGV1
MSGV2 = MESSTAB-MSGV2
MSGV3 = MESSTAB-MSGV3
MSGV4 = MESSTAB-MSGV4
IMPORTING
MESSAGE_TEXT_OUTPUT = PA_MSG.
ENDFORM. "BDC_Message_Find
댓글 없음:
댓글 쓰기