FORM FRM_EXECUTE_PARK.
DATA: L_TABIX TYPE SY-TABIX,
L_TABIX_CURRENT TYPE SY-TABIX,
L_RTRES TYPE CHAR01, "S/F
L_FIDOC_BELNR TYPE BELNR_D,
L_FIDOC_BUDAT TYPE BUDAT ,
L_FIDOC_GJAHR TYPE GJAHR,
L_RTMSG TYPE ZE_RTMSG.
CLEAR: GS_QY001.
GS_QY001-MANDT = SY-MANDT.
READ TABLE GT_ITEM ASSIGNING <FS_ITEM> WITH KEY CKBOX = 'X'.
IF SY-SUBRC EQ 0.
L_TABIX_CURRENT = SY-TABIX.
ENDIF.
DATA: LT_BKPF TYPE TABLE OF BKPF,
LT_BSEG TYPE TABLE OF BSEG,
LT_BSEC TYPE TABLE OF BSEC,
LT_BSET TYPE TABLE OF BSET,
LT_BSEZ TYPE TABLE OF BSEZ,
LS_BKPF TYPE BKPF,
LS_BSEG TYPE BSEG,
XEPBBP TYPE XFELD,
LV_MS TYPE STRING.
L_FIDOC_BUDAT = <FS_ITEM>-JYRQ.
L_FIDOC_GJAHR = <FS_ITEM>-JYRQ+0(4).
LS_BKPF-BUKRS = <FS_ITEM>-BUKRS.
LS_BKPF-GJAHR = L_FIDOC_GJAHR.
LS_BKPF-BLART = 'SA'.
LS_BKPF-BLDAT = SY-DATUM.
LS_BKPF-BUDAT = L_FIDOC_BUDAT.
LS_BKPF-WWERT = L_FIDOC_BUDAT.
LS_BKPF-MONAT = L_FIDOC_BUDAT+4(2).
LS_BKPF-USNAM = SY-UNAME.
LS_BKPF-XBLNR = <FS_ITEM>-JBR.
LS_BKPF-TCODE = 'FBV1'.
LS_BKPF-WAERS = 'CNY'.
LS_BKPF-HWAER = 'CNY'.
LS_BKPF-GLVOR = 'RFBU'.
* LS_BKPF-BKTXT = ''.
LS_BKPF-BKTXT = <FS_ITEM>-ZTEXT.
APPEND LS_BKPF TO LT_BKPF.
LS_BSEG-BUKRS = <FS_ITEM>-BUKRS.
LS_BSEG-GJAHR = L_FIDOC_GJAHR.
LS_BSEG-BUZEI = '001'.
LS_BSEG-BSCHL = '40'.
LS_BSEG-KOART = 'S'.
LS_BSEG-SHKZG = 'S'.
LS_BSEG-DMBTR = <FS_ITEM>-JYJE.
LS_BSEG-WRBTR = <FS_ITEM>-JYJE.
* GS_BSEG-PSWBT = '1'.
"GS_BSEG-PSWSL = ' CNY'.
"GS_BSEG-VORGN = 'RFBU'.
* GS_BSEG-KOKRS = '2000'.
* GS_BSEG-KOSTL = ''.
LS_BSEG-XKRES = 'X'.
LS_BSEG-HKONT = '0010021001'. "取配置表
LS_BSEG-KUNNR = ''.
LS_BSEG-RSTGR = '109'.
LS_BSEG-SGTXT = <FS_ITEM>-ZTEXT.
APPEND LS_BSEG TO LT_BSEG.
CLEAR LS_BSEG.
LS_BSEG-BUKRS = <FS_ITEM>-BUKRS.
LS_BSEG-GJAHR = L_FIDOC_GJAHR.
LS_BSEG-BUZEI = '002'.
LS_BSEG-BSCHL = <FS_ITEM>-DFJZM.
LS_BSEG-KOART = 'S'.
LS_BSEG-SHKZG = 'H'.
LS_BSEG-DMBTR = <FS_ITEM>-JYJE.
LS_BSEG-WRBTR = <FS_ITEM>-JYJE.
IF <FS_ITEM>-KOSTL IS NOT INITIAL.
LS_BSEG-KOKRS = '2000'.
LS_BSEG-KOSTL = <FS_ITEM>-KOSTL.
ENDIF.
LS_BSEG-XKRES = 'X'.
IF LS_BSEG-BSCHL = '11'.
SELECT SINGLE AKONT
FROM KNB1
INTO LS_BSEG-HKONT
WHERE KUNNR = <FS_ITEM>-DFKM
AND BUKRS = LS_BSEG-BUKRS.
LS_BSEG-SAKNR = LS_BSEG-HKONT.
LS_BSEG-KUNNR = <FS_ITEM>-DFKM.
LS_BSEG-KOART = 'D'.
IF L_FIDOC_BUDAT >= SY-DATUM.
LS_BSEG-ZFBDT = L_FIDOC_BUDAT.
ELSE.
LS_BSEG-ZFBDT = SY-DATUM.
ENDIF.
ELSE.
LS_BSEG-HKONT = <FS_ITEM>-DFKM.
ENDIF.
"LS_BSEG-KUNNR = '0000800509'.
"LS_BSEG-PRCTR = 'ZB00'.
"LS_BSEG-UMSKZ = 'A'.
LS_BSEG-SGTXT = <FS_ITEM>-ZTEXT.
APPEND LS_BSEG TO LT_BSEG.
CALL FUNCTION 'PRELIMINARY_POSTING_FB01'
EXPORTING
I_TCODE = 'FBV1'
IMPORTING
XEPBBP = XEPBBP
TABLES
T_BKPF = LT_BKPF
T_BSEG = LT_BSEG
T_BSEC = LT_BSEC
T_BSET = LT_BSET
T_BSEZ = LT_BSEZ.
IF SY-MSGTY CA 'SI'.
L_FIDOC_BELNR = SY-MSGV1.
L_RTRES = 'S'.
ELSEIF SY-MSGTY CA 'EA'.
L_RTRES = 'F'.
ENDIF.
ENDFORM.
SAP 预制凭证函数(非acc post)
最后编辑于 :
?著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事?!?“怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- SAP 会计凭证有过账、预制和暂记三种状态,区分三种状态的作用: 暂记凭证 (Hold):暂记凭证主要作用是暂时保...
- SAP MM 如果存在OPEN的盘点凭证,则不能再次创建盘点凭证 MI01, 保存, LI20去查询盘点凭证表, ...
- SAP 的会计凭证有以过账账凭证 (Posted)、预制凭证 (Parked) 和暂存凭证 (hold) 三种状态...