Skip to Content

BAPI to update or change XREF1_HD Field in BKPF table in RERAIV

Sep 12, 2017 at 07:30 AM


avatar image
Former Member

Hi All,

After posting is done using contract number a document number is created, for that contract number we are raising invoice using RERAIV t-code.

While creating invoice for a contract number an invoice number is generated, that invoice number should be updated in XREF1_HD field in BKPF table.

I have tried using bapi_acc_document_post but bkpf table is not getting updated .Is there anyother BAPI which is used to update BKPF table?

If someone have resolved this issue please let me know.

Thanking you.

Mallikarjunan K

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

sivakumar M Sep 12, 2017 at 07:43 AM

Hi dear,

You should use below Function module after calling bapi_acc_document_post

if sy-subrc eq 0 .
wait = 'X'.


Then only It will update BKPF table.

or else You need to customize your own Function module from bapi_acc_document_post.

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Shiva,

But the header structure 'DOCUMENTHEADER' has no field which can be used for this purpose. How can i solve this problem?


Mallikarjunan K



You need to pass some data in document header . Create one work area for document header like this.

data: gs_head type BAPIACHE09.

Then pass required data in it.

gs_head-username = sy-uname.

gs_head-comp_code = <companycode>.

gs_head-doc_type = 'SA'. "Document Type
gs_head-ref_doc_no = <reference text. "Reference No
gs_head-fisc_year = <fiscal year>.

gs_head-doc_date = <date>

gs_head-pstng_date = <date>.

After that pass gs_head to document header.

Then Bapi will work.