FUNCTION ZFI_CUSTOMER_CHANGE.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(IS_KNA1) LIKE KNA1 STRUCTURE KNA1
*" VALUE(IS_KNB1) LIKE KNB1 STRUCTURE KNB1
*" 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_KUNNR) TYPE KUNNR
*" 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_KNA1-LAND1 IS INITIAL.
IS_KNA1-LAND1 = 'KR'.
ENDIF.
IF IS_KNA1-PSTLZ IS INITIAL.
IS_KNA1-PSTLZ = '00000'.
ENDIF.
IF IS_KNA1-ORT01 IS INITIAL.
IS_KNA1-ORT01 = '.'.
ENDIF.
IF IS_KNA1-STRAS IS INITIAL.
IS_KNA1-STRAS = '.'.
ENDIF.
IF IS_KNA1-SORTL IS INITIAL.
IS_KNA1-SORTL = IS_KNA1-NAME1.
ENDIF.
IF IS_KNB1-GUZTE IS INITIAL.
IS_KNB1-GUZTE = IS_KNB1-ZTERM.
ENDIF.
IF IV_LAISO IS INITIAL.
IF IS_KNA1-SPRAS IS NOT INITIAL.
SELECT SINGLE LAISO INTO IV_LAISO
FROM T002
WHERE SPRAS = IS_KNA1-SPRAS.
ELSE.
SELECT SINGLE LAISO INTO IV_LAISO
FROM T002
WHERE SPRAS = SY-LANGU.
ENDIF.
ENDIF.
SET PARAMETER ID 'BPA' FIELD ' '.
SET PARAMETER ID 'BUK' FIELD IS_KNB1-BUKRS.
SELECT SINGLE MANDT INTO SY-MANDT
FROM KNB1
WHERE KUNNR = IS_KNB1-KUNNR
AND BUKRS = IS_KNB1-BUKRS.
IF SY-SUBRC EQ 0.
LV_EXIST = 'X'.
ENDIF.
DATA : LV_GROUP TYPE BU_GROUP,
LV_PRTNR TYPE BU_PARTNER,
LV_SAMNR TYPE BD_SAMENUMBER.
SELECT SINGLE BU_GROUP XSAMENUMBER
INTO (LV_GROUP, LV_SAMNR)
FROM TBD001
WHERE KTOKD = IS_KNA1-KTOKD.
IF LV_SAMNR IS INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = IS_KNA1-KUNNR
IMPORTING
OUTPUT = LV_PRTNR.
IF LV_GROUP = 'C009'.
LV_PRTNR = 'S' && '0' && LV_PRTNR.
ELSE.
LV_PRTNR = 'S' && LV_PRTNR.
ENDIF.
ELSE.
LV_PRTNR = IS_KNA1-KUNNR.
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' LV_PRTNR,
'X' 'SAPLBUS_LOCATOR' '3000',
' ' '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' 'FLCU00',
' ' '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_KNA1-NAME1,
' ' 'BUT000-NAME_ORG2' IS_KNA1-NAME2,
' ' 'BUT000-NAME_ORG3' IS_KNA1-NAME3,
' ' 'BUT000-NAME_ORG4' IS_KNA1-NAME4,
' ' 'BUS000FLDS-BU_SORT1_TXT' IS_KNA1-SORTL,
' ' 'BUS000FLDS-BU_SORT2_TXT' IS_ADRC-SORT2,
' ' 'ADDR1_DATA-STREET' IS_KNA1-STRAS,
' ' 'ADDR1_DATA-POST_CODE1' IS_KNA1-PSTLZ,
' ' 'ADDR1_DATA-CITY1' IS_KNA1-ORT01,
' ' 'ADDR1_DATA-COUNTRY' IS_KNA1-LAND1,
' ' 'ADDR1_DATA-REGION' IS_KNA1-REGIO,
' ' 'ADDR1_DATA-LANGU' IV_LAISO,
' ' 'ADDR1_DATA-REMARK' IV_REMARK,
' ' 'SZA1_D0100-TEL_NUMBER' IS_KNA1-TELF1,
' ' 'SZA1_D0100-MOB_NUMBER' IS_KNA1-TELF2,
' ' 'SZA1_D0100-FAX_NUMBER' IS_KNA1-TELFX.
IF IV_EMAIL IS NOT INITIAL.
PERFORM DYNPRO USING:
' ' 'SZA1_D0100-SMTP_ADDR' IV_EMAIL.
ENDIF.
**<< ID
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=BUS_MAIN_ENTER'.
IF IS_KNA1-STCD2 IS NOT INITIAL.
PERFORM DYNPRO USING:
' ' 'DFKKBPTAXNUM-TAXTYPE(01)' 'KR2',
' ' 'DFKKBPTAXNUM-TAXNUMXL(01)' IS_KNA1-STCD2.
ENDIF.
IF IS_KNA1-STCD1 IS NOT INITIAL.
IF IS_KNA1-STCD2 IS INITIAL.
PERFORM DYNPRO USING:
' ' 'DFKKBPTAXNUM-TAXTYPE(01)' 'KR1',
' ' 'DFKKBPTAXNUM-TAXNUMXL(01)' IS_KNA1-STCD1.
ELSE.
PERFORM DYNPRO USING:
' ' 'DFKKBPTAXNUM-TAXTYPE(02)' 'KR1',
' ' 'DFKKBPTAXNUM-TAXNUMXL(02)' IS_KNA1-STCD1.
ENDIF.
ENDIF.
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=SCREEN_1100_TAB_09'.
**>> ID
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'GS_KNA1-J_1KFTBUS' IS_KNA1-J_1KFTBUS,
' ' 'GS_KNA1-J_1KFTIND' IS_KNA1-J_1KFTIND,
' ' 'GS_KNA1-J_1KFREPRE' IS_KNA1-J_1KFREPRE.
IF IS_KNB1-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_KNB1-BUKRS,
' ' 'BDC_OKCODE' '=ENTER'.
ENDIF.
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=SCREEN_1100_TAB_02',
' ' 'GS_KNB1-AKONT' IS_KNB1-AKONT,
' ' 'GS_KNB1-ZUAWA' IS_KNB1-ZUAWA,
' ' 'GS_KNB1-FDGRV' IS_KNB1-FDGRV,
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=SCREEN_1100_TAB_03',
' ' 'GS_KNB1-ZTERM' IS_KNB1-ZTERM,
' ' 'GS_KNB1-GUZTE' IS_KNB1-GUZTE,
' ' 'GS_KNB1-ZWELS' IS_KNB1-ZWELS,
' ' 'GS_KNB1-HBKID' IS_KNB1-HBKID,
' ' 'GS_KNB1-ZAHLS' IS_KNB1-ZAHLS,
' ' 'GS_KNB1-ZGRUP' IS_KNB1-ZGRUP.
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=BUS_MAIN_SAVE',
' ' 'GS_KNB1-BUSAB' IS_KNB1-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'.
IF IT_BDCMSG-MSGV1+0(1) = 'S'.
EV_KUNNR = IT_BDCMSG-MSGV1+1(9).
ELSE.
EV_KUNNR = IT_BDCMSG-MSGV1.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = EV_KUNNR
IMPORTING
OUTPUT = EV_KUNNR.
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
댓글 없음:
댓글 쓰기