<?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 error in BAPI_ACC_DOCUMENT_CHECK in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-acc-document-check/m-p/1697687#M306010</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I would like to call function "BAPI_ACC_DOCUMENT_CHECK" and I encounter the error: &amp;lt;i&amp;gt;Type conflict when calling a function module (field length).&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, I upload an excel file. Then, I fill in my document header and line items as below: &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* _______________________________________________________ 
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
      FILENAME                = p_file
      I_BEGIN_COL             = '1'
      I_BEGIN_ROW             = '7'
      I_END_COL               = '21'
      I_END_ROW               = '999'
    TABLES
      INTERN                  = intern
    EXCEPTIONS
      INCONSISTENT_PARAMETERS = 1
      UPLOAD_OLE              = 2
      OTHERS                  = 3.

 SORT intern by row col.

* I loop at the intern and append to an internal table 'xcel'.
* then I fill in the document header 'bapiache09'.

      bapiache09-doc_type   = 'PC'. 
      bapiache09-doc_date   = sy-datum.
      bapiache09-pstng_date = p_budat.         "p_budat is declared as 
                                              "bapiache09-pstng_date on selection screen
      bapiache09-comp_code  = 'B000'. 
      bapiache09-header_txt = 'SCTA (AB28)-P11/06'.
      bapiache09-ref_doc_no = 'Test'. 
      bapiache09-username = sy-uname.
      bapiache09-bus_act = 'RFBU'.

* now i fill in the line items
  LOOP AT xcel INTO wa_xcel.

    ADD 1 to item_no.

* internal table of gl account, type bapiacap09
    IF wa_xcel-post_key EQ '40' OR wa_xcel-post_key EQ '50'.
      wa_gl_account-itemno_acc = item_no.
      wa_gl_account-doc_type   = wa_xcel-fld2.
      wa_gl_account-gl_account  = wa_xcel-fld3.
      wa_gl_account-costcenter = wa_xcel-fld7.
      wa_gl_account-alloc_nmbr = wa_xcel-fld11.
      wa_gl_account-item_text  = wa_xcel-fld12.
      wa_gl_account-cs_trans_t = wa_xcel-fld18.
      wa_gl_account-tax_code   = wa_xcel-fld20.
      APPEND wa_gl_account TO gl_account.
      CLEAR wa_gl_account.
* internal table of payable account, type bapiacap09
    ELSEIF wa_xcel-post_key EQ '21' OR wa_xcel-post_key EQ '31'.
      wa_py_account-itemno_acc = item_no.
      wa_py_account-vendor_no  = wa_xcel-fld3.
      wa_py_account-bline_date = wa_xcel-fld5.
      wa_py_account-alloc_nmbr = wa_xcel-fld11.
      wa_py_account-item_text  = wa_xcel-fld12.
      wa_py_account-sp_gl_ind  = wa_xcel-fld14.
      wa_py_account-tax_code   = wa_xcel-fld20.
      APPEND wa_py_account TO py_account.
      CLEAR wa_py_account.
    ENDIF.

* internal table of currency amount, type bapiaccr09.
    wa_curr_amt-itemno_acc = item_no.
    wa_curr_amt-currency = wa_xcel-fld6.
    wa_curr_amt-amt_doccur = wa_xcel-fld15.
    APPEND wa_curr_amt TO curr_amt.
    CLEAR wa_curr_amt.
  ENDLOOP.

  PERFORM bapi_check.
 ENDFORM.                    " fill_line_item

*_______________________________________________
FORM bapi_check .
  DATA: wa_ret_tab    LIKE LINE OF ret_tab.

  CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
    EXPORTING
      DOCUMENTHEADER    = bapiache09
    TABLES
      ACCOUNTGL         = gl_account
      ACCOUNTRECEIVABLE = py_account
      CURRENCYAMOUNT    = curr_amt
      RETURN            = ret_tab.
ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know what is the exact problem as I declared all the internal tables according to the type in FM 'BAPI_ACC_DOCUMENT_CHECK'. Why I get the error of type conflict?&lt;/P&gt;&lt;P&gt;thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ying ying..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Nov 2006 10:04:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-11-28T10:04:55Z</dc:date>
    <item>
      <title>error in BAPI_ACC_DOCUMENT_CHECK</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-acc-document-check/m-p/1697687#M306010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I would like to call function "BAPI_ACC_DOCUMENT_CHECK" and I encounter the error: &amp;lt;i&amp;gt;Type conflict when calling a function module (field length).&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, I upload an excel file. Then, I fill in my document header and line items as below: &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* _______________________________________________________ 
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
      FILENAME                = p_file
      I_BEGIN_COL             = '1'
      I_BEGIN_ROW             = '7'
      I_END_COL               = '21'
      I_END_ROW               = '999'
    TABLES
      INTERN                  = intern
    EXCEPTIONS
      INCONSISTENT_PARAMETERS = 1
      UPLOAD_OLE              = 2
      OTHERS                  = 3.

 SORT intern by row col.

* I loop at the intern and append to an internal table 'xcel'.
* then I fill in the document header 'bapiache09'.

      bapiache09-doc_type   = 'PC'. 
      bapiache09-doc_date   = sy-datum.
      bapiache09-pstng_date = p_budat.         "p_budat is declared as 
                                              "bapiache09-pstng_date on selection screen
      bapiache09-comp_code  = 'B000'. 
      bapiache09-header_txt = 'SCTA (AB28)-P11/06'.
      bapiache09-ref_doc_no = 'Test'. 
      bapiache09-username = sy-uname.
      bapiache09-bus_act = 'RFBU'.

* now i fill in the line items
  LOOP AT xcel INTO wa_xcel.

    ADD 1 to item_no.

* internal table of gl account, type bapiacap09
    IF wa_xcel-post_key EQ '40' OR wa_xcel-post_key EQ '50'.
      wa_gl_account-itemno_acc = item_no.
      wa_gl_account-doc_type   = wa_xcel-fld2.
      wa_gl_account-gl_account  = wa_xcel-fld3.
      wa_gl_account-costcenter = wa_xcel-fld7.
      wa_gl_account-alloc_nmbr = wa_xcel-fld11.
      wa_gl_account-item_text  = wa_xcel-fld12.
      wa_gl_account-cs_trans_t = wa_xcel-fld18.
      wa_gl_account-tax_code   = wa_xcel-fld20.
      APPEND wa_gl_account TO gl_account.
      CLEAR wa_gl_account.
* internal table of payable account, type bapiacap09
    ELSEIF wa_xcel-post_key EQ '21' OR wa_xcel-post_key EQ '31'.
      wa_py_account-itemno_acc = item_no.
      wa_py_account-vendor_no  = wa_xcel-fld3.
      wa_py_account-bline_date = wa_xcel-fld5.
      wa_py_account-alloc_nmbr = wa_xcel-fld11.
      wa_py_account-item_text  = wa_xcel-fld12.
      wa_py_account-sp_gl_ind  = wa_xcel-fld14.
      wa_py_account-tax_code   = wa_xcel-fld20.
      APPEND wa_py_account TO py_account.
      CLEAR wa_py_account.
    ENDIF.

* internal table of currency amount, type bapiaccr09.
    wa_curr_amt-itemno_acc = item_no.
    wa_curr_amt-currency = wa_xcel-fld6.
    wa_curr_amt-amt_doccur = wa_xcel-fld15.
    APPEND wa_curr_amt TO curr_amt.
    CLEAR wa_curr_amt.
  ENDLOOP.

  PERFORM bapi_check.
 ENDFORM.                    " fill_line_item

*_______________________________________________
FORM bapi_check .
  DATA: wa_ret_tab    LIKE LINE OF ret_tab.

  CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
    EXPORTING
      DOCUMENTHEADER    = bapiache09
    TABLES
      ACCOUNTGL         = gl_account
      ACCOUNTRECEIVABLE = py_account
      CURRENCYAMOUNT    = curr_amt
      RETURN            = ret_tab.
ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know what is the exact problem as I declared all the internal tables according to the type in FM 'BAPI_ACC_DOCUMENT_CHECK'. Why I get the error of type conflict?&lt;/P&gt;&lt;P&gt;thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ying ying..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Nov 2006 10:04:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-acc-document-check/m-p/1697687#M306010</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-28T10:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: error in BAPI_ACC_DOCUMENT_CHECK</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-acc-document-check/m-p/1697688#M306011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I have figured out what is the problem, I passed the py_account to ACCOUNTRECEIVABLE. It should be ACCOUNTPAYABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FORM bapi_check . 
  CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
    EXPORTING
      DOCUMENTHEADER    = bapiache09
    TABLES
      ACCOUNTGL         = gl_account
*      ACCOUNTRECEIVABLE = py_account
      &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;lt;b&amp;gt;ACCOUNTPAYABLE &amp;lt;/b&amp;gt;= py_account&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;"should be payable account, not receivable account

      CURRENCYAMOUNT    = curr_amt
      RETURN            = ret_tab.
ENDFORM.                    " bapi_check
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;ying&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2006 01:58:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-acc-document-check/m-p/1697688#M306011</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-29T01:58:55Z</dc:date>
    </item>
  </channel>
</rss>

