In copy control header settings is available to decide which reference value it is desireable to have in FI accounting document created by SD invoice.
Now lets see what are the options exists for Reference Number here:
Then if accounting document is created from F2 invoice then the Sales Order Number will be seen in the accounting document (FI) released from SD as shown below:
The accounting document above took the sales order from SD. But If you change to the following to attribute 'E' in Copy Control Reference field then Invoice number is intended to be filled.
Below there is the evidence that setting in copy control takes place in FI Accounting Document.
However in case accounting document shows reference value differently from Copy Control settings then some other settings or implementation may be taking a role.
The best way to understand what is happening is to debug the XACCIT-XBLNR field while releasing billing document to FI accounting. You may
start the debug in the ABAP RV_ACCOUNTING_DOCUMENT_CREATE function module. You will see that there are some user-exits during that function module execution. For example:
RV_ACCOUNTING_DOCUMENT_CREATE
call customer-function '008'
Or just starting debugging RV_ACCOUNTING_DOCUMENT_CREATE and watchpoint in XACCIT-XBLNR field. That is a bit slow process but it is efficiently to determine where that field has its value set. That field will later pass to BKPF-XBLNR which is the one is displayed in the FI accounting document.
Also for some countries if you maintain specific behavior the ABAP Code will call function module OFF_NUMBER_GLOBAL_NUMBERING which value can
affect the reference.
If you're using the official document numbering for your business process for country like Philippines. In standard, if the billing contains net value
0, the system would clear the "reference number" and would not generate the official number for this billing. In that case if you want to force the generation of an official document number for the billing documents transferred to this FI document type even when the billing document value is zero you may want to consider to set the "Force Numbering" indicator via:
SPRO
-> Cross-Application Components
-> General Application Functions
-> Cross-Application Document Numbering
-> Philippines
-> Assign Document Types to Document Classes
There are a list of country field which can receive different reference treatment. You can check more about the functionality in SE37[OFF_NUMBER_GLOBAL_NUMBERING] > GoTo menu > Documentation menu item.
I hope this documentation is helpful to clarify the causes of unexpected value in Accounting Document Reference Field.