Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI error.. pls help

Former Member
0 Kudos

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..

7 REPLIES 7

Former Member
0 Kudos

Hi,

Can you send me the declaration part also.

thanks

sekhar

0 Kudos

My declarations of data objects and internal tables are as below:


"Table that used as document header in BAPI_ACC_DOCUMENT_CHECK
TABLES: bapiache09.

"internal table used in FM 'ALSM_EXCEL_TO_INTERNAL_TABLE'
DATA : intern TYPE TABLE OF alsmex_tabline.

" xcel will be used to store data from intern
TYPES: BEGIN OF st_excel.
             fld1 TYPE bapiache-itemno_acc,
             fld2 TYPE bapiacgl-doc_type,
             fld3 TYPE bapiacgl-gl_account,
             fld4 TYPE bapiache-doc_date,
             fld5 TYPE bapiacap-bline_date,
             fld6 TYPE bapiache-itemno_acc,
             fld7 TYPE bapiacgl-costcenter,
             fld8 TYPE bapiache-comp_code,
             fld9 TYPE bapiache-header-txt,
             fld10 TYPE bapiache-ref_doc_no,
             fld11 TYPE bapiacgl-alloc_nmbr,
             fld12 TYPE bapiacgl-item_text,
             post_key(2),
             fld14 TYPE bapiacap-sp_gl_ind,
             fld15 TYPE bapiachecr-amt_doccur,
             fld16 TYPE bapiaccr-currency,
             fld18 TYPE bapiacgl-cs_trans_t,
             fld20 TYPE bapiacgl-tax_code,
        END OF st_excel.

DATA: xcel TYPE STANDARD TABLE OF st_excel,
      wa_xcel LIKE LINE OF xcel.

"internal table which will be used in FM 'BAPI_ACC_DOCUMENT_CHECK'  
DATA: gl_account TYPE TABLE OF bapiacgl09,
      py_account TYPE TABLE OF bapiacap09,
      curr_amt TYPE TABLE OF bapiaccr09,
      wa_gl_account LIKE LINE OF gl_account,
      wa_py_account LIKE LINE OF py_account,
      wa_curr_amt LIKE LINE OF wa_curr.

DATA: item_n TYPE bapiache09-itemno_acc.

Former Member
0 Kudos

check if ur filname of type RLGRAP-FILENAME and

data :p_file like RLGRAP-FILENAME.

data : intern like alsmex_tabline occurs 0 with header line.

Message was edited by:

chandrasekhar jagarlamudi

Former Member
0 Kudos

Hi,

If the error you are facing is the syntax error, you can just define all your variables like the one in Associated Type column which is next to the Parameter names in your FM Interface

former_member181962
Active Contributor
0 Kudos

The dump analysis will clearly state for which parameter did this happen.

If not the bapi fm, it must be the other fm.

Regards,

Ravi

raja_thangamani
Active Contributor
0 Kudos

Hi,

Make sure the parameter as follows:

data: bapiache09 LIKE bapiache09,
gl_account LIKE TABLE OF bapiacgl09 WITH HEADER LINE,
py_account LIKE TABLE OF bapiacar09 WITH HEADER LINE,
ret_tab LIKE TABLE OF bapiret2   WITH HEADER LINE,

Still if you have an issue, post your data declaration.

Raja T

Former Member
0 Kudos

Hi, I have figured out what is the problem, I passed the py_account to ACCOUNTRECEIVABLE. It should be ACCOUNTPAYABLE.


FORM bapi_check . 
  CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
    EXPORTING
      DOCUMENTHEADER    = bapiache09
    TABLES
      ACCOUNTGL         = gl_account
*      ACCOUNTRECEIVABLE = py_account
      

<b>ACCOUNTPAYABLE </b>= py_account

"should be payable account, not receivable account

      CURRENCYAMOUNT    = curr_amt
      RETURN            = ret_tab.
ENDFORM.                    " bapi_check

cheers,

ying