고정환율 적용을 위해 FBV1으로 아래와 같이 코딩 했습니다..
그런데 코딩블럭 에서 다음 단계로 넘어가질 않네요...
( 일단 코딩블럭에 값은 정확히 들어 갑니다... 마우스로 OK 클릭하면 다음 단계로 진행됨 )
제가 뭘 잘 못했을까요? 고수님들 도움 부탁 드립니다..
loop at gt_dock.
IF sy-tabix = 1.
clear : lv_first, bdcdata[].
* 해당월의 마지막 일자 일자 구해서 lv_ldate에 저장
PERFORM bdc_dynpro USING 'SAPLF040' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RF05V-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_field USING 'BKPF-BLDAT' lv_ldate.
PERFORM bdc_field USING 'BKPF-BUDAT' lv_ldate.
PERFORM bdc_field USING 'BKPF-BLART' 'SA'.
PERFORM bdc_field USING 'BKPF-BUKRS' p_kokrs.
PERFORM bdc_field USING 'BKPF-WAERS' 'USD'.
PERFORM bdc_field USING 'BKPF-BKTXT' ' '.
PERFORM bdc_field USING 'VBKPF-XBWAE' ' '.
ENDIF.
* 금액 변환
perform currency_convert using gt_dock-wrbtr
gt_dock-dmbtr
lv_amtd
lv_amtw.
if gt_dock-shkzg = 'S'.
IF lv_first = 'X'.
PERFORM bdc_dynpro USING 'SAPLF040' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RF05V-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
ENDIF.
PERFORM bdc_field USING 'RF05V-NEWBS' '40'. "차변
PERFORM bdc_field USING 'RF05V-NEWKO' gt_dock-hkont.
PERFORM bdc_dynpro USING 'SAPLF040' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RF05V-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_field USING 'BSEG-WRBTR' lv_amtd.
PERFORM bdc_field USING 'BSEG-DMBTR' lv_amtw.
PERFORM bdc_field USING 'BSEG-ZUONR' gt_dock-projk.
PERFORM bdc_field USING 'BSEG-SGTXT' gt_dock-ktext.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR' 'COBL-PS_POSID'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ENTE'.
PERFORM bdc_field USING 'COBL-GSBER' p_gsber.
PERFORM bdc_field USING 'COBL-KOSTL' 'DB005'.
PERFORM bdc_field USING 'COBL-PS_POSID' gt_dock-posid. "<============여기서 멈춤
lv_first = 'X'.
else.
IF lv_first = 'X'.
PERFORM bdc_dynpro USING 'SAPLF040' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RF05V-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
ENDIF.
PERFORM bdc_field USING 'RF05V-NEWBS' '50'. "차변
PERFORM bdc_field USING 'RF05V-NEWKO' gt_dock-hkont.
PERFORM bdc_dynpro USING 'SAPLF040' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR' 'BSEG-WRBTR'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_field USING 'BSEG-WRBTR' lv_amtd.
PERFORM bdc_field USING 'BSEG-DMBTR' lv_amtw.
PERFORM bdc_field USING 'BSEG-ZUONR' '건조보험료'.
PERFORM bdc_field USING 'BSEG-SGTXT' gt_dock-ktext.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR' 'COBL-GSBER'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ENTE'.
PERFORM bdc_field USING 'COBL-GSBER' p_gsber. "<============여기서 멈춤
lv_first = 'X'.
endif.
ENDLOOP.
댓글 2
-
버미!
2010.01.27 16:52
-
보경아빠
2010.01.29 03:56
버미님 감사합니다...
아래처럼 했더니 일단 전표는 들어가네요... ^^;
* Header
clear bdcdata. refresh bdcdata.
PERFORM bdc_dynpro USING 'SAPLF040' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RF05V-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_field USING 'BKPF-BLDAT' lv_ldate.
PERFORM bdc_field USING 'BKPF-BUDAT' lv_ldate.
PERFORM bdc_field USING 'BKPF-BLART' 'SA'.
PERFORM bdc_field USING 'BKPF-BUKRS' p_kokrs.
PERFORM bdc_field USING 'BKPF-WAERS' 'USD'.
PERFORM bdc_field USING 'BKPF-BKTXT' ' '.
PERFORM bdc_field USING 'VBKPF-XBWAE' ' '.
* Item
LOOP AT gt_dock.
WRITE gt_dock-wrbtr to lv_amtd left-justified currency 'USD'.
WRITE gt_dock-dmbtr to lv_amtw left-justified currency 'KRW'.
IF lv_first = 'X'.
PERFORM bdc_dynpro USING 'SAPLF040' '0330'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RF05V-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
ENDIF.
PERFORM bdc_field USING 'RF05V-NEWBS' gt_dock-bschl. "40/50
PERFORM bdc_field USING 'RF05V-NEWKO' gt_dock-hkont.
PERFORM bdc_dynpro USING 'SAPLF040' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR' 'BSEG-WRBTR'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ZK'.
PERFORM bdc_field USING 'BSEG-WRBTR' lv_amtd.
PERFORM bdc_field USING 'BSEG-DMBTR' lv_amtw.
PERFORM bdc_field USING 'BSEG-ZUONR' gt_dock-zuonr. "40:공사번호, 50:건조보험료
PERFORM bdc_field USING 'BSEG-SGTXT' gt_dock-ktext.
PERFORM bdc_field USING 'RF05V-NEWBS' gt_dock-bschl. "40/50
PERFORM bdc_field USING 'RF05V-NEWKO' gt_dock-hkont. "C/E
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR' 'COBL-GSBER'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ENTE'.
PERFORM bdc_field USING 'COBL-GSBER' p_gsber.
if gt_dock-hkont <> '1119361100'.
PERFORM bdc_field USING 'COBL-KOSTL' 'DB005'.
PERFORM bdc_field USING 'COBL-PS_POSID' gt_dock-posid.
endif.
lv_first = 'X'.
ENDLOOP.
지금 제가 구현한 내용이고요..정상적으로 전표가 생성므로 참고하세요..
CLEAR gt_bdcdata. REFRESH gt_bdcdata.
CLEAR gt_messtab. REFRESH gt_messtab.
DATA : l_wrbtr(15) TYPE c,
l_mwsts(15) TYPE c.
* Header
CLEAR : l_wrbtr, l_mwsts.
WRITE gs_bkpf-wrbtr TO l_wrbtr
LEFT-JUSTIFIED CURRENCY gs_bkpf-waers.
WRITE gs_bkpf-mwsts TO l_mwsts
LEFT-JUSTIFIED CURRENCY gs_bkpf-waers.
PERFORM dynpro USING:
'X' 'SAPLF040' '0100',
' ' 'BDC_CURSOR' 'RF05V-NEWKO',
' ' 'BDC_OKCODE' '/00',
' ' 'BKPF-BLDAT' gs_bkpf-budat, "Doc.Date
' ' 'BKPF-BLART' gs_bkpf-blart, "Doc.Type
' ' 'BKPF-BUKRS' gs_bkpf-bukrs, "Comp.Code
' ' 'BKPF-BUDAT' gs_bkpf-budat, "Posting Date
' ' 'BKPF-MONAT' gs_bkpf-monat, "Period
' ' 'BKPF-WAERS' gs_bkpf-waers, "Currency
' ' 'BKPF-XBLNR' gs_bkpf-xblnr, "Reference
' ' 'BKPF-BKTXT' gs_bkpf-bktxt, "Doc.Head.Txt
' ' 'RF05V-NEWBS' gs_bkpf-bschl, "Posting Key
' ' 'RF05V-NEWKO' gs_bkpf-hkont, "Account
'X' 'SAPLF040' '0302',
' ' 'BDC_CURSOR' 'RF05V-NEWKO',
' ' 'BDC_OKCODE' '/00',
' ' 'BSEG-WRBTR' l_wrbtr, "Amount
* ' ' 'BSEG-WMWST' l_mwsts, "Tax Amount
' ' 'BKPF-XMWST' gs_bkpf-xmwst, "Cal.Tax Chk
' ' 'BSEG-MWSKZ' gs_bkpf-mwskz, "Tax Code
' ' 'BSEG-ZTERM' gs_bkpf-zterm, "PaytTerms
' ' 'BSEG-ZUONR' gs_bkpf-xblnr, "Assignment
' ' 'BSEG-SGTXT' gs_bkpf-sgtxt, "Text
' ' 'RF05V-NEWBS' '40', "Posting Key
' ' 'RF05V-NEWKO' '53310507'. "Account
* Item
LOOP AT gt_bseg.
CLEAR : l_wrbtr.
WRITE gt_bseg-wrbtr TO l_wrbtr
LEFT-JUSTIFIED CURRENCY gt_bseg-waers.
PERFORM dynpro USING:
* ' ' 'RF05V-NEWBS' gt_bseg-bschl, "P. Key
* ' ' 'RF05V-NEWKO' gt_bseg-hkont, "Accot
'X' 'SAPLF040' '0300',
' ' 'BDC_CURSOR' 'BSEG-WRBTR',
' ' 'BDC_OKCODE' '/00',
' ' 'BSEG-WRBTR' l_wrbtr, "Amount
' ' 'BSEG-ZUONR' gs_bkpf-xblnr, "Assignt
' ' 'BSEG-SGTXT' gs_bkpf-sgtxt, "Text
' ' 'RF05V-NEWBS' gt_bseg-bschl, "P. Key
' ' 'RF05V-NEWKO' gt_bseg-hkont. "Account
* More
PERFORM dynpro USING:
'X' 'SAPLKACB' '0002',
' ' 'BDC_CURSOR' 'COBL-KDPOS',
' ' 'BDC_OKCODE' '=COBL_XERGO',
' ' 'COBL-KDAUF' gs_bkpf-aubel, "S/O No
' ' 'COBL-KDPOS' gs_bkpf-aupos. "S/O Item
* Get CO Info
PERFORM get_co_info USING gt_bseg-vbeln gt_bseg-posnr.
PERFORM dynpro USING:
'X' 'SAPLKEAK' '0300',
' ' 'BDC_CURSOR' 'RKEAK-FIELD(15)',
' ' 'BDC_OKCODE' '=P+',
' ' 'RKEAK-FIELD(01)' gs_co-kndnr, "Customer
' ' 'RKEAK-FIELD(02)' gs_co-artnr, "Product
' ' 'RKEAK-FIELD(03)' gs_co-fkart, "B.Type
' ' 'RKEAK-FIELD(07)' gs_co-werks, "Plant
' ' 'RKEAK-FIELD(08)' gs_co-vkorg, "S.Org
' ' 'RKEAK-FIELD(09)' gs_co-vtweg, "Distr.Ch
' ' 'RKEAK-FIELD(10)' gs_co-spart, "Division
' ' 'RKEAK-FIELD(13)' gs_co-prctr, "P. Cent.
' ' 'RKEAK-FIELD(15)' gs_co-auart, "S/O Type
'X' 'SAPLKEAK' '0300',
' ' 'BDC_CURSOR' 'RKEAK-FIELD(14)',
' ' 'BDC_OKCODE' '=WEIT',
' ' 'RKEAK-FIELD(01)' gs_co-brsch, "Industry
' ' 'RKEAK-FIELD(02)' gs_co-bzirk, "S. distr.
' ' 'RKEAK-FIELD(03)' gs_co-kmland, "Country
' ' 'RKEAK-FIELD(04)' gs_co-kmvtnr, "S.Emplo.
' ' 'RKEAK-FIELD(05)' gs_co-matkl, "Mat.Grp
' ' 'RKEAK-FIELD(06)' gs_co-mtart, "Mat. Type
' ' 'RKEAK-FIELD(07)' gs_co-vkbur, "S.Office
' ' 'RKEAK-FIELD(08)' gs_co-vkgrp, "S.Group
' ' 'RKEAK-FIELD(09)' gs_co-ww040, "Ori.S.OTy
' ' 'RKEAK-FIELD(10)' gs_co-ww050, "Region1
' ' 'RKEAK-FIELD(11)' gs_co-ww001, "Primy/Seco
' ' 'RKEAK-FIELD(12)' gs_co-ww010, "Steel Grd
' ' 'RKEAK-FIELD(13)' gs_co-ww020, "Surface
' ' 'RKEAK-FIELD(14)' gs_co-ww030. "Thickness
* More
PERFORM dynpro USING:
'X' 'SAPLKACB' '0002',
' ' 'BDC_CURSOR' 'COBL-GSBER',
' ' 'BDC_OKCODE' '=ENTE',
* ' ' 'COBL-GSBER' '2615',
' ' 'COBL-PRCTR' gs_co-prctr,
' ' 'COBL-KDAUF' gs_bkpf-aubel, "S/O No
' ' 'COBL-KDPOS' gs_bkpf-aupos. "S/O Item
ENDLOOP.
* Save
PERFORM dynpro USING:
'X' 'SAPLF040' '0300',
' ' 'BDC_CURSOR' 'BSEG-WRBTR',
' ' 'BDC_OKCODE' '=BP'.
PERFORM dynpro USING:
'X' 'SAPLKACB' '0002',
' ' 'BDC_CURSOR' 'COBL-GSBER',
' ' 'BDC_OKCODE' '/EENTE',
* ' ' 'COBL-GSBER' '2615',
' ' 'COBL-PRCTR' gs_co-prctr,
' ' 'COBL-KDAUF' gs_bkpf-aubel, "S/O No
' ' 'COBL-KDPOS' gs_bkpf-aupos. "S/O Item
REFRESH gt_messtab.
g_ctu_params-dismode = 'E'.
CALL TRANSACTION 'FBV1' USING gt_bdcdata
OPTIONS FROM g_ctu_params
MESSAGES INTO gt_messtab.