Skip to Content
0
Former Member
Nov 28, 2006 at 02:25 PM

BAPI error.. pls help

74 Views

Hi!

I would like to call function "BAPI_ACC_DOCUMENT_CHECK"

and I encounter the error:

<i>Type conflict when calling a function module (field length).</i>

First, I upload an excel file.

* _______________________________________________________ 
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 bapi 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 into <b>account gl, account payable </b>and <b>current amount</b>

  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 . 
  CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
    EXPORTING
      DOCUMENTHEADER    = bapiache09
    TABLES
      ACCOUNTGL         = gl_account
      ACCOUNTRECEIVABLE = py_account
      CURRENCYAMOUNT    = curr_amt
      RETURN            = ret_tab.
ENDFORM.                    " bapi_check

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?

thanks in advance!

best regards,

ying..