<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic SAP VBA interfacing - error: FI/CO interface: Inconsistent FI/CO document header data for updating in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-vba-interfacing-error-fi-co-interface-inconsistent-fi-co-document/m-p/10247050#M1828813</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently I'm working with excel SAP interfacing. For this I am using VBA to call different BAPI functions.&lt;/P&gt;&lt;P&gt;I have already some interface scripts working, however I have also one which I cannot discover what I'm missing.&lt;/P&gt;&lt;P&gt;The VBA code is to reach &lt;STRONG&gt;BAPI_ACC_DOCUMENT_POST&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My error is ---&amp;gt; FI/CO interface: Inconsistent FI/CO document header data for updating&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I'm appealing to you SAP bapi VBA gurus whether you have any ideas how to fix my issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm attaching below my code for you to review:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Option Explicit&lt;/P&gt;&lt;P&gt;' Declaration for the necessary objects&lt;/P&gt;&lt;P&gt;Dim objBAPICortrol, objConnection, objCreateMaterial, objReturn As Object&lt;/P&gt;&lt;P&gt;Dim objPRFCT, objNTXT, objDTXT As Object&lt;/P&gt;&lt;P&gt;Dim vLastRow, vRows As Integer&lt;/P&gt;&lt;P&gt;Dim objMaterial1, objMaterial2, retMess As Object&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub Batch()&lt;/P&gt;&lt;P&gt;' Getting the last filled Row in Column&lt;/P&gt;&lt;P&gt;vLastRow = Cells(Rows.Count, "A").End(xlUp).Row&lt;/P&gt;&lt;P&gt;' Setting the necessary variables for R/3 connection&lt;/P&gt;&lt;P&gt;Set objBAPICortrol = CreateObject("SAP.functions")&lt;/P&gt;&lt;P&gt;Set objConnection = objBAPICortrol.Connection&lt;/P&gt;&lt;P&gt;objConnection.System = "SYSTEM NAME"&lt;/P&gt;&lt;P&gt;objConnection.Client = "Client number"&lt;/P&gt;&lt;P&gt;objConnection.user = "USERNAME"&lt;/P&gt;&lt;P&gt;objConnection.Password = "PASSWORD"&lt;/P&gt;&lt;P&gt;objConnection.Language = "EN"&lt;/P&gt;&lt;P&gt;' Establish a connection&lt;/P&gt;&lt;P&gt;If objConnection.logon(0, False) &amp;lt;&amp;gt; False Then&lt;/P&gt;&lt;P&gt;'MsgBox "Connection Established"&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;On Error Resume Next&lt;/P&gt;&lt;P&gt;' Assign the Parameters&lt;/P&gt;&lt;P&gt;Set objCreateMaterial = objBAPICortrol.Add("BAPI_ACC_DOCUMENT_POST")&lt;/P&gt;&lt;P&gt;Set objMaterial = objCreateMaterial.Exports.Item("DOCUMENTHEADER")&lt;/P&gt;&lt;P&gt;Set objMaterial1 = objCreateMaterial.Tables.Item("ACCOUNTGL")&lt;/P&gt;&lt;P&gt;Set objMaterial2 = objCreateMaterial.Tables.Item("CURRENCYAMOUNT")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'Set Values&lt;/P&gt;&lt;P&gt;objMaterial.Value("USERNAME") = "USERNAME"&lt;/P&gt;&lt;P&gt;objMaterial.Value("HEADER_TXT") = "BAPITEST"&lt;/P&gt;&lt;P&gt;objMaterial.Value("COMP_CODE") = "0001"&lt;/P&gt;&lt;P&gt;objMaterial.Value("PSTNG_DATE") = "20140506"&lt;/P&gt;&lt;P&gt;objMaterial.Value("TRANS_DATE") = "20140506"&lt;/P&gt;&lt;P&gt;objMaterial.Value("DOC_DATE") = "20140506"&lt;/P&gt;&lt;P&gt;objMaterial.Value("FISC_YEAR") = "2014"&lt;/P&gt;&lt;P&gt;objMaterial.Value("DOC_TYPE") = "SA"&lt;/P&gt;&lt;P&gt;objMaterial.Value("REF_DOC_NO") = "BAPITEST"&lt;/P&gt;&lt;P&gt;objMaterial.Value("FIS_PERIOD") = "00"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;objMaterial1.Rows.Add&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "ITEMNO_ACC") = "1"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "GL_ACCOUNT") = "0007180000"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "ITEM_TEXT") = "BAPITEST1"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "DOC_TYPE") = "SA"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "COMP_CODE") = "0001"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "PROFIT_CTR") = "AZ1111" ----&amp;gt;'profit center is normally having 10CHARS but as there are letters I'm not using zeros at the beginning&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "ITEMNO_ACC") = "2"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "GL_ACCOUNT") = "0007180000"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "ITEM_TEXT") = "BAPITEST1"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "DOC_TYPE") = "SA"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "COMP_CODE") = "0001"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "PROFIT_CTR") = "AZ1111"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;objMaterial2.Rows.Add&lt;/P&gt;&lt;P&gt;objMaterial2.Value(1, "ITEMNO_ACC") = "1"&lt;/P&gt;&lt;P&gt;objMaterial2.Value(1, "CURRENCY") = "EUR"&lt;/P&gt;&lt;P&gt;objMaterial2.Value(1, "AMT_DOCCUR") = "-1.00"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;objMaterial2.Value(1, "ITEMNO_ACC") = "2"&lt;/P&gt;&lt;P&gt;objMaterial2.Value(1, "CURRENCY") = "EUR"&lt;/P&gt;&lt;P&gt;objMaterial2.Value(1, "AMT_DOCCUR") = "1.00"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;' Function call&lt;/P&gt;&lt;P&gt;objCreateMaterial.call&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set objReturn = objBAPICortrol.Add("BAPI_TRANSACTION_COMMIT")&lt;/P&gt;&lt;P&gt;objReturn.call&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set retMess = objCreateMaterial.Tables.Item("RETURN")&lt;/P&gt;&lt;P&gt;If retMess Is Nothing Then&lt;/P&gt;&lt;P&gt;MsgBox retMess.Value(1, "MESSAGE")&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;' Get return parameters &amp;amp; display in excel&lt;/P&gt;&lt;P&gt;Set objReturn = objCreateMaterial.Tables("RETURN")&lt;/P&gt;&lt;P&gt;ActiveSheet.Cells(5, 1) = retMess.Value(2, "MESSAGE")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 May 2014 15:48:54 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2014-05-06T15:48:54Z</dc:date>
    <item>
      <title>SAP VBA interfacing - error: FI/CO interface: Inconsistent FI/CO document header data for updating</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-vba-interfacing-error-fi-co-interface-inconsistent-fi-co-document/m-p/10247050#M1828813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently I'm working with excel SAP interfacing. For this I am using VBA to call different BAPI functions.&lt;/P&gt;&lt;P&gt;I have already some interface scripts working, however I have also one which I cannot discover what I'm missing.&lt;/P&gt;&lt;P&gt;The VBA code is to reach &lt;STRONG&gt;BAPI_ACC_DOCUMENT_POST&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My error is ---&amp;gt; FI/CO interface: Inconsistent FI/CO document header data for updating&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I'm appealing to you SAP bapi VBA gurus whether you have any ideas how to fix my issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm attaching below my code for you to review:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Option Explicit&lt;/P&gt;&lt;P&gt;' Declaration for the necessary objects&lt;/P&gt;&lt;P&gt;Dim objBAPICortrol, objConnection, objCreateMaterial, objReturn As Object&lt;/P&gt;&lt;P&gt;Dim objPRFCT, objNTXT, objDTXT As Object&lt;/P&gt;&lt;P&gt;Dim vLastRow, vRows As Integer&lt;/P&gt;&lt;P&gt;Dim objMaterial1, objMaterial2, retMess As Object&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub Batch()&lt;/P&gt;&lt;P&gt;' Getting the last filled Row in Column&lt;/P&gt;&lt;P&gt;vLastRow = Cells(Rows.Count, "A").End(xlUp).Row&lt;/P&gt;&lt;P&gt;' Setting the necessary variables for R/3 connection&lt;/P&gt;&lt;P&gt;Set objBAPICortrol = CreateObject("SAP.functions")&lt;/P&gt;&lt;P&gt;Set objConnection = objBAPICortrol.Connection&lt;/P&gt;&lt;P&gt;objConnection.System = "SYSTEM NAME"&lt;/P&gt;&lt;P&gt;objConnection.Client = "Client number"&lt;/P&gt;&lt;P&gt;objConnection.user = "USERNAME"&lt;/P&gt;&lt;P&gt;objConnection.Password = "PASSWORD"&lt;/P&gt;&lt;P&gt;objConnection.Language = "EN"&lt;/P&gt;&lt;P&gt;' Establish a connection&lt;/P&gt;&lt;P&gt;If objConnection.logon(0, False) &amp;lt;&amp;gt; False Then&lt;/P&gt;&lt;P&gt;'MsgBox "Connection Established"&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;On Error Resume Next&lt;/P&gt;&lt;P&gt;' Assign the Parameters&lt;/P&gt;&lt;P&gt;Set objCreateMaterial = objBAPICortrol.Add("BAPI_ACC_DOCUMENT_POST")&lt;/P&gt;&lt;P&gt;Set objMaterial = objCreateMaterial.Exports.Item("DOCUMENTHEADER")&lt;/P&gt;&lt;P&gt;Set objMaterial1 = objCreateMaterial.Tables.Item("ACCOUNTGL")&lt;/P&gt;&lt;P&gt;Set objMaterial2 = objCreateMaterial.Tables.Item("CURRENCYAMOUNT")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'Set Values&lt;/P&gt;&lt;P&gt;objMaterial.Value("USERNAME") = "USERNAME"&lt;/P&gt;&lt;P&gt;objMaterial.Value("HEADER_TXT") = "BAPITEST"&lt;/P&gt;&lt;P&gt;objMaterial.Value("COMP_CODE") = "0001"&lt;/P&gt;&lt;P&gt;objMaterial.Value("PSTNG_DATE") = "20140506"&lt;/P&gt;&lt;P&gt;objMaterial.Value("TRANS_DATE") = "20140506"&lt;/P&gt;&lt;P&gt;objMaterial.Value("DOC_DATE") = "20140506"&lt;/P&gt;&lt;P&gt;objMaterial.Value("FISC_YEAR") = "2014"&lt;/P&gt;&lt;P&gt;objMaterial.Value("DOC_TYPE") = "SA"&lt;/P&gt;&lt;P&gt;objMaterial.Value("REF_DOC_NO") = "BAPITEST"&lt;/P&gt;&lt;P&gt;objMaterial.Value("FIS_PERIOD") = "00"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;objMaterial1.Rows.Add&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "ITEMNO_ACC") = "1"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "GL_ACCOUNT") = "0007180000"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "ITEM_TEXT") = "BAPITEST1"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "DOC_TYPE") = "SA"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "COMP_CODE") = "0001"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "PROFIT_CTR") = "AZ1111" ----&amp;gt;'profit center is normally having 10CHARS but as there are letters I'm not using zeros at the beginning&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "ITEMNO_ACC") = "2"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "GL_ACCOUNT") = "0007180000"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "ITEM_TEXT") = "BAPITEST1"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "DOC_TYPE") = "SA"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "COMP_CODE") = "0001"&lt;/P&gt;&lt;P&gt;objMaterial1.Value(1, "PROFIT_CTR") = "AZ1111"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;objMaterial2.Rows.Add&lt;/P&gt;&lt;P&gt;objMaterial2.Value(1, "ITEMNO_ACC") = "1"&lt;/P&gt;&lt;P&gt;objMaterial2.Value(1, "CURRENCY") = "EUR"&lt;/P&gt;&lt;P&gt;objMaterial2.Value(1, "AMT_DOCCUR") = "-1.00"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;objMaterial2.Value(1, "ITEMNO_ACC") = "2"&lt;/P&gt;&lt;P&gt;objMaterial2.Value(1, "CURRENCY") = "EUR"&lt;/P&gt;&lt;P&gt;objMaterial2.Value(1, "AMT_DOCCUR") = "1.00"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;' Function call&lt;/P&gt;&lt;P&gt;objCreateMaterial.call&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set objReturn = objBAPICortrol.Add("BAPI_TRANSACTION_COMMIT")&lt;/P&gt;&lt;P&gt;objReturn.call&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set retMess = objCreateMaterial.Tables.Item("RETURN")&lt;/P&gt;&lt;P&gt;If retMess Is Nothing Then&lt;/P&gt;&lt;P&gt;MsgBox retMess.Value(1, "MESSAGE")&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;' Get return parameters &amp;amp; display in excel&lt;/P&gt;&lt;P&gt;Set objReturn = objCreateMaterial.Tables("RETURN")&lt;/P&gt;&lt;P&gt;ActiveSheet.Cells(5, 1) = retMess.Value(2, "MESSAGE")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2014 15:48:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-vba-interfacing-error-fi-co-interface-inconsistent-fi-co-document/m-p/10247050#M1828813</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-06T15:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: SAP VBA interfacing - error: FI/CO interface: Inconsistent FI/CO document header data for updating</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-vba-interfacing-error-fi-co-interface-inconsistent-fi-co-document/m-p/10247051#M1828814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;after some searching I've discovered that once I'm creating &lt;STRONG&gt;next line&lt;/STRONG&gt; for accounting document it is not working properly.&lt;/P&gt;&lt;P&gt;When I debug the BAPI in SE37 after inserting new line it is asking for GL account input, however if I run it using VBA and delete the account from the code, the return message is not giving me any error that GL account is missing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate any ideas.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2014 19:11:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-vba-interfacing-error-fi-co-interface-inconsistent-fi-co-document/m-p/10247051#M1828814</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-07T19:11:23Z</dc:date>
    </item>
  </channel>
</rss>

