FUNCTION ZFI_VENDOR_CHANGE.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(IS_LFA1) LIKE LFA1 STRUCTURE LFA1
*" VALUE(IS_LFB1) LIKE LFB1 STRUCTURE LFB1
*" VALUE(IS_ADRC) LIKE ADRC STRUCTURE ADRC OPTIONAL
*" VALUE(IV_LAISO) TYPE LAISO OPTIONAL
*" VALUE(IV_EMAIL) TYPE AD_SMTPADR OPTIONAL
*" VALUE(IV_REMARK) TYPE AD_REMARK1 OPTIONAL
*" VALUE(IV_MODE) TYPE CTU_MODE DEFAULT 'N'
*" EXPORTING
*" VALUE(EV_LIFNR) TYPE LIFNR
*" VALUE(EV_MSGTY) TYPE MSGTY
*" VALUE(EV_MSGTX) TYPE MSGTX
*"----------------------------------------------------------------------
DATA LV_EXIST TYPE C.
CLEAR IT_BDCTAB. REFRESH IT_BDCTAB.
CLEAR IT_BDCMSG. REFRESH IT_BDCMSG.
IF IS_LFA1-LAND1 IS INITIAL.
IS_LFA1-LAND1 = 'KR'.
ENDIF.
IF IS_LFA1-PSTLZ IS INITIAL.
IS_LFA1-PSTLZ = '00000'.
ENDIF.
IF IS_LFA1-ORT01 IS INITIAL.
IS_LFA1-ORT01 = '.'.
ENDIF.
IF IS_LFA1-STRAS IS INITIAL.
IS_LFA1-STRAS = '.'.
ENDIF.
IF IS_LFA1-SORTL IS INITIAL.
IS_LFA1-SORTL = IS_LFA1-NAME1.
ENDIF.
IF IS_LFB1-GUZTE IS INITIAL.
IS_LFB1-GUZTE = IS_LFB1-ZTERM.
ENDIF.
*-- 법인카드 거래처(C or D *****)는 지급조건 등을 고정함(업데이트 X)
IF IS_LFA1-LIFNR+0(1) = 'C'.
IF IS_LFB1-ZTERM+0(2) <> 'CA'.
IS_LFB1-ZTERM = 'CA23'.
IS_LFB1-GUZTE = IS_LFB1-ZTERM.
ENDIF.
IF IS_LFB1-AKONT <> '0000212130'.
IS_LFB1-AKONT = '0000212130'.
ENDIF.
IF IS_LFB1-FDGRV <> 'VC'.
IS_LFB1-AKONT = 'VC'.
ENDIF.
ELSEIF IS_LFA1-LIFNR+0(1) = 'D'.
IF IS_LFB1-ZTERM+0(2) <> 'CA'.
IS_LFB1-ZTERM = 'CA22'.
IS_LFB1-GUZTE = IS_LFB1-ZTERM.
ENDIF.
IF IS_LFB1-AKONT <> '0000212140'.
IS_LFB1-AKONT = '0000212140'.
ENDIF.
IF IS_LFB1-FDGRV <> 'VD'.
IS_LFB1-AKONT = 'VD'.
ENDIF.
ENDIF.
SET PARAMETER ID 'BPA' FIELD ' '.
SET PARAMETER ID 'BUK' FIELD IS_LFB1-BUKRS.
IF IV_LAISO IS INITIAL.
IF IS_LFA1-SPRAS IS NOT INITIAL.
SELECT SINGLE LAISO INTO IV_LAISO
FROM T002
WHERE SPRAS = IS_LFA1-SPRAS.
ELSE.
SELECT SINGLE LAISO INTO IV_LAISO
FROM T002
WHERE SPRAS = SY-LANGU.
ENDIF.
ENDIF.
SELECT SINGLE MANDT INTO SY-MANDT
FROM LFB1
WHERE LIFNR = IS_LFB1-LIFNR
AND BUKRS = IS_LFB1-BUKRS.
IF SY-SUBRC EQ 0.
LV_EXIST = 'X'.
ENDIF.
**<<BP 수정 수정모드->조회모드
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=SCREEN_1000_SETTINGS'.
PERFORM DYNPRO USING:
'X' 'SAPLBUPA_DIALOG_SETTINGS' '4000',
' ' 'BDC_OKCODE' '=BUS_MAIN_ENTER',
' ' 'BUS_JOEL_SET-BUPA_DISPLAY_MODE' 'X'.
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=SCREEN_1000_MAIN_NOT'.
**>>BP 수정 모드->조회모드
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=BUS_MAIN_ENTER',
' ' 'BUS_JOEL_MAIN-CHANGE_NUMBER' IS_LFA1-LIFNR,
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BUS_JOEL_MAIN-PARTNER_ROLE' 'FLVN00',
' ' 'BDC_OKCODE' '=SCREEN_1000_ACTIVITY'.
**>>관계화면에서 일반화면
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=SCREEN_1000_MAIN_REL',
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=SCREEN_1000_MAIN_P01'.
**<<관계화면에서 일반화면
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BUS_JOEL_MAIN-PARTNER_ROLE' 'FLVN00',
' ' 'BDC_OKCODE' '=SCREEN_1110_CHG_ROLE'.
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=SCREEN_1100_TAB_01',
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=SCREEN_1100_TAB_03',
' ' 'BUT000-NAME_ORG1' IS_LFA1-NAME1,
' ' 'BUT000-NAME_ORG2' IS_LFA1-NAME2,
' ' 'BUT000-NAME_ORG3' IS_LFA1-NAME3,
' ' 'BUT000-NAME_ORG4' IS_LFA1-NAME4,
' ' 'BUS000FLDS-BU_SORT1_TXT' IS_LFA1-SORTL,
' ' 'BUS000FLDS-BU_SORT2_TXT' IS_ADRC-SORT2,
' ' 'ADDR1_DATA-STREET' IS_LFA1-STRAS,
' ' 'ADDR1_DATA-POST_CODE1' IS_LFA1-PSTLZ,
' ' 'ADDR1_DATA-CITY1' IS_LFA1-ORT01,
' ' 'ADDR1_DATA-COUNTRY' IS_LFA1-LAND1,
' ' 'ADDR1_DATA-REGION' IS_LFA1-REGIO,
' ' 'ADDR1_DATA-LANGU' IV_LAISO,
' ' 'SZA1_D0100-TEL_NUMBER' IS_LFA1-TELF1,
' ' 'SZA1_D0100-MOB_NUMBER' IS_LFA1-TELF2,
' ' 'SZA1_D0100-FAX_NUMBER' IS_LFA1-TELFX.
IF IV_EMAIL IS NOT INITIAL.
PERFORM DYNPRO USING:
' ' 'SZA1_D0100-SMTP_ADDR' IV_EMAIL.
ENDIF.
IF IV_REMARK IS NOT INITIAL.
PERFORM DYNPRO USING:
' ' 'ADDR1_DATA-REMARK' IV_REMARK.
ENDIF.
**<< ID
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=BUS_MAIN_ENTER'.
IF IS_LFA1-STCD2 IS NOT INITIAL.
PERFORM DYNPRO USING:
' ' 'DFKKBPTAXNUM-TAXTYPE(01)' 'KR2',
' ' 'DFKKBPTAXNUM-TAXNUMXL(01)' IS_LFA1-STCD2.
ENDIF.
IF IS_LFA1-STCD1 IS NOT INITIAL.
IF IS_LFA1-STCD2 IS INITIAL.
PERFORM DYNPRO USING:
' ' 'DFKKBPTAXNUM-TAXTYPE(01)' 'KR1',
' ' 'DFKKBPTAXNUM-TAXNUMXL(01)' IS_LFA1-STCD1.
ELSE.
PERFORM DYNPRO USING:
' ' 'DFKKBPTAXNUM-TAXTYPE(02)' 'KR1',
' ' 'DFKKBPTAXNUM-TAXNUMXL(02)' IS_LFA1-STCD1.
ENDIF.
ENDIF.
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=SCREEN_1100_TAB_08'.
**>> ID
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=SCREEN_1100_TAB_09',
' ' 'GS_LFA1-LNRZA' IS_LFA1-LNRZA,
' ' 'GS_LFA1-PROFS' IS_LFA1-PROFS.
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'GS_LFA1-KRAUS' IS_LFA1-KRAUS,
' ' 'GS_LFA1-J_1KFTBUS' IS_LFA1-J_1KFTBUS,
' ' 'GS_LFA1-J_1KFTIND' IS_LFA1-J_1KFTIND,
' ' 'GS_LFA1-J_1KFREPRE' IS_LFA1-J_1KFREPRE.
IF IS_LFB1-BUKRS IS INITIAL.
PERFORM DYNPRO USING:
' ' 'BDC_OKCODE' '=BUS_MAIN_SAVE'.
ELSE.
PERFORM DYNPRO USING:
' ' 'BDC_OKCODE' '=SCREEN_1000_MAIN_P02',
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=SCREEN_1100_TAB_01'.
IF LV_EXIST IS INITIAL.
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' 'FSBP_CC_SWITCH'.
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BS001-BUKRS' IS_LFB1-BUKRS,
' ' 'BDC_OKCODE' '=ENTER'.
ENDIF.
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=SCREEN_1100_TAB_02',
' ' 'GS_LFB1-AKONT' IS_LFB1-AKONT,
' ' 'GS_LFB1-ZUAWA' IS_LFB1-ZUAWA,
' ' 'GS_LFB1-FDGRV' IS_LFB1-FDGRV.
IF IS_LFB1-PERNR IS NOT INITIAL.
PERFORM DYNPRO USING:
' ' 'GS_LFB1_DYNP-PERNR' IS_LFB1-PERNR.
ENDIF.
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=SCREEN_1100_TAB_03',
' ' 'GS_LFB1-ZTERM' IS_LFB1-ZTERM,
' ' 'GS_LFB1-GUZTE' IS_LFB1-GUZTE,
' ' 'GS_LFB1-REPRF' IS_LFB1-REPRF,
' ' 'GS_LFB1-XPORE' IS_LFB1-XPORE,
' ' 'GS_LFB1-ZWELS' IS_LFB1-ZWELS,
' ' 'GS_LFB1-HBKID' IS_LFB1-HBKID,
' ' 'GS_LFB1-ZAHLS' IS_LFB1-ZAHLS,
' ' 'GS_LFB1-ZGRUP' IS_LFB1-ZGRUP,
' ' 'GS_LFB1-LNRZB' IS_LFB1-LNRZB.
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=BUS_MAIN_SAVE',
' ' 'GS_LFB1-BUSAB' IS_LFB1-BUSAB.
ENDIF.
CALL TRANSACTION 'BP' USING IT_BDCTAB
MODE IV_MODE
UPDATE 'S'
MESSAGES INTO IT_BDCMSG.
READ TABLE IT_BDCMSG WITH KEY MSGTYP = 'S'
MSGID = 'R1'
MSGNR = '215'.
IF SY-SUBRC NE 0.
READ TABLE IT_BDCMSG WITH KEY MSGTYP = 'S'
MSGID = 'R1'
MSGNR = '214'.
IF SY-SUBRC NE 0.
READ TABLE IT_BDCMSG WITH KEY MSGTYP = 'S'
MSGID = 'R1'
MSGNR = '244'. "역할생성
IF SY-SUBRC NE 0.
READ TABLE IT_BDCMSG WITH KEY MSGTYP = 'S'
MSGID = 'R1'
MSGNR = '202'. "변경없음
ENDIF.
ENDIF.
ENDIF.
IF SY-SUBRC EQ 0.
EV_MSGTY = 'S'.
EV_MSGTX = 'Success'.
EV_LIFNR = IT_BDCMSG-MSGV1.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = EV_LIFNR
IMPORTING
OUTPUT = EV_LIFNR.
ELSE.
EV_MSGTY = 'E'.
READ TABLE IT_BDCMSG WITH KEY MSGTYP = 'E'.
IF SY-SUBRC NE 0.
READ TABLE IT_BDCMSG WITH KEY MSGID = 'ZFI'.
IF SY-SUBRC NE 0.
LOOP AT IT_BDCMSG.
ENDLOOP.
ENDIF.
ENDIF.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
MSGID = IT_BDCMSG-MSGID
MSGNR = IT_BDCMSG-MSGNR
MSGV1 = IT_BDCMSG-MSGV1
MSGV2 = IT_BDCMSG-MSGV2
MSGV3 = IT_BDCMSG-MSGV3
MSGV4 = IT_BDCMSG-MSGV4
IMPORTING
MESSAGE_TEXT_OUTPUT = EV_MSGTX.
ENDIF.
ENDFUNCTION.
*----------------------------------------------------------------------*
***INCLUDE LZFI33F01.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form dynpro
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0539 text
* -->P_0540 text
* -->P_0541 text
*----------------------------------------------------------------------*
FORM dynpro USING begin fnam fval.
CLEAR it_bdctab.
IF begin = ' '.
it_bdctab-fnam = fnam.
it_bdctab-fval = fval.
APPEND it_bdctab.
ELSE.
it_bdctab-program = fnam.
it_bdctab-dynpro = fval.
it_bdctab-dynbegin = 'X'.
APPEND it_bdctab.
ENDIF.
ENDFORM. " dynpro
댓글 없음:
댓글 쓰기