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: 

Errors in BAPI_ACC_DOCUMENT_POST

Former Member
0 Kudos

i m calling BAPI BAPI_ACC_DOCUMENT_POST for GL posting...i have append some values which i get from the excel sheet...but the thing i m getting below errors..i m unable to sort out these...

Error in document: BKPF E000000024DM102009

Required field OBJ_SYS was not transferred in parameter DOCUMENTHEADER

Incorrect entry in field OBJ_TYPE: BKPF

Required field GL_ACCOUNT was not transferred in parameter ACCOUNTGL

G/L account is not defined in chart of accounts CADC

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

Which data are you transfering in header data?

This is the manadatory data you should transfer:

BAPIACHE09-BUS_ACT = 'RFBU'.

BAPIACHE09-USERNAME = SY-UNAME.

BAPIACHE09-COMP_CODE = <company code>

BAPIACHE09-DOC_DATE = <document date>

BAPIACHE09-PSTNG_DATE = <posting date>

BAPIACHE09-DOC_TYPE = <document type>

It seens u haven't transfered a g/l account in table paramenter ACCOUNTGL

Max

20 REPLIES 20

Former Member
0 Kudos

Hi

Which data are you transfering in header data?

This is the manadatory data you should transfer:

BAPIACHE09-BUS_ACT = 'RFBU'.

BAPIACHE09-USERNAME = SY-UNAME.

BAPIACHE09-COMP_CODE = <company code>

BAPIACHE09-DOC_DATE = <document date>

BAPIACHE09-PSTNG_DATE = <posting date>

BAPIACHE09-DOC_TYPE = <document type>

It seens u haven't transfered a g/l account in table paramenter ACCOUNTGL

Max

0 Kudos

gd_documentheader-BUS_ACT = 'RFBU'.

gd_documentheader-OBJ_TYPE = 'BKPF '.

gd_documentheader-OBJ_KEY = lv_awkey.

gd_documentheader-USERNAME = sy-uname.

gd_documentheader-OBJ_SYS = ' '.

gd_documentheader-pstng_date = sy-datum.

i am only passing vendor_no...i m unable to sort out how to pass GL_ACCOUNT field..

WA_accountgl-vendor_no = LV_LIFNR. """vendor and matriculation number

  • WA_accountgl-GL_ACCOUNT = lv_AKONT.

Vendor no. Matriculation Number ccount Order

1000006

1910011

1000006

2103001

for above example..first line item doesnot have account number and 2nd line item doesnot have vendor no...

what to pass to which field..pls help..

0 Kudos

Hi

gd_documentheader-BUS_ACT = 'RFBU'.
gd_documentheader-OBJ_TYPE = 'BKPF '.             "<-------????????????
gd_documentheader-OBJ_KEY = lv_awkey.            "<--------????????????
gd_documentheader-USERNAME = sy-uname.
gd_documentheader-OBJ_SYS = ' '.
gd_documentheader-pstng_date = sy-datum.

Are u sure u need to tranfer OBJ_TYPE and OBJ_KEY: they shouldn't be transfered.

Just remember: The total of all items you're transfering to account document has to be equal to ZERO

I can't understand which kind of posting u need to do: but if you create vendor item, u need to create another line having opposite sign, if it has to be a g/l item u need to ask your FI consultant how to find out the g/l account.

Max

0 Kudos

see..in FB01 we have field... RF05A-NEWKO(Account) where we pass same vendor number and gl_account...my question is while passing in BAPI how do u deferintate ..because u have vendor_no and gl_account fields seperalty...

hope u understand my problem...

0 Kudos

Hi

See the interface of the BAPI, see the table parameters, here u can see:

ACCOUNTGL                               "<----- To transfer the data of G/L Accounting
ACCOUNTRECEIVABLE              "<----- To transfer the data of Customer Accounting
ACCOUNTPAYABLE                   "<----- To transfer the data of Vendor Accounting
ACCOUNTTAX                             "<----- To transfer the data of tax data
CURRENCYAMOUNT                   "<----- To transfer the amount of every item

So the data of Vendor have to be transfered in ACCOUNTPAYABLE, the data of g/l to ACCOUNTGL: in this way it differentiates them.

All amount data of both kind of item (vendor and g/l) have to be transfered to CURRENCYAMOUNT

Max

0 Kudos

one morething....

i m passing E000000024DM102009

concatenate belnr bukrs sy-datum+0(4) into lv_awkey.

gd_documentheader-OBJ_KEY = lv_awkey.

and for gd_documentheader-OBJ_TYPE = 'BKPF '. and gd_documentheader-OBJ_SYS = ' '.

are these values which i m passing correct??

any changes required??because it is showing some error..

0 Kudos

Hi

concatenate belnr bukrs sy-datum+0(4) into lv_awkey? But if you need to post the document which number document (BELNR) are you tansfering?

No, I think you don't need to transfer any data in OBJ_KEY, OBJ_TYPE and OBJ_SYS

Max

0 Kudos

these r the values i will be getting from the input file..

Company Document number Document Type Posting date Document Date Currency Amount Vendor no. Matriculation Number Cost Center Account Order Posting Key Due Date Text field Special G/L Assignment

0 Kudos

Ok. Let me give this sample coding to you. I have extensively used this BAPI including the check accounting bapi.




CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
        EXPORTING
          DOCUMENTHEADER          = DOCUMENTHEADER
          CUSTOMERCPD             = CUSTOMERCPD
*     CONTRACTHEADER          =
     IMPORTING
       OBJ_TYPE                = DOCUMENTHEADER-OBJ_TYPE
       OBJ_KEY                 = OBJ_KEY2
       OBJ_SYS                 = DOCUMENTHEADER-OBJ_SYS
        TABLES
         ACCOUNTGL               = ACCOUNTGL
         ACCOUNTRECEIVABLE       = ACCOUNTRECEIVABLE
         ACCOUNTPAYABLE          = ACCOUNTPAYABLE
*       ACCOUNTTAX              = ACCOUNTTAX
          CURRENCYAMOUNT         = CURRENCYAMOUNT
*     CRITERIA                =
*     VALUEFIELD              =
          EXTENSION1              = EXTENSION1
          RETURN                  = RETURN
*     PAYMENTCARD             =
*     CONTRACTITEM            =
*     EXTENSION2              =
*     REALESTATE              =
       ACCOUNTWT               = ACCOUNTWT

Now the Document header

   Build DOCUMENTHEADER
    DOCUMENTHEADER-OBJ_TYPE = OBJ_TYPE.  (OBJ_TYPE(5) VALUE 'BKPF')
    DOCUMENTHEADER-OBJ_KEY  = OBJ_KEY. (Concatenate itab-REF_DOC_NO itab-COMP_CODE w_year 'OR' into OBJ_KEY)
    DOCUMENTHEADER-OBJ_SYS  = SY-MANDT.
    DOCUMENTHEADER-BUS_ACT =  BUS_ACT. (BUS_ACT(4) VALUE 'RFBU')
    DOCUMENTHEADER-USERNAME = SY-UNAME.
    DOCUMENTHEADER-COMP_CODE = itab2-COMP_CODE.
    DOCUMENTHEADER-DOC_DATE = itab2-DOC_DATE.
    DOCUMENTHEADER-PSTNG_DATE = itab2-PSTNG_DATE.
    DOCUMENTHEADER-TRANS_DATE = itab2-TRANS_DATE.
    DOCUMENTHEADER-FISC_YEAR = w_year.
    DOCUMENTHEADER-FIS_PERIOD = w_period.
    DOCUMENTHEADER-DOC_TYPE = itab2-DOC_TYPE.
    DOCUMENTHEADER-REF_DOC_NO = itab2-REF_DOC_NO


*    Build DOCUMENTHEADER
    IF ITAB2-NAME <> ''.
      CUSTOMERCPD-NAME   = ITAB2-NAME.
      CUSTOMERCPD-NAME_2 = ITAB2-NAME_2.
      CUSTOMERCPD-NAME_3 = ITAB2-NAME_3.
      CUSTOMERCPD-NAME_4 = ITAB2-NAME_4.
      CUSTOMERCPD-POSTL_CODE = ITAB2-POSTL_CODE.
      CUSTOMERCPD-CITY = ITAB2-CITY.
      CUSTOMERCPD-REGION = ITAB2-REGION.
      CUSTOMERCPD-COUNTRY = ITAB2-COUNTRY.
      CUSTOMERCPD-STREET = ITAB2-STREET.
      CUSTOMERCPD-BANK_ACCT = ITAB2-BANK_ACCT.
      CUSTOMERCPD-BANK_NO = ITAB2-BANK_NO.
      CUSTOMERCPD-BANK_CTRY = ITAB2-BANK_CTRY.
      CUSTOMERCPD-CTRL_KEY = ITAB2-CTRL_KEY.
    ENDIF.

*Build Account G/L
       itemno = itemno + 1.
        ACCOUNTGL-ITEMNO_ACC = ITEMNO.
*        ACCOUNTGL-GL_ACCOUNT  = itab-sapcode.
        ACCOUNTGL-ITEM_TEXT  = itab-ITEM_TEXT_GL.
        ACCOUNTGL-REF_KEY_1  = itab-REF_KEY_1_GL.
        ACCOUNTGL-REF_KEY_2  = itab-REF_KEY_2_GL.
        ACCOUNTGL-ACCT_TYPE = itab-ACCT_TYPE_GL.
        ACCOUNTGL-BUS_AREA = itab-BUS_AREA_GL.
        ACCOUNTGL-TAX_CODE = itab-TAX_CODE_GL.
        ACCOUNTGL-TAXJURCODE = itab-TAXJURCODE_GL.
        ACCOUNTGL-COSTCENTER = itab-COSTCENTER_GL.
        ACCOUNTGL-PROFIT_CTR = itab-PROFIT_CTR_GL.
        ACCOUNTGL-ORDERID = itab-ORDERID_GL.
        ACCOUNTGL-ASSET_NO = itab-ASSET_NO_GL.
        ACCOUNTGL-SUB_NUMBER = itab-SUB_NUMBER_GL.
        ACCOUNTGL-SALES_ORD = itab-SALES_ORD_GL.
        ACCOUNTGL-S_ORD_ITEM = itab-S_ORD_ITEM_GL.
        ACCOUNTGL-DE_CRE_IND = itab-DE_CRE_IND_GL.
        ACCOUNTGL-QUANTITY = itab-QUANTITY_GL.
        ACCOUNTGL-BASE_UOM = itab-BASE_UOM_GL.
        ACCOUNTGL-MATERIAL = itab-MATERIAL_GL.
        ACCOUNTGL-PO_NUMBER = itab-PO_NUMBER_GL.
        ACCOUNTGL-PO_ITEM = itab-PO_ITEM_GL.
        Append ACCOUNTGL.

*  Build accountreceivable
        itemno = itemno + 1.
        ACCOUNTRECEIVABLE-ITEMNO_ACC = ITEMNO.
*      ACCOUNTRECEIVABLE-CUSTOMER  = itab-sapcode.
        ACCOUNTRECEIVABLE-BUS_AREA  = itab-BUS_AREA_GL.
        ACCOUNTRECEIVABLE-PMNTTRMS  = itab-PMNTTRMS_AP.
        ACCOUNTRECEIVABLE-BLINE_DATE  = itab2-BLINE_DATE_AR.
        ACCOUNTRECEIVABLE-PYMT_METH = itab-PYMT_METH_AR.
        ACCOUNTRECEIVABLE-PMNT_BLOCK = itab-PMNT_BLOCK_AR.
        ACCOUNTRECEIVABLE-BANK_ID = itab-BANK_ID_AR.
        ACCOUNTRECEIVABLE-SP_GL_IND = itab-SP_GL_IND_AR.
        ACCOUNTRECEIVABLE-ALT_PAYEE = itab-ALT_PAYEE_AR.
        ACCOUNTRECEIVABLE-PROFIT_CTR = itab-PROFIT_CTR_GL.
        Append ACCOUNTRECEIVABLE.

*  Build Accounts payable
       itemno = itemno + 1.
        ACCOUNTPAYABLE-ITEMNO_ACC = ITEMNO.
*      ACCOUNTPAYABLE-VENDOR_NO  = itab-sapcode.
        ACCOUNTPAYABLE-BUS_AREA  = itab-BUS_AREA_GL.
        ACCOUNTPAYABLE-PMNTTRMS  = itab-PMNTTRMS_AP.
        ACCOUNTPAYABLE-ALLOC_NMBR  = itab-ALLOC_NMBR_GL.
        ACCOUNTPAYABLE-SP_GL_IND  = itab-SP_GL_IND_AR.
        ACCOUNTPAYABLE-BLINE_DATE  = itab-BLINE_DATE_AR.
        ACCOUNTPAYABLE-PROFIT_CTR = itab-PROFIT_CTR_GL.
        Append ACCOUNTPAYABLE.

* Build Currency Amount
     CURRENCYAMOUNT-ITEMNO_ACC = ITEMNO.
      CURRENCYAMOUNT-CURR_TYPE  = CURR_TYPE1.
      CURRENCYAMOUNT-CURRENCY  = itab-CURRENCY_CUR.
      CURRENCYAMOUNT-AMT_DOCCUR = itab-AMT_DOCCUR_DOC.
      CURRENCYAMOUNT-EXCH_RATE = itab-EXCH_RATE_CUR.
      Append CURRENCYAMOUNT.
      if itab-CURRENCY_CUR ne w_currency.
        CURRENCYAMOUNT-ITEMNO_ACC = ITEMNO.
        CURRENCYAMOUNT-CURR_TYPE  = CURR_TYPE2.
        CURRENCYAMOUNT-CURRENCY  = w_currency.
        CURRENCYAMOUNT-AMT_DOCCUR = itab-AMT_DOCCUR_LOC.
        CURRENCYAMOUNT-EXCH_RATE = itab-EXCH_RATE_CUR.
        Append CURRENCYAMOUNT.
      endif.

*       Witholding Tax
      if ITAB-WT_TYPE_WT <> ''.
        itemno = itemno + 1 .
        ACCOUNTWT-ITEMNO_ACC = ITEMNO.
        ACCOUNTWT-WT_TYPE  = itab-WT_TYPE_WT.
        ACCOUNTWT-WT_CODE  = itab-WT_CODE_WT.
        Append ACCOUNTWT.
      endif.

Tell me if you don't understand any part. This is working in production at my place.

Varun Mathur

Edited by: Varun Mathur on Aug 17, 2009 12:42 PM

Edited by: Varun Mathur on Aug 17, 2009 12:44 PM

0 Kudos

the code tag is not working.

0 Kudos
Build DOCUMENTHEADER
    DOCUMENTHEADER-OBJ_TYPE = OBJ_TYPE.
    Concatenate itab2-REF_DOC_NO itab2-COMP_CODE w_year 'OR' into OBJ_KEY.
    DOCUMENTHEADER-OBJ_KEY  = OBJ_KEY.
    DOCUMENTHEADER-OBJ_SYS  = SY-MANDT.
    DOCUMENTHEADER-BUS_ACT =  BUS_ACT.
    DOCUMENTHEADER-USERNAME = SY-UNAME.
    DOCUMENTHEADER-COMP_CODE = itab2-COMP_CODE.
    DOCUMENTHEADER-DOC_DATE = itab2-DOC_DATE.
    DOCUMENTHEADER-PSTNG_DATE = itab2-PSTNG_DATE.
    DOCUMENTHEADER-TRANS_DATE = itab2-TRANS_DATE.
    DOCUMENTHEADER-FISC_YEAR = w_year.
    DOCUMENTHEADER-FIS_PERIOD = w_period.
    DOCUMENTHEADER-DOC_TYPE = itab2-DOC_TYPE.
    DOCUMENTHEADER-REF_DOC_NO = itab2-REF_DOC_NO

CUSTOMERCPD-NAME   = ITAB2-NAME.
      CUSTOMERCPD-NAME_2 = ITAB2-NAME_2.
      CUSTOMERCPD-NAME_3 = ITAB2-NAME_3.
      CUSTOMERCPD-NAME_4 = ITAB2-NAME_4.
      CUSTOMERCPD-POSTL_CODE = ITAB2-POSTL_CODE.
      CUSTOMERCPD-CITY = ITAB2-CITY.
      CUSTOMERCPD-REGION = ITAB2-REGION.
      CUSTOMERCPD-COUNTRY = ITAB2-COUNTRY.
      CUSTOMERCPD-STREET = ITAB2-STREET.
      CUSTOMERCPD-BANK_ACCT = ITAB2-BANK_ACCT.
      CUSTOMERCPD-BANK_NO = ITAB2-BANK_NO.
      CUSTOMERCPD-BANK_CTRY = ITAB2-BANK_CTRY.
      CUSTOMERCPD-CTRL_KEY = ITAB2-CTRL_KEY.

ACCOUNTGL-ITEMNO_ACC = ITEMNO.
        ACCOUNTGL-GL_ACCOUNT  = itab-sapcode.
        ACCOUNTGL-ITEM_TEXT  = itab-ITEM_TEXT_GL.
        ACCOUNTGL-REF_KEY_1  = itab-REF_KEY_1_GL.
        ACCOUNTGL-REF_KEY_2  = itab-REF_KEY_2_GL.
        ACCOUNTGL-ACCT_TYPE = itab-ACCT_TYPE_GL.
        ACCOUNTGL-BUS_AREA = itab-BUS_AREA_GL.
        ACCOUNTGL-TAX_CODE = itab-TAX_CODE_GL.
        ACCOUNTGL-TAXJURCODE = itab-TAXJURCODE_GL.
        ACCOUNTGL-COSTCENTER = itab-COSTCENTER_GL.
        ACCOUNTGL-PROFIT_CTR = itab-PROFIT_CTR_GL.
        ACCOUNTGL-ORDERID = itab-ORDERID_GL.
        ACCOUNTGL-ASSET_NO = itab-ASSET_NO_GL.
        ACCOUNTGL-SUB_NUMBER = itab-SUB_NUMBER_GL.
        ACCOUNTGL-SALES_ORD = itab-SALES_ORD_GL.
        ACCOUNTGL-S_ORD_ITEM = itab-S_ORD_ITEM_GL.
        ACCOUNTGL-DE_CRE_IND = itab-DE_CRE_IND_GL.
        ACCOUNTGL-QUANTITY = itab-QUANTITY_GL.
        ACCOUNTGL-BASE_UOM = itab-BASE_UOM_GL.
        ACCOUNTGL-MATERIAL = itab-MATERIAL_GL.
        ACCOUNTGL-PO_NUMBER = itab-PO_NUMBER_GL.
        ACCOUNTGL-PO_ITEM = itab-PO_ITEM_GL.

Edited by: Varun Mathur on Aug 17, 2009 1:00 PM

Edited by: Varun Mathur on Aug 17, 2009 1:01 PM

0 Kudos
ACCOUNTRECEIVABLE-ITEMNO_ACC = ITEMNO.
       ACCOUNTRECEIVABLE-CUSTOMER  = itab-sapcode.
        ACCOUNTRECEIVABLE-BUS_AREA  = itab-BUS_AREA_GL.
        ACCOUNTRECEIVABLE-PMNTTRMS  = itab-PMNTTRMS_AP.
        ACCOUNTRECEIVABLE-BLINE_DATE  = itab2-BLINE_DATE_AR.
        ACCOUNTRECEIVABLE-PYMT_METH = itab-PYMT_METH_AR.
        ACCOUNTRECEIVABLE-PMNT_BLOCK = itab-PMNT_BLOCK_AR.
        ACCOUNTRECEIVABLE-BANK_ID = itab-BANK_ID_AR.
        ACCOUNTRECEIVABLE-SP_GL_IND = itab-SP_GL_IND_AR.
        ACCOUNTRECEIVABLE-ALT_PAYEE = itab-ALT_PAYEE_AR.
        ACCOUNTRECEIVABLE-PROFIT_CTR = itab-PROFIT_CTR_GL.

itemno = itemno + 1.
        ACCOUNTPAYABLE-ITEMNO_ACC = ITEMNO.
        ACCOUNTPAYABLE-VENDOR_NO  = itab-sapcode.
        ACCOUNTPAYABLE-BUS_AREA  = itab-BUS_AREA_GL.
        ACCOUNTPAYABLE-PMNTTRMS  = itab-PMNTTRMS_AP.
        ACCOUNTPAYABLE-ALLOC_NMBR  = itab-ALLOC_NMBR_GL.
        ACCOUNTPAYABLE-SP_GL_IND  = itab-SP_GL_IND_AR.
        ACCOUNTPAYABLE-BLINE_DATE  = itab-BLINE_DATE_AR.
        ACCOUNTPAYABLE-PROFIT_CTR = itab-PROFIT_CTR_GL.

checking for debit/credit entries - create two entries for different currencies
      if itab-DE_CRE_IND_GL eq 'C'.
        itab-AMT_DOCCUR_DOC = itab-AMT_DOCCUR_DOC * ( -1 ).
        itab-AMT_DOCCUR_LOC = itab-AMT_DOCCUR_LOC * ( -1 ).
      endif.
      CURRENCYAMOUNT-ITEMNO_ACC = ITEMNO.
      CURRENCYAMOUNT-CURR_TYPE  = CURR_TYPE1.
      CURRENCYAMOUNT-CURRENCY  = itab-CURRENCY_CUR.
      CURRENCYAMOUNT-AMT_DOCCUR = itab-AMT_DOCCUR_DOC.
      CURRENCYAMOUNT-EXCH_RATE = itab-EXCH_RATE_CUR.
      Append CURRENCYAMOUNT.
      if itab-CURRENCY_CUR ne w_currency.
        CURRENCYAMOUNT-ITEMNO_ACC = ITEMNO.
        CURRENCYAMOUNT-CURR_TYPE  = CURR_TYPE2.
        CURRENCYAMOUNT-CURRENCY  = w_currency.
        CURRENCYAMOUNT-AMT_DOCCUR = itab-AMT_DOCCUR_LOC.
        CURRENCYAMOUNT-EXCH_RATE = itab-EXCH_RATE_CUR.
        Append CURRENCYAMOUNT.
      endif.

Witholding Tax
      if ITAB-WT_TYPE_WT <> ''.
        itemno = itemno + 1 .
        ACCOUNTWT-ITEMNO_ACC = ITEMNO.
        ACCOUNTWT-WT_TYPE  = itab-WT_TYPE_WT.
        ACCOUNTWT-WT_CODE  = itab-WT_CODE_WT.
        Append ACCOUNTWT.
      endif.

0 Kudos

This all information you need to pass to the bapi.

Post if you need clarity

Varun

0 Kudos
 
concatenate sy-datum+6(2) '.' sy-datum+4(2) '.' sy-datum+0(4) into lv_date.
concatenate wa_finput-belnr wa_finput-bukrs sy-datum+0(4) 'OR' into lv_awkey.

*--fill_header
    gd_documentheader-comp_code   = wa_finput-BUKRS.
    gd_documentheader-REF_DOC_NO  = wa_finput-BELNR.
    gd_documentheader-DOC_TYPE    = wa_finput-BLART.
    gd_documentheader-pstng_date  = wa_finput-BUDAT.
    gd_documentheader-doc_date    = wa_finput-BLDAT.

    gd_documentheader-BUS_ACT  = 'RFBU'.
    gd_documentheader-OBJ_TYPE = 'BKPF'.
    gd_documentheader-OBJ_KEY  = lv_awkey.
    gd_documentheader-USERNAME = sy-uname.
    gd_documentheader-OBJ_SYS  = sy-mandt.
    gd_documentheader-FISC_YEAR = sy-datum+0(4).

*--fill_accountgl
   LV_LEN = strlen( wa_finput-newko ).
   IF LV_LEN < 5.
       select SINGLE lifnr from lfb1  into lv_lifnr where BUKRS = wa_finput-BUKRS and   pernr = wa_finput-newko.
   ELSE.
     LV_LIFNR = wa_finput-newko.
   ENDIF.

   CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
     EXPORTING
       input        = lv_lifnr
    IMPORTING
      OUTPUT        = lv_lifnr.

   select single AKONT from lfb1 into lv_AKONT where lifnr = lv_lifnr.

   lv_itemno = lv_itemno + 1.

     WA_accountgl-ITEMNO_ACC =    lv_itemno.
     WA_accountgl-item_text      = wa_finput-SGTXT.
      WA_accountgl-vendor_no      = LV_LIFNR.      """vendor and matriculation number
      WA_accountgl-COSTCENTER     = wa_finput-KOSTL.
*      WA_accountgl-GL_ACCOUNT     = lv_AKONT.
      WA_accountgl-ORDERID        = wa_finput-AUFNR.
      WA_accountgl-ALLOC_NMBR     = wa_finput-ZUONR.

      APPEND WA_accountgl TO it_accountgl.


*--fill_account receivable
   WA_accountreceivable-ITEMNO_ACC = lv_itemno.
   WA_accountreceivable-SP_GL_IND  = wa_finput-UMSKZ.
   WA_accountreceivable-BLINE_DATE = wa_finput-ZFBDT.
   append wa_accountreceivable to it_accountreceivable.

select single shkzg from bseg into lv_shkzg
                              where bukrs = wa_finput-bukrs
                              and   bschl = wa_finput-NEWBS.
*--(S = debit, H = credit)
move wa_finput-wrbtr to lv_wrbtr1.
   if lv_shkzg = 'S'.
      move lv_wrbtr1 to lv_WRBTR.
   elseif lv_shkzg = 'H'.
      concatenate '-' lv_wrbtr1 into lv_WRBTR.
   else.

   endif.


wa_ACCOUNTPAYABLE-ITEMNO_ACC = LV_ITEMNO.
wa_ACCOUNTPAYABLE-SP_GL_IND = wa_finput-umskz.
WA_ACCOUNTPAYABLE-BLINE_DATE = wa_finput-ZFBDT.
append wa_ACCOUNTPAYABLE to it_ACCOUNTPAYABLE.

*--fill_currencyamount
    WA_currencyamount-ITEMNO_ACC   = LV_ITEMNO.
    WA_currencyamount-currency     = wa_finput-WAERS.
    WA_currencyamount-amt_doccur   = lv_WRBTR.
    APPEND WA_currencyamount TO it_currencyamount.


 ENDLOOP.

      CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
        EXPORTING
          DOCUMENTHEADER          = gd_documentheader
          CUSTOMERCPD             = gd_customercpd
          CONTRACTHEADER          = gd_fica_hd
*        IMPORTING
*          OBJ_TYPE                = l_type
*          OBJ_KEY                 = l_key
*          OBJ_SYS                 = l_sys
        TABLES
          ACCOUNTGL               = it_accountgl
          ACCOUNTRECEIVABLE       = it_accountreceivable
          ACCOUNTPAYABLE          = it_accountpayable
*          ACCOUNTTAX              = it_accounttax
          CURRENCYAMOUNT          = it_currencyamount
*          CRITERIA                = it_criteria
*          VALUEFIELD              = it_valuefield
*          EXTENSION1              = it_ext
          RETURN                  = it_return
*          PAYMENTCARD             = it_paymentcard
*          CONTRACTITEM            = it_fica_it
*          EXTENSION2              = it_ext2
*          REALESTATE              = it_re
*          ACCOUNTWT               = IT_ACCTWT
 .

i have written above code...errors are also attached below..

Error in document: BKPF E000000024DM102009OR 500

Incorrect entry in field OBJ_TYPE: BKPF

Required field CUSTOMER was not transferred in parameter ACCOUNTRECEIVABLE

Required field GL_ACCOUNT was not transferred in parameter ACCOUNTGL

Required field VENDOR_NO was not transferred in parameter ACCOUNTPAYABLE

Required field GL_ACCOUNT was not transferred in parameter ACCOUNTGL

Required field VENDOR_NO was not transferred in parameter ACCOUNTPAYABLE

Required field CUSTOMER was not transferred in parameter ACCOUNTRECEIVABLE

Required field VENDOR_NO was not transferred in parameter ACCOUNTPAYABLE

Required field CUSTOMER was not transferred in parameter ACCOUNTRECEIVABLE

Required field GL_ACCOUNT was not transferred in parameter ACCOUNTGL

Required field CUSTOMER was not transferred in parameter ACCOUNTRECEIVABLE

Required field VENDOR_NO was not transferred in parameter ACCOUNTPAYABLE

Required field GL_ACCOUNT was not transferred in parameter ACCOUNTGL

Customer is not defined in company code DM10

G/L account is not defined in chart of accounts CADC

Vendor is not defined in company code DM10

G/L account is not defined in chart of accounts CADC

Vendor is not defined in company code DM10

Customer is not defined in company code DM10

Vendor is not defined in company code DM10

Customer is not defined in company code DM10

G/L account is not defined in chart of accounts CADC

Customer is not defined in company code DM10

Vendor is not defined in company code DM10

G/L account is not defined in chart of accounts CADC

0 Kudos

Hi Rahul,

You will need to append all these headers individually.

I have missed out on Append statements

Also first try to do a posting manually by running se37 and manually enter the information.

Edited by: Varun Mathur on Aug 17, 2009 2:26 PM

0 Kudos

i have tried by manually entering in se37...but still dont know...what r the values i m misssing...pls help

0 Kudos

when i tried manually...i have got below errors..

Required field GL_ACCOUNT was not transferred in parameter ACCOUNTGL

Required field GL_ACCOUNT was not transferred in parameter ACCOUNTGL

G/L account is not defined in chart of accounts CADC

G/L account is not defined in chart of accounts CADC

to which field shall i enter my gl account and vendor values....because i m getting error with these 2 fields only....

0 Kudos

Required field GL_ACCOUNT was not transferred in parameter ACCOUNTGL

ACCOUNTGL-GL_ACCOUNT  = w_saknr

please add this as well. Then check.

0 Kudos

Max,

Thanks for your info on what fields are required to be populated. it's helpful. The documentation from the BAPI function module somehow reads differently. It may not be updated.

Thanks again,

Loni

raymond_giuseppi
Active Contributor
0 Kudos

Did you read the OSS [Note 561175 - BAPI posting in accounting with FI as reference|https://service.sap.com/sap/support/notes/561175] ?

OBJ_TYPE: BKPFF

OBJ_KEY: FI document number, company code, fiscal year

OBJ_SYS: local logical system

Regards,

Raymond