* 대체할 필드가 제외되어 없을 경우
Go to transaction GB01 or transaction SM30 > view VWTYGB01
and maintain it to add fields in class 9 (Document header and line items (FI) and type S (Refer to fields that can be substituted)
Remove the tick in the checkbox "Exclude" againest your relevant field.
위 작업을 한후 RGUGBR00 프로그램을 실행하여 active한다.
PROGRAM ZRGGBR000 .
*---------------------------------------------------------------------*
* *
* Regeln: EXIT-Formpool for Uxxx-Exits *
* *
* This formpool is used by SAP for demonstration purposes only. *
* *
* Note: If you define a new user exit, you have to enter your *
* user exit in the form routine GET_EXIT_TITLES. *
* *
*---------------------------------------------------------------------*
INCLUDE FGBBGD00. "Data types
*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*
* PLEASE INCLUDE THE FOLLOWING "TYPE-POOL" AND "TABLES" COMMANDS *
* IF THE ACCOUNTING MODULE IS INSTALLED IN YOUR SYSTEM *
*TYPE-POOLS: GB002. " TO BE INCLUDED IN
*TABLES: BKPF, " ANY SYSTEM THAT
* BSEG, " HAS 'FI' INSTALLED
* COBL,
* GLU1.
*ENHANCEMENT-POINT RGGBR000_01 SPOTS ES_RGGBR000 STATIC.
*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*
*----------------------------------------------------------------------*
* FORM GET_EXIT_TITLES *
*----------------------------------------------------------------------*
* returns name and title of all available standard-exits *
* every exit in this formpool has to be added to this form. *
* You have to specify a parameter type in order to enable the *
* code generation program to determine correctly how to *
* generate the user exit call, i.e. how many and what kind of *
* parameter(s) are used in the user exit. *
* The following parameter types exist: *
* *
* TYPE Description Usage *
* ------------------------------------------------------------ *
* C_EXIT_PARAM_NONE Use no parameter Subst. and Valid. *
* except B_RESULT *
* C_EXIT_PARAM_CLASS Use a type as parameter Subst. and Valid *
*----------------------------------------------------------------------*
* --> EXIT_TAB table with exit-name and exit-titles *
* structure: NAME(5), PARAM(1), TITEL(60)
*----------------------------------------------------------------------*
FORM GET_EXIT_TITLES TABLES ETAB.
DATA: BEGIN OF EXITS OCCURS 50,
NAME(5) TYPE C,
PARAM LIKE C_EXIT_PARAM_NONE,
TITLE(60) TYPE C,
END OF EXITS.
*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* PLEASE DELETE THE FIRST '*' FORM THE BEGINING OF THE FOLLOWING LINES *
* IF THE ACCOUNTING MODULE IS INSTALLED IN YOUR SYSTEM: *
* EXITS-NAME = 'U101'.
* EXITS-PARAM = C_EXIT_PARAM_CLASS.
* EXITS-TITLE = TEXT-100. "Posting date check
* APPEND EXITS.
EXITS-NAME = 'U100'.
EXITS-PARAM = C_EXIT_PARAM_NONE. "Complete data used in exit.
EXITS-TITLE = TEXT-101. "Posting date check
APPEND EXITS.
* forms for SAP_EIS
EXITS-NAME = 'US001'. "single validation: only one
EXITS-PARAM = C_EXIT_PARAM_NONE. "data record used
EXITS-TITLE = TEXT-102. "Example EIS
APPEND EXITS.
EXITS-NAME = 'UM001'. "matrix validation:
EXITS-PARAM = C_EXIT_PARAM_CLASS. "complete data used in exit.
EXITS-TITLE = TEXT-103. "Example EIS
APPEND EXITS.
" 예산 통제(코스트센터 / 오더 )
EXITS-NAME = 'U200'. "유효성 체크
EXITS-PARAM = C_EXIT_PARAM_CLASS.
EXITS-TITLE = TEXT-200.
APPEND EXITS.
" 선급비용/선수수익 전표 역분개시 유효성체크
EXITS-NAME = 'U300'. "유효성 체크
EXITS-PARAM = C_EXIT_PARAM_CLASS.
EXITS-TITLE = TEXT-300.
APPEND EXITS.
* Item : 증빙일자 마감 점검
* 전표-증빙첨부서번호 점검
EXITS-NAME = 'U701'.
EXITS-PARAM = C_EXIT_PARAM_NONE.
EXITS-TITLE = TEXT-701.
APPEND EXITS.
" 조정임시계정 점검
EXITS-NAME = 'U702'.
* EXITS-PARAM = C_EXIT_PARAM_CLASS. "전표완료
* EXITS-PARAM = C_EXIT_PARAM_FIELD.
EXITS-PARAM = C_EXIT_PARAM_NONE. "전표라인
EXITS-TITLE = TEXT-201.
APPEND EXITS.
" Check reversal availability(역분개가능여부 점검)
EXITS-NAME = 'U703'.
EXITS-PARAM = C_EXIT_PARAM_NONE. "전표라인
EXITS-TITLE = TEXT-703.
APPEND EXITS.
" 세율에 따른 허용 범위 검사 Tax tolerance has been exceeded.
EXITS-NAME = 'U800'.
* EXITS-PARAM = C_EXIT_PARAM_CLASS. "전표완료
* EXITS-PARAM = C_EXIT_PARAM_FIELD.
EXITS-PARAM = C_EXIT_PARAM_NONE. "전표라인
EXITS-TITLE = TEXT-800.
APPEND EXITS.
" Payment Block 변경시 사용자 Role체크
EXITS-NAME = 'U301'. "유효성 체크
EXITS-PARAM = C_EXIT_PARAM_NONE. "전표라인
EXITS-TITLE = TEXT-301.
APPEND EXITS.
" Check Account ID for Bank Account
EXITS-NAME = 'U302'. "유효성 체크
EXITS-PARAM = C_EXIT_PARAM_NONE. "전표라인
EXITS-TITLE = TEXT-302.
APPEND EXITS.
***********************************************************************
** EXIT EXAMPLES FROM PUBLIC SECTOR INDUSTRY SOLUTION
**
** PLEASE DELETE THE FIRST '*' FORM THE BEGINING OF THE FOLLOWING LINE
** TO ENABLE PUBLIC SECTOR EXAMPLE SUBSTITUTION EXITS
***********************************************************************
INCLUDE RGGBR_PS_TITLES.
***********************************************************************
** EXIT EXAMPLES FROM Argentina Legal Change - Law Res 177
***********************************************************************
INCLUDE RGGBS_AR_TITLES.
REFRESH ETAB.
LOOP AT EXITS.
ETAB = EXITS.
APPEND ETAB.
ENDLOOP.
ENDFORM. "GET_EXIT_TITLES
*eject
*----------------------------------------------------------------------*
* FORM U100 *
*----------------------------------------------------------------------*
* Example of an exit for a boolean rule *
* This exit can be used in FI for callup points 1,2 or 3. *
*----------------------------------------------------------------------*
* <-- B_RESULT T = True F = False *
*----------------------------------------------------------------------*
FORM U100 USING B_RESULT.
*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* PLEASE DELETE THE FIRST '*' FORM THE BEGINING OF THE FOLLOWING LINES *
* IF THE ACCOUNTING MODULE IS INSTALLED IN YOUR SYSTEM: *
*
* IF SY-DATUM = BKPF-BUDAT.
* B_RESULT = B_TRUE.
* ELSE.
* B_RESULT = B_FALSE.
* ENDIF.
*ENHANCEMENT-POINT RGGBR000_02 SPOTS ES_RGGBR000 STATIC.
*ENHANCEMENT-POINT RGGBR000_03 SPOTS ES_RGGBR000.
ENDFORM. "U100
*eject
*----------------------------------------------------------------------*
* FORM U101 *
*----------------------------------------------------------------------*
* Example of an exit using the complete data from one *
* multi-line rule. *
* This exit is intended for use from callup point 3, in FI. *
* *
* If account 400000 is used, then account 399999 must be posted *
* to in another posting line. *
*----------------------------------------------------------------------*
* --> BOOL_DATA The complete posting data. *
* <-- B_RESULT T = True F = False *
*----------------------------------------------------------------------*
*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* PLEASE DELETE THE FIRST '*' FORM THE BEGINING OF THE FOLLOWING LINES *
* IF THE ACCOUNTING MODULE IS INSTALLED IN YOUR SYSTEM: *
*FORM u101 USING bool_data TYPE gb002_015
* CHANGING B_RESULT.
* DATA: B_ACC_400000_USED LIKE D_BOOL VALUE 'F'.
*
* B_RESULT = B_TRUE.
** Has account 400000 has been used?
* LOOP AT BOOL_DATA-BSEG INTO BSEG
* WHERE HKONT = '0000400000'.
* B_ACC_400000_USED = B_TRUE.
* EXIT.
* ENDLOOP.
*
** Check that account 400000 has been used.
* CHECK B_ACC_400000_USED = B_TRUE.
*
* B_RESULT = B_FALSE.
* LOOP AT BOOL_DATA-BSEG INTO BSEG
* WHERE HKONT = '0000399999'.
* B_RESULT = B_TRUE.
* EXIT.
* ENDLOOP.
*
*ENDFORM.
*eject
*----------------------------------------------------------------------*
* FORM US001
*----------------------------------------------------------------------*
* Example of an exit for a boolean rule in SAP-EIS
* for aspect 001 (single validation).
* one data record is transfered in structure CF<asspect>
*----------------------------------------------------------------------
* Attention: for any FORM one has to make an entry in the
* form GET_EXIT_TITLES at the beginning of this include
*----------------------------------------------------------------------*
* <-- B_RESULT T = True F = False *
*----------------------------------------------------------------------*
FORM US001 USING B_RESULT.
*TABLES CF001. "table name aspect 001
*
* IF ( CF001-SPART = '00000001' OR
* CF001-GEBIE = '00000001' ) AND
* CF001-ERLOS >= '1000000'.
*
** further checks ...
*
* B_RESULT = B_TRUE.
* ELSE.
*
** further checks ...
*
* B_RESULT = B_FALSE.
* ENDIF.
ENDFORM. "US001
*eject
*----------------------------------------------------------------------*
* FORM UM001
*----------------------------------------------------------------------*
* Example of an exit for a boolean rule in SAP-EIS
* for aspect 001 (matrix validation).
* Data is transfered in BOOL_DATA:
* BOOL_DATA-CF<aspect> is intern table of structure CF<asspect>
*----------------------------------------------------------------------
* Attention: for any FORM one has to make an entry in the
* form GET_EXIT_TITLES at the beginning of this include
*----------------------------------------------------------------------*
* <-- B_RESULT T = True F = False *
*----------------------------------------------------------------------*
FORM UM001 USING BOOL_DATA "TYPE GB002_<boolean class of aspect 001>
CHANGING B_RESULT.
*DATA: LC_CF001 LIKE CF001.
*DATA: LC_COUNT TYPE I.
* B_RESULT = B_TRUE.
* CLEAR LC_COUNT.
* process data records in BOOL_DATA
* LOOP AT BOOL_DATA-CF001 INTO LC_CF001.
* IF LC_CF001-SPART = '00000001'.
* ADD 1 TO LC_COUNT.
* IF LC_COUNT >= 2.
** division '00000001' may only occur once !
* B_RESULT = B_FALSE.
* EXIT.
* ENDIF.
* ENDIF.
*
** further checks ....
*
* ENDLOOP.
ENDFORM. "UM001
***********************************************************************
** EXIT EXAMPLES FROM PUBLIC SECTOR INDUSTRY SOLUTION
**
** PLEASE DELETE THE FIRST '*' FORM THE BEGINING OF THE FOLLOWING LINE
** TO ENABLE PUBLIC SECTOR EXAMPLE SUBSTITUTION EXITS
***********************************************************************
*INCLUDE rggbr_ps_forms.
***********************************************************************
** EXIT EXAMPLES FROM Argentina Legal Change - Law Res 177
***********************************************************************
INCLUDE RGGBS_AR_FORMS.
" 예산 통제 정의
*&---------------------------------------------------------------------*
*& Form U200
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->BOOL_DATA text
* -->B_RESULT text
*----------------------------------------------------------------------*
FORM U200 USING BOOL_DATA TYPE GB002_015
CHANGING B_RESULT.
DATA : LV_BUKRS LIKE BKPF-BUKRS.
DATA : LV_BUDAT LIKE BKPF-BUDAT.
DATA : LV_WAERS LIKE BKPF-WAERS.
DATA : LS_BSEG LIKE BSEG.
DATA : LV_CODE TYPE ZE_RETCD.
DATA : LV_MSG TYPE ZE_MESSAGE.
DATA : LV_BELNR LIKE BKPF-BELNR.
DATA : LV_GJAHR LIKE BKPF-GJAHR.
DATA : BEGIN OF LT_KOSTL_CHECK OCCURS 0,
KOSTL LIKE CSKS-KOSTL,
KSTAR LIKE CSKA-KSTAR,
DMBTR LIKE BSEG-DMBTR,
END OF LT_KOSTL_CHECK.
DATA : BEGIN OF LT_AUNFR_CHECK OCCURS 0,
AUFNR LIKE AUFK-AUFNR,
DMBTR LIKE BSEG-DMBTR,
END OF LT_AUNFR_CHECK.
DATA : LS_BKPF LIKE BKPF.
* " 임시 ★ FI 테스트 중에 임시로 막음.
* IF NOT ( SY-UNAME = 'CO02' OR SY-UNAME = 'CO03' OR SY-UNAME = 'CO01' ).
* B_RESULT = B_TRUE.
* EXIT.
* ENDIF.
*
" 1. 헤더 정보
LV_BUKRS = BOOL_DATA-BKPF-BUKRS.
LV_GJAHR = BOOL_DATA-BKPF-GJAHR.
LV_BELNR = BOOL_DATA-BKPF-BELNR.
LV_BUKRS = BOOL_DATA-BKPF-BUKRS.
LV_BUDAT = BOOL_DATA-BKPF-BUDAT.
*
SELECT SINGLE WAERS " 회사코드 통화 조회
INTO LV_WAERS
FROM T001
WHERE BUKRS = LV_BUKRS.
*
** IF LV_BELNR IS NOT INITIAL.
** SELECT SINGLE * FROM BKPF INTO LS_BKPF
** WHERE BUKRS = LV_BUKRS
** AND GJAHR = LV_GJAHR
** AND BELNR = LV_BELNR.
**
** IF SY-SUBRC EQ 0.
** IF LS_BKPF-BSTAT = 'V'. " 이미 임시전표 발생 단계에서 체크가 되었다.
** B_RESULT = B_TRUE.
** EXIT.
** ENDIF.
** ENDIF.
** ENDIF.
SELECT SINGLE * FROM BKPF INTO LS_BKPF
WHERE BUKRS = LV_BUKRS
AND GJAHR = LV_GJAHR
AND BELNR = LV_BELNR.
*
IF SY-SUBRC EQ 0.
B_RESULT = B_TRUE.
EXIT.
ENDIF.
*
" 코스트센터-원가요소별 기표 내역 Collect.
LOOP AT BOOL_DATA-BSEG INTO LS_BSEG
WHERE KOSTL IS NOT INITIAL.
LT_KOSTL_CHECK-KOSTL = LS_BSEG-KOSTL.
LT_KOSTL_CHECK-KSTAR = LS_BSEG-HKONT.
IF LS_BSEG-SHKZG = 'H'.
LT_KOSTL_CHECK-DMBTR = LS_BSEG-DMBTR * -1.
ELSE.
LT_KOSTL_CHECK-DMBTR = LS_BSEG-DMBTR.
ENDIF.
COLLECT LT_KOSTL_CHECK.
CLEAR : LS_BSEG, LT_KOSTL_CHECK.
ENDLOOP.
*
* " 오더별 기표 내역 Collect
LOOP AT BOOL_DATA-BSEG INTO LS_BSEG
WHERE AUFNR IS NOT INITIAL.
LT_AUNFR_CHECK-AUFNR = LS_BSEG-AUFNR.
IF LS_BSEG-SHKZG = 'H'.
LT_AUNFR_CHECK-DMBTR = LS_BSEG-DMBTR * -1.
ELSE.
LT_AUNFR_CHECK-DMBTR = LS_BSEG-DMBTR.
ENDIF.
COLLECT LT_AUNFR_CHECK.
CLEAR : LS_BSEG, LT_AUNFR_CHECK.
ENDLOOP.
*
IF LT_AUNFR_CHECK[] IS INITIAL.
" 코스트센터 체크
LOOP AT LT_KOSTL_CHECK.
CALL FUNCTION 'ZCO_CHECK_KBUDGET'
EXPORTING
I_BUKRS = LV_BUKRS
I_BUDAT = LV_BUDAT
I_KSTAR = LT_KOSTL_CHECK-KSTAR
I_KOSTL = LT_KOSTL_CHECK-KOSTL
I_DMBTR = LT_KOSTL_CHECK-DMBTR
I_WAERS = LV_WAERS
IMPORTING
E_RETCD = LV_CODE
E_RETMSG = LV_MSG.
IF LV_CODE = 'E'.
B_RESULT = B_FALSE.
MESSAGE E000(ZFIM) WITH LV_MSG.
EXIT.
ENDIF.
ENDLOOP.
ELSE.
* " 오더 체크
LOOP AT LT_AUNFR_CHECK.
CALL FUNCTION 'ZCO_CHECK_OBUDGET'
EXPORTING
I_BUKRS = LV_BUKRS
I_BUDAT = LV_BUDAT
I_AUFNR = LT_AUNFR_CHECK-AUFNR
I_DMBTR = LT_AUNFR_CHECK-DMBTR
I_WAERS = LV_WAERS
IMPORTING
E_RETCD = LV_CODE
E_RETMSG = LV_MSG.
IF LV_CODE = 'E'.
B_RESULT = B_FALSE.
MESSAGE E000(ZFIM) WITH LV_MSG.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
ENDFORM. "U200
*--------------------------------------------------------------------*
* FORM U300
*--------------------------------------------------------------------*
* 선급비용/선수수익 전표 역분개시 유효성체크
*--------------------------------------------------------------------*
FORM U300 USING BOOL_DATA TYPE GB002_015
CHANGING B_RESULT.
DATA : LV_BELNR TYPE BELNR_D.
CLEAR LV_BELNR.
SELECT SINGLE A~BELNR
INTO LV_BELNR
FROM ZFIT0030 AS A
INNER JOIN ZFIT0032 AS B
ON A~BUKRS = B~BUKRS
AND A~CLAPR = B~CLAPR
AND A~MSTNO = B~MSTNO
WHERE A~BUKRS EQ BOOL_DATA-BKPF-BUKRS
AND A~SPMON EQ BOOL_DATA-BKPF-BUDAT+0(6)
AND A~BELNR EQ BOOL_DATA-BKPF-STBLG
AND B~SEDOC NE SPACE.
IF LV_BELNR NE SPACE.
B_RESULT = B_FALSE.
MESSAGE E000(ZFIM) WITH TEXT-M01.
EXIT.
ENDIF.
ENDFORM. "U702
*--------------------------------------------------------------------*
* FORM U701
*--------------------------------------------------------------------*
* 증빙일자 마감 체크
*--------------------------------------------------------------------*
FORM U701 CHANGING B_RESULT.
DATA : L_CHECK_FLAG.
CLEAR: L_CHECK_FLAG.
B_RESULT = B_TRUE.
* T-CODE가 FB02가 아니면(전표헤더 텍스트만 고치는데 전기일,증빙일
* 체크하기때문에)
IF SY-TCODE <> 'FB02' AND SY-TCODE <> 'FB03'.
CALL FUNCTION 'ZFI_CHECK_DATE'
EXPORTING
L_BUKRS = BKPF-BUKRS
L_BLDAT = BKPF-BLDAT
L_BUDAT = BKPF-BUDAT
L_BLART = BKPF-BLART
IMPORTING
L_CHECK_FLAG = L_CHECK_FLAG.
* EXCEPTIONS
* 001 = 1
* OTHERS = 2
IF SY-SUBRC <> 0.
B_RESULT = B_FALSE.
ENDIF.
ENDIF.
IF L_CHECK_FLAG = 'X'.
B_RESULT = B_FALSE.
ENDIF.
ENDFORM. "u701
*--------------------------------------------------------------------*
* FORM U702
*--------------------------------------------------------------------*
* Can not process journalizing for this account 조정임시계정 점검
*--------------------------------------------------------------------*
FORM U702 CHANGING B_RESULT.
DATA : LV_SS(100).
B_RESULT = B_FALSE.
CONCATENATE 'Account' BSEG-HKONT 'can not be Journaied'
INTO LV_SS SEPARATED BY SPACE.
MESSAGE E001(ZFIM) WITH LV_SS.
* MESSAGE E005(ZFIM) WITH BSEG-HKONT. "계정 &로는 분개처리 할 수 없습니다.
ENDFORM. "U702
*----------------------------------------------------------------------*
* FORM U703
*----------------------------------------------------------------------*
* Check reversal availability(역분개가능여부 점검)
*----------------------------------------------------------------------*
FORM U703 CHANGING B_RESULT.
DATA : LV_ZCBO_TCODE_FB08 TYPE SY-TCODE.
DATA : LV_SS(100).
GET PARAMETER ID 'ZCBO_TCODE_FB08' FIELD LV_ZCBO_TCODE_FB08.
B_RESULT = B_TRUE.
IF NOT BKPF-XBLNR_ALT IS INITIAL "Bundle Document = Alternative Reference Number
AND LV_ZCBO_TCODE_FB08 IS INITIAL
AND (
SY-TCODE = 'FB08' "Reverse Document
OR SY-TCODE = 'F.80' "Mass Reversal of Documents
)
.
B_RESULT = B_FALSE.
CONCATENATE 'Can not be reversed. Bundle Doc.No :' BKPF-XBLNR_ALT
INTO LV_SS SEPARATED BY SPACE.
MESSAGE E001(ZFIM) WITH LV_SS.
ENDIF.
"지급접수된 것은 역분개 못함
IF BKPF-ZEVD_CHK = 'X'.
B_RESULT = B_FALSE.
CONCATENATE 'Can not be reversed. Document Receipt Doc.No :' BKPF-XBLNR_ALT
INTO LV_SS SEPARATED BY SPACE.
MESSAGE E001(ZFIM) WITH LV_SS.
ENDIF.
* DATA l_msgtxt TYPE bapi_msg.
*
***역분개 가능여부 체크
*
***1.전자세금계산서 발행이 된 전표에 대해서는 역분개를 하지 못하도록
*** 처리함.
* PERFORM reverse_check(saplz_fi_bte) USING bkpf-bukrs bkpf-blart
* bkpf-stblg bkpf-stjah
* l_msgtxt '' bkpf-budat.
* IF l_msgtxt IS NOT INITIAL.
* MESSAGE e001(zmfi) WITH l_msgtxt.
* ENDIF.
ENDFORM. "U703
*----------------------------------------------------------------------*
* FORM U800
*----------------------------------------------------------------------*
* 세율에 따른 허용 범위 검사 Tax tolerance has been exceeded.
*----------------------------------------------------------------------*
FORM U800 CHANGING B_RESULT.
DATA : LS_T001 LIKE T001. "Company Codes
DATA : LS_T005 LIKE T005. "Countries
DATA : LT_T007A LIKE T007A OCCURS 0 WITH HEADER LINE.
DATA : LS_T007A LIKE T007A. "Tax Keys
DATA : LT_A003 LIKE A003 OCCURS 0 WITH HEADER LINE.
DATA : LS_A003 LIKE A003. "Tax Classification
DATA : LT_KONP LIKE KONP OCCURS 0 WITH HEADER LINE.
DATA : LS_KONP LIKE KONP. "Conditions (Item)
DATA : LT_T030K LIKE T030K OCCURS 0 WITH HEADER LINE. "Tax Accounts Determination
RANGES LR_HKONT FOR T030K-KONTS.
*
B_RESULT = B_TRUE.
*
CLEAR: LS_T001 .
CLEAR: LS_T005 .
CLEAR: LT_T007A, LT_T007A[].
CLEAR: LS_T007A.
CLEAR: LT_A003, LT_A003[].
CLEAR: LS_A003 .
CLEAR: LT_KONP, LT_KONP[].
CLEAR: LS_KONP .
CLEAR: LT_T030K, LT_T030K[].
CLEAR: LR_HKONT, LR_HKONT[].
SELECT SINGLE * INTO LS_T001
FROM T001
WHERE BUKRS = BKPF-BUKRS.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
SELECT SINGLE * INTO LS_T005
FROM T005
WHERE LAND1 = LS_T001-LAND1.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
SELECT * INTO TABLE LT_T007A
FROM T007A
WHERE KALSM = LS_T005-KALSM
.
IF LT_T007A[] IS INITIAL.
EXIT.
ENDIF.
SORT LT_T007A BY KALSM MWSKZ.
SELECT * INTO TABLE LT_T030K
FROM T030K
WHERE KTOPL = LS_T001-KTOPL
.
IF LT_T030K[] IS INITIAL.
EXIT.
ENDIF.
SELECT * INTO TABLE LT_A003
FROM A003
WHERE KAPPL = 'TX'
AND KSCHL > SPACE
AND ALAND = LS_T001-LAND1
.
IF LT_A003[] IS INITIAL.
EXIT.
ENDIF.
SORT LT_A003 BY KAPPL ALAND MWSKZ.
SELECT * INTO TABLE LT_KONP
FROM KONP
FOR ALL ENTRIES IN LT_A003
WHERE KNUMH = LT_A003-KNUMH
.
IF LT_A003[] IS INITIAL.
EXIT.
ENDIF.
SORT LT_KONP BY KNUMH KOPOS.
LOOP AT LT_T030K.
CLEAR: LR_HKONT.
LR_HKONT-SIGN = 'I'.
LR_HKONT-OPTION = 'BT'.
LR_HKONT-LOW = LT_T030K-KONTS.
LR_HKONT-HIGH = LT_T030K-KONTH.
APPEND LR_HKONT.
CLEAR: LR_HKONT.
ENDLOOP.
DATA : LV_FWBAS LIKE BSEG-FWBAS. "Base amount 세금계정에서 공급가액+세액
DATA : LV_WMWST LIKE BSEG-WMWST. "Tax amount
DATA : LV_WRBTR LIKE BSEG-WRBTR. "Amount 세금계정에서 세액
DATA : LV_WRBTR_PLUS LIKE BSEG-WRBTR. "Amount 세금계정에서 세액
DATA : LV_WRBTR_MINUS LIKE BSEG-WRBTR. "Amount 세금계정에서 세액
DATA : LV_BASE_KBETR TYPE FWSTE. "Condition amount or percentage where no scale exists
DATA : LV_CALC_KBETR TYPE FWSTE. "Condition amount or percentage where no scale exists
DATA : LV_DIFF_KBETR TYPE FWSTE. "Condition amount or percentage where no scale exists
DATA : LV_SWELL TYPE FWSTE. "Condition amount or percentage where no scale exists
DATA : LV_MIN_SWELL TYPE FWSTE. "Condition amount or percentage where no scale exists
* BREAK-POINT ID Z_BREAK_POINT.
IF BSEG-HKONT IN LR_HKONT.
* BREAK-POINT ID Z_BREAK_POINT.
IF BSEG-WRBTR = 0.
EXIT.
ENDIF.
CLEAR: LS_T007A.
READ TABLE LT_T007A INTO LS_T007A WITH KEY MWSKZ = BSEG-MWSKZ.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
CLEAR: LS_A003.
READ TABLE LT_A003 INTO LS_A003 WITH KEY MWSKZ = BSEG-MWSKZ.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
CLEAR: LS_KONP.
READ TABLE LT_KONP INTO LS_KONP WITH KEY KNUMH = LS_A003-KNUMH.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
* IF LS_KONP-KBETR = 0.
* EXIT.
* ENDIF.
LV_BASE_KBETR = LS_KONP-KBETR * 10.
"입력 금액으로 세율 계산
LV_WRBTR = ABS( BSEG-WRBTR ). "세금게정의 세액
LV_FWBAS = ABS( BSEG-FWBAS ). "세금게정의 공급가액+세액
LV_CALC_KBETR = ( LV_WRBTR / LV_FWBAS ) * 10000.
LV_DIFF_KBETR = LV_BASE_KBETR - LV_CALC_KBETR.
LV_DIFF_KBETR = ABS( LV_DIFF_KBETR ).
LV_SWELL = LV_BASE_KBETR * LS_T007A-TOLERANCE / 100.
IF LV_SWELL IS INITIAL.
PACK '1' TO LV_MIN_SWELL.
ELSE.
LV_MIN_SWELL = LV_SWELL / 100.
ENDIF.
DATA: LS_T001R TYPE T001R.
CLEAR: LS_T001R.
SELECT SINGLE * INTO LS_T001R FROM T001R
WHERE BUKRS = BSEG-BUKRS
AND WAERS = BKPF-WAERS.
IF SY-SUBRC = 0.
LV_MIN_SWELL = LV_MIN_SWELL * LS_T001R-REINH.
ENDIF.
DATA: L_T001Z LIKE T001Z.
CALL FUNCTION 'READ_ADD_COMPANY_CODE_INFO' "N943614
EXPORTING "N943614
IC_BUKRS = BSEG-BUKRS "N943614
IC_PARTY = 'PTAXCK' "N943614
IMPORTING "N943614
ES_T001Z = L_T001Z "N943614
EXCEPTIONS "N943614
NOT_FOUND = 1 "N943614
OTHERS = 2. "N943614
* Wenn Parameter für BUKRS gesetzt keine Message"N943614
* If L_t001Z-PAVAL = 'X'. "N943614 "N956637
IF L_T001Z-PAVAL(3) = 'X '. "N956637
LV_MIN_SWELL = 0. "N943614
ELSEIF L_T001Z-PAVAL(3) = 'X1 '. "N956637
LV_MIN_SWELL = '0.01'. "N956637
IF LS_T001R-REINH <> 0. "N956637
LV_MIN_SWELL = LV_MIN_SWELL * LS_T001R-REINH. "N956637
ENDIF. "N956637
ELSEIF L_T001Z-PAVAL(3) CO '0123456789'. "N956637
LV_MIN_SWELL = L_T001Z-PAVAL(3) / 100. "N956637
ENDIF. "N943614
* end of note 943614
IF LV_MIN_SWELL > LV_SWELL.
LV_SWELL = LV_MIN_SWELL.
ENDIF.
LV_SWELL = ABS( LV_SWELL ).
IF LV_DIFF_KBETR > LV_SWELL.
B_RESULT = B_FALSE.
MESSAGE E000(ZFIM) WITH TEXT-800.
ENDIF.
ENDIF.
ENDFORM. "U800
*--------------------------------------------------------------------*
* FORM U301
*--------------------------------------------------------------------*
* At changing Payment Block, check user's Role
*--------------------------------------------------------------------*
FORM U301 CHANGING B_RESULT.
DATA : BEGIN OF LT_BLOCK OCCURS 0,
ZLSPR LIKE BSEG-ZLSPR,
END OF LT_BLOCK.
DATA : LV_AGR_NAME TYPE AGR_NAME.
DATA : LT_AGR_TCODES LIKE AGR_TCODES OCCURS 0 WITH HEADER LINE.
DATA : LV_ZLSPR LIKE BSEG-ZLSPR.
** IF SYST-TCODE EQ 'FB02' OR
** SYST-TCODE EQ 'FB03' OR
** SYST-TCODE EQ 'FB09' .
**
** CLEAR : LT_AGR_TCODES, LT_AGR_TCODES[].
** SELECT *
** INTO CORRESPONDING FIELDS OF TABLE LT_AGR_TCODES
** FROM AGR_TCODES
** WHERE TCODE IN (C_ZFIO007, C_ZTRR103, C_ZTRR104).
**
** LOOP AT LT_AGR_TCODES.
** CLEAR LV_AGR_NAME.
** SELECT SINGLE AGR_NAME
** INTO LV_AGR_NAME
** FROM AGR_USERS
** WHERE AGR_NAME EQ LT_AGR_TCODES-AGR_NAME
** AND UNAME EQ SY-UNAME
** AND FROM_DAT <= SY-DATUM
** AND TO_DAT => SY-DATUM.
** CHECK SY-SUBRC EQ 0.
** IF LT_AGR_TCODES-TCODE EQ C_ZFIO007.
** MOVE 'B' TO LT_BLOCK-ZLSPR.
** ELSEIF LT_AGR_TCODES-TCODE EQ C_ZTRR103.
** MOVE 'C' TO LT_BLOCK-ZLSPR.
** ELSEIF LT_AGR_TCODES-TCODE EQ C_ZTRR104.
** MOVE ' ' TO LT_BLOCK-ZLSPR.
** ENDIF.
** APPEND LT_BLOCK. CLEAR LT_BLOCK.
** ENDLOOP.
**
** READ TABLE LT_BLOCK WITH KEY ZLSPR = BSEG-ZLSPR.
** IF SY-SUBRC NE 0.
** MESSAGE E000(ZFIM) WITH TEXT-E01.
** ENDIF.
**
** ENDIF.
CLEAR LV_ZLSPR.
SELECT SINGLE ZLSPR
INTO LV_ZLSPR
FROM BSEG
WHERE BUKRS EQ BSEG-BUKRS
AND BELNR EQ BSEG-BELNR
AND GJAHR EQ BSEG-GJAHR
AND BUZEI EQ BSEG-BUZEI.
CHECK SY-SUBRC EQ 0.
IF BSEG-KOART EQ 'K' OR
( BSEG-KOART EQ 'D' AND
( BSEG-BSCHL EQ '11' OR BSEG-BSCHL EQ '14' ) ).
IF LV_ZLSPR NE 'B' AND BSEG-ZLSPR EQ 'B'.
MESSAGE E000(ZFIM) WITH TEXT-E02.
ELSEIF LV_ZLSPR NE 'C' AND BSEG-ZLSPR EQ 'C'.
MESSAGE E000(ZFIM) WITH TEXT-E03.
ELSEIF LV_ZLSPR NE ' ' AND BSEG-ZLSPR EQ ' '.
MESSAGE E000(ZFIM) WITH TEXT-E04.
ENDIF.
ENDIF.
ENDFORM.
*--------------------------------------------------------------------*
* FORM U301
*--------------------------------------------------------------------*
* At changing Payment Block, check user's Role
*--------------------------------------------------------------------*
FORM U302 CHANGING B_RESULT.
IF BSEG-HBKID NE SPACE.
IF BSEG-HKTID EQ SPACE.
MESSAGE E000(ZFIM) WITH TEXT-E05.
ENDIF.
ENDIF.
ENDFORM.
댓글 없음:
댓글 쓰기