ZFI_VENDOR_CREATE
DATA : ls_lfa1 LIKE lfa1.
DATA : ls_lfb1 LIKE lfb1.
DATA : lv_lifnr TYPE lifnr,
lv_msgty TYPE msgty,
lv_msgtx TYPE msgtx.
CLEAR : ls_lfa1, ls_lfb1.
ls_lfa1-ktokk = 'XXXX'.
ls_lfa1-name1 = 이름
ls_lfa1-telf1 = 전화번호
ls_lfa1-land1 = 'KR'.
ls_lfa1-ort01 = 주소
ls_lfa1-stras = 주소
ls_lfa1-stcd2 = 사업자번호
ls_lfa1-j_1kfrepre = 가맹점주명
ls_lfa1-j_1kftbus = 업종
ls_lfb1-akont = 총계정원장의 조정 계정
ls_lfb1-zterm = 'C001'.
ls_lfb1-bukrs = '1000'.
ls_lfb1-guzte = 'C001'.
ls_lfb1-fdgrv = 'VJ'.
CALL FUNCTION 'ZFI_VENDOR_CREATE'
EXPORTING
is_lfa1 = ls_lfa1
is_lfb1 = ls_lfb1
iv_laiso = 'KO'
IMPORTING
ev_lifnr = lv_lifnr
ev_msgty = lv_msgty
ev_msgtx = lv_msgtx.
* 함수코딩
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.
IF IV_LAISO IS INITIAL.
SELECT SINGLE LAISO INTO IV_LAISO
FROM T002
WHERE SPRAS = SY-LANGU.
ENDIF.
SET PARAMETER ID 'BUK' FIELD IS_LFB1-BUKRS.
SET PARAMETER ID 'BPA' FIELD ' '.
SET PARAMETER ID 'LND' FIELD IS_LFA1-LAND1.
PERFORM DYNPRO USING:
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=SCREEN_1000_CRE_ORGA',
'X' 'SAPLBUS_LOCATOR' '3000',
' ' 'BDC_OKCODE' '=SCREEN_1110_CHG_ROLE',
' ' 'BUS_JOEL_MAIN-CREATION_NUMBER' IS_LFA1-LIFNR,
' ' 'BUS_JOEL_MAIN-CREATION_GROUP' IS_LFA1-KTOKK,
' ' 'BUS_JOEL_MAIN-PARTNER_ROLE' 'FLVN00',
' ' 'ADDR1_DATA-COUNTRY' IS_LFA1-LAND1,
' ' 'BUT000-NAME_ORG1' IS_LFA1-NAME1.
PERFORM DYNPRO USING:
'X' 'SAPLSPO1' '0600',
' ' 'BDC_OKCODE' '=OPT1'.
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,
' ' 'ADDR1_DATA-REMARK' IV_REMARK,
' ' 'SZA1_D0100-TEL_NUMBER' IS_LFA1-TELF1,
' ' 'SZA1_D0100-MOB_NUMBER' IS_LFA1-TELF2,
' ' 'SZA1_D0100-FAX_NUMBER' IS_LFA1-TELFX,
' ' 'SZA1_D0100-SMTP_ADDR' IV_EMAIL.
**<< 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.
PERFORM DYNPRO USING:
' ' 'DFKKBPTAXNUM-TAXTYPE(02)' 'KR1',
' ' 'DFKKBPTAXNUM-TAXNUMXL(02)' IS_LFA1-STCD1.
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',
'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 = '214'.
IF SY-SUBRC NE 0.
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 = '244'. "역할생성
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.
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.
WRITE / EV_MSGTX.
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.
댓글 없음:
댓글 쓰기