Application Development and Automation 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: 

While Posting document using BAPI_ACC_DOCUMENT_POST its showing error but same entry allow to post manually using transaction FB01

nileshlohar
Explorer
0 Kudos
1,477

Hello expert,

      i am facing one issue while posting accounting document using BAPI_ACC_DOCUMENT_POST but same document if i post manually then its allow me to post . please suggest .

  below error i am getting while posting ,

            

KI280Create account 30xxxx for 10.09.2016 as a cost element in controlling area XXXX


i have check field status group , in that cost centre optional entry ,


also when i am creating cost element using base category = 11 its allow me to post document using BAPI_ACC_DOCUMENT_POST

client don't want to create cost element ,


PLEASE SUGGEST , 








THANKS  in advance.


Nilesh



11 REPLIES 11

ajay_rajareddy
Explorer
0 Kudos
882

Can you share your code.. and your error message clearly

0 Kudos
882

Thanks for response Ajay,

please see below code,

LOOP AT record.

     ON CHANGE OF record-xblnr OR record-waers OR record-blart.

       wa_docheader-username = sy-uname.

       wa_docheader-comp_code = record-bukrs.

       CONCATENATE record-budat+6(4) record-budat+3(2)

                   record-budat+0(2) INTO wa_docheader-doc_date.

       wa_docheader-pstng_date wa_docheader-doc_date.

       CALL FUNCTION 'GET_CURRENT_YEAR'

         EXPORTING

           bukrs = wa_docheader-comp_code"' '

           date  = wa_docheader-doc_date                           "record-bldat "SY-DATUM

         IMPORTING

           currm = monat

           curry = gjahr.

       wa_docheader-fisc_year  = gjahr.

       wa_docheader-fis_period = monat.                            " record-gjahr. "'2015'.

       wa_docheader-doc_type   = record-blart.                     " WA_data-SAPDOCUMENT_TYPE.

       wa_docheader-ref_doc_no = record-xblnr.                     " WA_data-LOGIX_INVOICE_NO.

       wa_header-blart         = record-blart.                     " wa_data-SAPDOCUMENT_TYPE.

       wa_docheader-header_txt = record-bktxt.

     ENDON.

***    IF record-newko+0(1) CA 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.

***      wa_data-sapcustomer = record-newko.

***    ENDIF.

     IF record-acc_code EQ 'D' .

       wa_data-sapcustomer = record-newko.

     ELSEIF  record-acc_code EQ  'K' .

       wa_data-sapvendor = record-newko.

     ENDIF.

*    "=========================================== Customer Entry ===========================================================

     IF wa_data-sapcustomer IS NOT INITIAL.

       item_no1  = item_no1  + 1.

       wa_line-bukrs = wa_docheader-comp_code ."WA_HEADER-BUKRS.

       wa_accountreceivable-customer = record-newko ."wa_data-sapcustomer.

       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

         EXPORTING

           input  = wa_accountreceivable-customer

         IMPORTING

           output = wa_accountreceivable-customer.

       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

         EXPORTING

           input  = record-prctr

         IMPORTING

           output = wa_accountreceivable-profit_ctr.

       wa_accountreceivable-itemno_acc item_no1.

       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

         EXPORTING

           input  = item_no1

         IMPORTING

           output = wa_line-buzei.

       wa_line-buzei = item_no1.

       wa_accountreceivable-sp_gl_ind    = record-newum. "WA_data-SAPSPGL.

       wa_accountreceivable-ref_key_1    = record-matnr. "WA_data-VESSEL.

       wa_accountreceivable-bline_date   = sy-datum.

       wa_accountreceivable-item_text    = record-sgtxt.

       wa_accountreceivable-alloc_nmbr   = record-zuonr. "record-matnr.

       wa_accountreceivable-bus_area     = record-gsber.

       APPEND wa_accountreceivable TO it_accountreceivable.

       CLEAR:wa_accountreceivable.

       APPEND wa_line TO it_line.

       CLEAR wa_line.

       CONCATENATE item_no wa_data-sapposting_key INTO wa_extension-valuepart1 SEPARATED BY '-'.

       APPEND wa_extension TO it_extension.

       item_no item_no + 1.

       wa_currencyamount-itemno_acc = item_no .

       "--------------------------------------------------- CURRENCY TYPE ----------------------

       "  Transaction currency-      '00'      | Company Code currency  -   '10'

       "  Controling Area currency-  '20'      | Group currency         -   '30'

       "  Hard currency-             '40'      | Index Base currency    -   '50'

       "  Global Company currency-   '60'

       "----------------------------------------------------------------------------------------

       wa_currencyamount-curr_type    = '00'.

       wa_currencyamount-currency     = record-waers. "'LKR'."wa_data-currency."'LKR'.

       wa_currencyamount-currency_iso = record-waers. "'LKR'."wa_data-currency."'LKR'.

       wa_currencyamount-amt_doccur   = record-wrbtr. "wa_data-AMOUNT.

       wa_currencyamount-tax_amt      = record-dmbtr.

       wa_currencyamount-exch_rate    = record-kursf.

       APPEND wa_currencyamount TO it_currencyamount.

*      *    "=========================================== Vendor Entry ===========================================================

     ELSEIF wa_data-sapvendor IS NOT INITIAL.

       item_no1  = item_no1  + 1.

       wa_line-bukrs = wa_docheader-comp_code ."WA_HEADER-BUKRS.

       wa_accountpayable-vendor_no = record-newko."wa_data-sapvendor.

       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

         EXPORTING

           input  = wa_accountpayable-vendor_no

         IMPORTING

           output = wa_accountpayable-vendor_no.

       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

         EXPORTING

           input  = record-prctr

         IMPORTING

           output = wa_accountpayable-profit_ctr.

       wa_accountpayable-itemno_acc item_no1.

       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

         EXPORTING

           input  = item_no1

         IMPORTING

           output = wa_line-buzei.

       wa_line-buzei = item_no2.

       wa_accountpayable-sp_gl_ind   = record-newum. "WA_data-SAPSPGL.

*      wa_accountpayable-ref_key_1   = record-matnr. "WA_data-VESSEL.

       wa_accountpayable-bline_date  = sy-datum.

       wa_accountpayable-item_text   = record-sgtxt.

       wa_accountpayable-alloc_nmbr  = record-zuonr. "record-matnr.

       wa_accountpayable-bus_area    = record-gsber.

       APPEND wa_accountpayable TO it_accountpayable.

       CLEAR:wa_accountpayable.

       APPEND wa_line TO it_line.

       CLEAR wa_line.

       CONCATENATE item_no wa_data-sapposting_key INTO wa_extension-valuepart1 SEPARATED BY '-'.

       APPEND wa_extension TO it_extension.

       item_no = item_no + 1.

       wa_currencyamount-itemno_acc = item_no .

       "--------------------------------------------------- CURRENCY TYPE ----------------------

       "  Transaction currency-      '00'      | Company Code currency  -   '10'

       "  Controling Area currency-  '20'      | Group currency         -   '30'

       "  Hard currency-             '40'      | Index Base currency    -   '50'

       "  Global Company currency-   '60'

       "----------------------------------------------------------------------------------------

       wa_currencyamount-curr_type    = '00'.

       wa_currencyamount-currency     = record-waers. "'LKR'."wa_data-currency."'LKR'.

       wa_currencyamount-currency_iso = record-waers. "'LKR'."wa_data-currency."'LKR'.

       wa_currencyamount-amt_doccur   = record-wrbtr. "wa_data-AMOUNT.

       wa_currencyamount-tax_amt      = record-dmbtr.

       wa_currencyamount-exch_rate    = record-kursf.

       APPEND wa_currencyamount TO it_currencyamount.

     ELSE .

       item_no1  = item_no1  + 1.

       wa_accountgl-itemno_acc item_no1.

       wa_accountgl-gl_account = record-newko. "wa_data-SAPGLACCOUNT.

       wa_accountgl-acct_type  = 'S'.

*      wa_accountgl-ref_key_1   = record-matnr.

       wa_accountgl-item_text   = record-sgtxt.

       wa_accountgl-alloc_nmbr  = record-zuonr.

**      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

**        EXPORTING

**          input  = record-matnr

**        IMPORTING

**          output = wa_accountgl-material.

       wa_accountgl-doc_type    = record-blart.

       wa_accountgl-value_date  = sy-datum.

       wa_accountgl-de_cre_ind  = record-d_c.        "'H'.

       TRANSLATE record-matnr to UPPER CASE.

       IF record-matnr CA 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.

         wa_accountgl-orderid = record-matnr" TESTING 12.09.2016 .

       ELSE.

         CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

           EXPORTING

*          input  = record-intern_order

             input  = record-matnr

           IMPORTING

             output = wa_accountgl-orderid.

       ENDIF.

***      CLEAR:record-segment.

***      CONCATENATE 'S' record-gsber INTO record-segment .

       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

         EXPORTING

           input  = record-segment

         IMPORTING

           output = wa_accountgl-segment.

       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

         EXPORTING

           input  = record-kostl

         IMPORTING

           output = wa_accountgl-costcenter.

       wa_accountgl-bus_area    = record-gsber.

       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

         EXPORTING

           input  = wa_accountgl-gl_account

         IMPORTING

           output = wa_accountgl-gl_account.

       wa_accountgl-comp_code = record-bukrs.   "wa_data-SAPCOMPANY.

       wa_accountgl-COSTOBJECT = ' ' .   "COSTOBJECT .    "  COst object =======================================

       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

         EXPORTING

           input  = record-prctr

         IMPORTING

           output = wa_accountgl-profit_ctr.

       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

         EXPORTING

           input  = item_no2

         IMPORTING

           output = wa_line-buzei.

       wa_line-buzei = item_no.

       wa_line-bukrs = record-bukrs. "wa_data-SAPCOMPANY.

       APPEND wa_accountgl TO it_accountgl.

       CLEAR wa_accountgl.

       CONCATENATE item_no record-newbs INTO wa_extension-valuepart1 SEPARATED BY '-'.

       APPEND wa_extension TO it_extension.

       "--------------------------------------------------- CURRENCY TYPE ----------------------

       "  Transaction currency-      '00'      | Company Code currency  -   '10'

       "  Controling Area currency-  '20'      | Group currency         -   '30'

       "  Hard currency-             '40'      | Index Base currency    -   '50'

       "  Global Company currency-   '60'

       "----------------------------------------------------------------------------------------

       item_no = item_no + 1.

       wa_currencyamount-itemno_acc = item_no .

       wa_currencyamount-curr_type    = '00'.

       wa_currencyamount-currency     = record-waers"'LKR'."wa_data-currency."'LKR'.

       wa_currencyamount-currency_iso = record-waers"'LKR'."wa_data-currency."'LKR'.

       wa_currencyamount-amt_doccur   = record-wrbtr.   "wa_data-AMOUNT.

       wa_currencyamount-exch_rate    = record-kursf.

       wa_currencyamount-tax_amt      = record-dmbtr.

       APPEND wa_currencyamount TO it_currencyamount.

     ENDIF.

     CLEAR:wa_data.

*    endloop.

*REAK user1.

     AT END OF xblnr.

       wa_header-mandt = sy-mandt.

       MOVE : 'FB01' TO sy-tcode. "L_TYPE.

**      BREAK-POINT.

       CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'

         EXPORTING

           documentheader          wa_docheader

*           CUSTOMERCPD             =

*           CONTRACTHEADER          =

         TABLES

          accountgl               = it_accountgl

          accountreceivable       = it_accountreceivable

          accountpayable          = it_accountpayable

*           ACCOUNTTAX              =

          currencyamount          = it_currencyamount

*           CRITERIA                =

*           VALUEFIELD              =

*           EXTENSION1              =

           return                  it_return

*           PAYMENTCARD             =

*           CONTRACTITEM            =

*           EXTENSION2              =

*           REALESTATE              =

*           ACCOUNTWT               =

                 .

       LOOP AT it_return INTO wa_return WHERE id NE 'RW' AND number NE '609'.

         IF wa_return-type EQ 'E'.

           wa_return-message_v4 record-xblnr.

         ENDIF.

         APPEND wa_return TO it_return_check.

       ENDLOOP.

       CLEAR : it_return[], it_accountgl[], it_accountreceivable[], it_currencyamount[], it_accountpayable[],

               it_extension[],wa_data, item_noitem_no1, item_no2, it_line[], it_header[], wa_header, count.

     ENDAT.

   ENDLOOP.



============================================



Error TypeMessage IDMessage No.
EKI280Create account 305860 for 10.09.2016 as a cost element in controlling area KONI


nileshlohar
Explorer
0 Kudos
882

Hello experts,

   please advice, !!!  how to by pass entry using BAPI without cost center or cost element .

please.....!!

Thanks in advance..

Nilesh

0 Kudos
882

Hi Nilesh,

Can you check if that account is closed for the particular period or something?

Thanks,

Sowbhagya

0 Kudos
882

Hi Sowbhagya Lakshminarayanan,

yes i have check account not close for period ,

its allow to post manually .

Thanks for response...

       

 


Regards,

Nilesh

0 Kudos
882

Hi Nilesh,

Additionally, you may check this thread:

Error ki280 when posting a billing document | SCN

Also look at the note 2037282 if that will be of any help. Please check if this error has something to do with foreign currency.

Thanks,

Sowbhagya

0 Kudos
882

Hi Sowbhagya,

Thanks , thread is relevant to error but i am using bapi and when same entry i try to post using FB01 transaction its allow me to post .

Thanks and appreciated your suggestions .

Regards,

Nilesh 

0 Kudos
882

Hi Nilesh,

Did you try commenting out the statement:


wa_accountgl-COSTOBJECT = ' ' .   "COSTOBJECT .    "  COst object


Am further looking  into this. I shall post updates.

Thanks,

Sowbhagya

0 Kudos
882

HI Sowbhagya,

  sorry for late ,

yes i have already pass blank same like above

and without cost object filed.

Thanks & Regards,

Nilesh.

Former Member
0 Kudos
882

Hi Nilesh,

Were you able to find a solution to this issue?

I found a similar thread:

Please check if this is helpful.

Thanks,

Sowbhagya

0 Kudos
882

Hi Sowbhagya,

not yet ,

meantime we are creating cost element with base category  =  '11' ,

Thanks and Regards,

Nilesh