09-30-2009 7:37 AM
Hi All, Have any one of you actually used this FM for parking documents successfully? If yes, can you please throw some light on what all has to be passed? A clear piece of code will help me a lot. Thanks in advance, Rahul
09-30-2009 8:07 AM
Hi,
Below is the sample piece of code for the FM to Park:
Please note some fields i have passed are extra and based on my requirement. Hence need not pass all the below:
Append to the respective internal tables and pass to the FM: in BKPF(header) and BSEG(item data and Currency data)
Pass:
i_tcode = 'FB01'
i_xcmpl = 'X' " Completion status
*Populate the header
Company code
ls_bkpf-bukrs = ls_posting2-bukrs.
Year
ls_bkpf-gjahr = ls_posting2-budat+0(4).
Document Type
ls_bkpf-blart = p_blart.
Posting date
ls_bkpf-bldat = ls_posting2-bldat.
Document Date
ls_bkpf-budat = ls_posting2-budat.
Translation date
ls_bkpf-wwert = sy-datum.
Created date
ls_bkpf-cpudt = sy-datum.
Created time
ls_bkpf-cputm = sy-uzeit.
Created by
ls_bkpf-usnam = sy-uname.
Period
lv_monat = ls_posting2-budat+4(2).
ls_bkpf-monat = lv_monat.
Transaction type
ls_bkpf-glvor = 'RFBV'.
Reference number
ls_bkpf-xblnr = ls_posting2-xblnr.
Header Text
ls_bkpf-bktxt = ls_posting2-bktxt.
Currency
ls_bkpf-waers = ls_posting2-waers.
Line item company code
ls_bseg-bukrs = ls_posting-bukrs1.
Fiscal year
ls_bseg-gjahr = ls_posting-budat+0(4).
ls_bseg-bschl = 50.
ls_bseg-shkzg = 'H'.
ls_bseg-saknr = ls_bseg-hkont.
ls_bseg-vorgn = 'RFBU'.
ls_bseg-hkont = ls_posting-newko
Amount
ls_bseg-wrbtr = ls_posting-wrbtr.
Item Text
ls_bseg-sgtxt = ls_posting-sgtxt.
Cost Center
ls_bseg-kostl = ls_posting-kostl.
Order Number
ls_bseg-aufnr = ls_posting-aufnr.
Profit Center
ls_bseg-prctr = ls_posting-prctr.
WBS element
ls_bseg-projk = ls_posting-projk.
Material
ls_bseg-matnr = ls_posting-matnr.
Tax code
ls_bseg-mwskz = ls_posting-mwskz.
Tax jurisdiction code
ls_bseg-txjcd = ls_posting-txjcd.
Populate local currency and group currency values.
Document currency amount
ls_icurr-wrbtr = ls_posting-wrbtr.
Local Currency
ls_icurr-hwaer = ls_bkpf-hwaer.
Document Currency
ls_icurr-waers = ls_bkpf-waers.
Date
ls_icurr-wwert = sy-datum.
Posting date
ls_icurr-bldat = ls_bkpf-bldat.
Document date
ls_icurr-budat = ls_bkpf-budat.
Rate type group currency
ls_icurr-kuty2 = ls_bkpf-kuty2.
Regards
Shiva
09-30-2009 8:07 AM
Hi,
Below is the sample piece of code for the FM to Park:
Please note some fields i have passed are extra and based on my requirement. Hence need not pass all the below:
Append to the respective internal tables and pass to the FM: in BKPF(header) and BSEG(item data and Currency data)
Pass:
i_tcode = 'FB01'
i_xcmpl = 'X' " Completion status
*Populate the header
Company code
ls_bkpf-bukrs = ls_posting2-bukrs.
Year
ls_bkpf-gjahr = ls_posting2-budat+0(4).
Document Type
ls_bkpf-blart = p_blart.
Posting date
ls_bkpf-bldat = ls_posting2-bldat.
Document Date
ls_bkpf-budat = ls_posting2-budat.
Translation date
ls_bkpf-wwert = sy-datum.
Created date
ls_bkpf-cpudt = sy-datum.
Created time
ls_bkpf-cputm = sy-uzeit.
Created by
ls_bkpf-usnam = sy-uname.
Period
lv_monat = ls_posting2-budat+4(2).
ls_bkpf-monat = lv_monat.
Transaction type
ls_bkpf-glvor = 'RFBV'.
Reference number
ls_bkpf-xblnr = ls_posting2-xblnr.
Header Text
ls_bkpf-bktxt = ls_posting2-bktxt.
Currency
ls_bkpf-waers = ls_posting2-waers.
Line item company code
ls_bseg-bukrs = ls_posting-bukrs1.
Fiscal year
ls_bseg-gjahr = ls_posting-budat+0(4).
ls_bseg-bschl = 50.
ls_bseg-shkzg = 'H'.
ls_bseg-saknr = ls_bseg-hkont.
ls_bseg-vorgn = 'RFBU'.
ls_bseg-hkont = ls_posting-newko
Amount
ls_bseg-wrbtr = ls_posting-wrbtr.
Item Text
ls_bseg-sgtxt = ls_posting-sgtxt.
Cost Center
ls_bseg-kostl = ls_posting-kostl.
Order Number
ls_bseg-aufnr = ls_posting-aufnr.
Profit Center
ls_bseg-prctr = ls_posting-prctr.
WBS element
ls_bseg-projk = ls_posting-projk.
Material
ls_bseg-matnr = ls_posting-matnr.
Tax code
ls_bseg-mwskz = ls_posting-mwskz.
Tax jurisdiction code
ls_bseg-txjcd = ls_posting-txjcd.
Populate local currency and group currency values.
Document currency amount
ls_icurr-wrbtr = ls_posting-wrbtr.
Local Currency
ls_icurr-hwaer = ls_bkpf-hwaer.
Document Currency
ls_icurr-waers = ls_bkpf-waers.
Date
ls_icurr-wwert = sy-datum.
Posting date
ls_icurr-bldat = ls_bkpf-bldat.
Document date
ls_icurr-budat = ls_bkpf-budat.
Rate type group currency
ls_icurr-kuty2 = ls_bkpf-kuty2.
Regards
Shiva
10-12-2009 3:26 PM
Hi Shiva,
I am using the same method as u explained over here,but passing very small item data. like posting key in belnr,account in hkont and amout in wrbtr.
But it is giving me the error like specify account number.
Could you please explain why it is happening.\
Regards,
Amar
09-30-2009 9:36 AM
Thanks.. That was useful.. Can you also tell me something - how do I capture the parked document number? When I test the FM in SE37, an information message pops up which gives me the Document No. So, in the program how can I capture the parked Doc No.? Also, can you suggest me an FM to post the parked documents? Thanks, Rahul
10-06-2009 12:01 PM
data: l_message type char30.
CALL FUNCTION 'PRELIMINARY_POSTING_FB01'
EXPORTING
i_xcmpl = g_park_complete
fs006_fb01 = c_fs006
i_tcode = 'FB01'
IMPORTING
XEPBBP =
TABLES
t_bkpf = t_bkpf header data.
t_bseg = lt_bseg line item data
t_bsec = t_bsec one time vendor data
t_bset = t_bset tax data
t_bsez = t_bsez
t_spltwt = t_with. Withholding tax
*Get parked document number
GET PARAMETER ID 'BLP' FIELD docno.
IF docno IS NOT INITIAL.
CONCATENATE docno comp year INTO l_message
SEPARATED BY space.
MESSAGE i022
WITH 'Document'(044) l_message
'Parked Successfully'(014).
you can use the same function module to post the Invioce.
i_xcmpl parameter if has value X means the document is for the posting.
else it will park the document.
Edited by: sharmalvn on Oct 6, 2009 1:02 PM
10-12-2009 3:47 PM
Hi ,
I am using the same method as u explained over here,but passing very small item data. like posting key in belnr,account in hkont and amout in wrbtr.
But it is giving me the error like specify account number.
Could you please explain why it is happening.\
Regards,
Amar
10-13-2009 8:50 AM
Hey, You got to fill both HKONT and SAKNR with the account numbers. Regards, Rahul
11-30-2009 2:37 PM
Hi,
Could you tell me how can assign profitability segment in PArking of FI document using FM PRELIMINARY_POSTING_FB01.
Regards,
Amar
12-15-2011 12:12 PM
Hi Amar,
Were you able to assign profitability segment in PArking of FI document using FM PRELIMINARY_POSTING_FB01?
Can you tell me how?
Thanks!