Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

BAPI_ACC_DOCUMENT_POST - Clearing not happening.

$
0
0

Hi Team,

 

I am trying to post accounting entry followed by clearing of the same ( in ref to FB05 )  using BAPI_ACC_DOCUMENT_POST.

 

My FI document get posted successfully and is also visible as required but, the clearing is not happening.

 

I searched alot for this combined activity and found the above BAPI suitable, but it seems some where i am missing something for getting clearing done.

 

I don't wont to write a BDC for F-03 (clearing). Can posting & clearing both be feasible by BAPI_ACC_DOCUMENT_POST.

 

Please find my code below and share your inputs.

 

wa_doc-obj_type = 'BKPFF'.

 

CONCATENATE '00' wa_outc-belnr INTO wa_doc-obj_key+0(12).

wa_doc-obj_key+10(4) = wa_outc-bukrs.

wa_doc-obj_key+14(4) = wa_outc-gjahr.

wa_doc-obj_key = '$'.

wa_doc-bus_act = 'RFBU'.

CONCATENATE sy-sysid 'CLNT' sy-mandt

             INTO wa_doc-obj_sys.

wa_doc-username = sy-uname.

 

wa_doc-header_txt = 'HEADER'.

wa_doc-comp_code = wa_outc-bukrs.

wa_doc-fisc_year = wa_outc-gjahr.

wa_doc-doc_date = sy-datum.

wa_doc-pstng_date = lv_budat.

wa_doc-doc_type = 'SA'.

CONCATENATE wa_outc-belnr wa_outc-gjahr INTO wa_doc-ref_doc_no.

wa_doc-fis_period = lv_monat.

 

wa_accgl-itemno_acc = '1'.

wa_accgl-gl_account = wa_outc-tkont.

wa_accgl-comp_code = wa_outc-bukrs.

wa_accgl-pstng_date = lv_budat.

wa_accgl-item_text = 'item text'.

wa_accgl-tax_code = wa_outc-zmwsk.

wa_accgl-fis_period = lv_monat.

wa_accgl-fisc_year = wa_outc-gjahr.

wa_accgl-profit_ctr = '0000601000'.

APPEND wa_accgl TO it_accgl.

 

wa_accgl-itemno_acc = '2'.

wa_accgl-gl_account = wa_outc-dhkont.

wa_accgl-comp_code = wa_outc-bukrs.

wa_accgl-pstng_date = lv_budat.

wa_accgl-item_text = 'item text'.

wa_accgl-tax_code = wa_outc-mwskz.

wa_accgl-fis_period = lv_monat.

wa_accgl-fisc_year = wa_outc-gjahr.

wa_accgl-profit_ctr = '0000601000'.

APPEND wa_accgl TO it_accgl.

 

wa_curr-itemno_acc = '1'.

wa_curr-curr_type  = '00'.

wa_curr-currency_iso = wa_outc-hwaer.

wa_curr-amt_doccur = wa_outc-hteis.

APPEND wa_curr TO it_curr.

 

wa_curr-itemno_acc = '2'.

wa_curr-curr_type  = '00'.

wa_curr-currency_iso = wa_outc-hwaer.

wa_curr-amt_doccur = wa_outc-hteis * -1.

APPEND wa_curr TO it_curr.

 

BREAK-POINT.

CLEAR : wa_obj_type, wa_obj_key, wa_obj_sys.

 

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

   EXPORTING

     documentheader = wa_doc

   IMPORTING

     obj_type       = wa_obj_type

     obj_key        = wa_obj_key

     obj_sys        = wa_obj_sys

   TABLES

     accountgl      = it_accgl

     currencyamount = it_curr

     return         = it_return.

 

LOOP AT it_return INTO wa_return.

   WRITE: / wa_return-type,

          wa_return-id(5),

          wa_return-number,

          wa_return-message(120),

          ' Ligne : ',wa_return-row.

 

   IF wa_return-type = 'S'.

     COMMIT WORK.

     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

   ENDIF.

   CLEAR : wa_return.

ENDLOOP.

 

Regards,

Anmol Saxena.


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>