*&---------------------------------------------------------------------*
*& Report Z_POST_CLEAR
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT z_post_clear.
DATA: fdc_accdoc_tax TYPE fdc_t_accdoc_tax,
fdc_accdoc_whtax TYPE fdc_t_accdoc_whtax,
fdc_accdoc_itm_to_be_clrd TYPE fdc_t_accdoc_itm_to_be_clrd,
fdc_accdoc_pay_diff TYPE fdc_t_accdoc_pay_diff,
accdoc_itm_copa TYPE fdc_t_accdoc_itm_copa,
fdc_accdoc_itm TYPE fdc_t_accdoc_itm,
accdoc_dispute TYPE fdc_t_accdoc_dispute,
accdoc_one_time_account TYPE fdc_t_accdoc_one_time_account,
itm_payment_only TYPE fdc_s_accdoc_with_item,
fdc_accdoc_warning_messages TYPE fdc_t_accdoc_warning_messages,
warning TYPE fdc_t_accdoc_warning_messages.
** Fill header info
DATA(headerinfo) = VALUE fdc_s_accdoc_hdr( bukrs = '0001'
blart = cl_abap_context_info=>get_system_date( )
budat = cl_abap_context_info=>get_system_date( )
waers = 'EUR'
hwaer = 'EUR' " Get the currencies from CDS View p_ldcmpcurr
hwae2 = 'EUR' " Get the currencies from CDS View p_ldcmpcurr
xblnr = 'Test13'
gjahr = '2023'
tcode = cl_fdc_posting_impl=>co_fdc_s_accdoc_hdr_tcode-ar_clearing "FBDC_C022'
auglv = 'UMBUCHNG'
curt1 = '10' " Get the currencies from CDS View p_ldcmpcurr
curt2 = '10' " Get the currencies from CDS View p_ldcmpcurr
awtyp = 'BKPFF'
augtx = 'cleared header text' ).
"Get the Open Items from the CDS view I_OperationalAcctgDocItem and loop at it and fill the item informations
DATA(iteminfo) = VALUE fdc_t_accdoc_itm(
( shkzg = 'S'
bschl = '17' " Other Clearing
bukrs = '0001'
gjahr = '2023'
wrbtr = 1500
dmbtr = 1500
dmbe2 = 1500
zuonr = 'zuonr'
kunnr = Customer 1 " for the GL clearing fill HKONT instead of KUNNR
posnr = '0000000001'
koart = 'D'
)
).
DATA(clearinfo) = VALUE fdc_t_accdoc_itm_to_be_clrd(
( belnr = '0100000000'"Get the Open Documents from the CDS view I_OperationalAcctgDocItem
bukrs = '0001'
gjahr = '2023'
awitem = '000002'
wrbtr = 100
dmbtr = 100
dmbe2 = 100
shkzg = 'H'
xaktp = abap_true
koart = 'D'
konko = Customer2
hkont = '1331100010'
)
).
** Simulate the posting to check the errors
cl_fdc_accdoc_post=>accdoc_simulate(
IMPORTING
et_ausz2 = DATA(ausz2)
et_ausz3 = DATA(ausz3)
et_message = DATA(return)
et_simulated_gl_view = DATA(simulated_gl_view)
et_fdc_accdoc_hdr_sim = DATA(fdc_accdoc_hdr_sim)
es_fdc_accdoc_disc_doc = DATA(fdc_accdoc_disc_doc)
CHANGING
cs_fdc_accdoc_hdr = headerinfo
ct_fdc_accdoc_tax = fdc_accdoc_tax
ct_fdc_accdoc_whtax = fdc_accdoc_whtax
ct_fdc_accdoc_itm_to_be_clrd = clearinfo
ct_fdc_accdoc_pay_diff = fdc_accdoc_pay_diff
ct_accdoc_itm_copa = accdoc_itm_copa
ct_fdc_accdoc_itm = iteminfo
ct_accdoc_dispute = accdoc_dispute
ct_accdoc_one_time_account = accdoc_one_time_account
cs_with_itm_payment_only = itm_payment_only
ct_fdc_accdoc_warning_messages = fdc_accdoc_warning_messages " Warning Messages
).
IF return IS INITIAL.
** For RAP based apps use thie function module with destination None to avoid commit dumps
CALL METHOD cl_fdc_accdoc_post=>accdoc_post
EXPORTING
is_fdc_accdoc_hdr = headerinfo
it_fdc_accdoc_itm = iteminfo
iv_ignore_warnings = abap_true
IMPORTING
et_message = DATA(message)
ev_awref = DATA(awref)
es_posted_document = DATA(posted_document)
CHANGING
ct_fdc_accdoc_itm_to_be_clrd = clearinfo
ct_fdc_accdoc_warning_messages = warning
RECEIVING
rv_save_rejected = DATA(rejected).
IF posted_document IS NOT INITIAL.
COMMIT WORK AND WAIT.
ENDIF.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
9 | |
6 | |
5 | |
5 | |
5 | |
5 | |
3 | |
3 | |
3 |