BAPI for posting accounting documents

Hi,
Can anyone please provide me with the BAPI to be used for GL postings with example.

Hi,
Use  the BAPI   BAPI_ACC_DOCUMENT_POST for posting Documents.
Check the sample code related to posting.
REPORT  acc_bapi_document                  .
selection-screen begin of block bl01 .
parameters:
  check_l             radiobutton group rb1,
  check_a default 'X' radiobutton group rb1,
  post                radiobutton group rb1.
selection-screen uline.
parameters:
  rev_c               radiobutton group rb1,
  rev_p               radiobutton group rb1.
selection-screen uline.
parameters:
  ref_key like bapiache01-obj_key default 'TEST000001BAPICALL',
  dest    like bdi_logsys-logsys  default '          '.
selection-screen end   of block bl01 .
data:
  gd_documentheader    like bapiache09,
  gd_customercpd       like bapiacpa09,
  gd_fica_hd           like bapiaccahd,
  it_accountreceivable like table of bapiacar09 with header line,
  it_accountgl         like table of bapiacgl09 with header line,
  it_accounttax        like table of bapiactx09 with header line,
  it_criteria          like table of bapiackec9 with header line,
  it_valuefield        like table of bapiackev9 with header line,
  it_currencyamount    like table of bapiaccr09 with header line,
  it_return            like table of bapiret2   with header line,
  it_receivers         like table of bdi_logsys with header line,
  it_fica_it           like table of bapiaccait with header line,
  it_accountpayable    like table of bapiacap09 with header line,
  it_paymentcard       like table of bapiacpc09 with header line,
  it_ext               like table of bapiacextc with header line.
it_re                LIKE TABLE OF bapiacre09 WITH HEADER LINE,
it_ext2              LIKE TABLE OF bapiparex  WITH HEADER LINE.
perform fill_internal_tables.
if check_l = 'X'.
  call function 'BAPI_ACC_DOCUMENT_CHECK'
       destination dest
       exporting
            documentheader    = gd_documentheader
            customercpd       = gd_customercpd
            contractheader    = gd_fica_hd
       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.
  write: / 'Result of check lines:'.                        "#EC NOTEXT
  perform show_messages.
endif.
if check_a = 'X'.
  call function 'BAPI_ACC_DOCUMENT_CHECK'
    destination dest
    exporting
      documentheader    = gd_documentheader
      customercpd       = gd_customercpd
      contractheader    = gd_fica_hd
    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.
  write: / 'Result of check all:'.                          "#EC NOTEXT
  perform show_messages.
endif.
if post = 'X'.
  data: l_type like gd_documentheader-obj_type,
        l_key  like gd_documentheader-obj_key,
        l_sys  like gd_documentheader-obj_sys.
  if dest = space or
     dest = gd_documentheader-obj_sys.
   post synchron
    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.
    write: / 'Result of post:'.                             "#EC NOTEXT
    perform show_messages.
  else.
  create Idoc
    it_receivers-logsys = dest.
    append it_receivers.
    call function 'ALE_ACC_DOCUMENT_POST'
      exporting
        documentheader    = gd_documentheader
        customercpd       = gd_customercpd
        contractheader    = gd_fica_hd
      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
        paymentcard       = it_paymentcard
        contractitem      = it_fica_it
       extension2        = it_ext2
       realestate        = it_re
        receivers         = it_receivers
      COMMUNICATION_DOCUMENTS =
      APPLICATION_OBJECTS     =
      exceptions
        error_creating_idocs    = 1
        others                  = 2  .
    if sy-subrc = 0.
      write: / 'IDoc created'.                              "#EC NOTEXT
    else.
      write: sy-msgid.
    endif.
  endif.
endif.
if rev_p = 'X' or rev_c = 'X'.
  data: rev like bapiacrev,
        rev_key like ref_key.
  rev_key       = ref_key.
  rev_key(1)    = 'R'.
  rev-obj_type  = gd_documentheader-obj_type.
  rev-obj_key   = rev_key.
  rev-obj_sys   = gd_documentheader-obj_sys.
  rev-obj_key_r = ref_key.
  if rev_c is initial.
    if dest = space or
       dest = gd_documentheader-obj_sys.
      call function 'BAPI_ACC_DOCUMENT_REV_POST'
        exporting
          reversal = rev
          bus_act  = gd_documentheader-bus_act
        tables
          return   = it_return.
    else.
      it_receivers-logsys = dest.
      append it_receivers.
      call function 'ALE_ACC_DOCUMENT_REV_POST'
        exporting
          reversal                      = rev
          busact                        = gd_documentheader-bus_act
        OBJ_TYPE                      = 'BUS6035'
        SERIAL_ID                     = '0'
        tables
          receivers                     = it_receivers
        COMMUNICATION_DOCUMENTS       =
        APPLICATION_OBJECTS           =
        exceptions
          error_creating_idocs          = 1
          others                        = 2
      if sy-subrc  0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      else.
        write: / 'IDoc created'.                            "#EC NOTEXT
      endif.
    endif.
  else.
    call function 'BAPI_ACC_DOCUMENT_REV_CHECK'
      exporting
        reversal = rev
        bus_act  = gd_documentheader-bus_act
      tables
        return   = it_return.
  endif.
  write: / 'Result of Reversal Posting:'.                   "#EC NOTEXT
  perform show_messages.
endif.
commit work.
     Form  fill_internal_tables
form fill_internal_tables.
  perform fill_header.
  perform fill_accountgl.
perform fill_accountar.
  perform fill_accountap.
  perform fill_accounttax.
  perform fill_currencyamount.
perform fill_criteria.
perform fill_valuefield.
perform fill_re.
perform fill_cpd.
perform fill_contractitem.
perform fill_contractheader.
perform fill_paymentcard.
perform fill_extension.
endform.                               " fill_internal_tables
     Form  Show_messages
form show_messages.
  if it_return[] is initial.
    write: / 'no messages'.
  else.
    skip 1.
    loop at it_return.
      write: /    it_return-type,
             (2)  it_return-id,
                  it_return-number,
             (80) it_return-message,
                IT_RETURN-LOG_NO
                IT_RETURN-LOG_MSG_NO
                  it_return-message_v1,
                IT_RETURN-MESSAGE_V2
                IT_RETURN-MESSAGE_V3
                IT_RETURN-MESSAGE_V4
             (20) it_return-parameter,
             (3)  it_return-row,
                  it_return-field.
                IT_RETURN-SYSTEM
    endloop.
  endif.
  uline.
endform.                               " Show_messages
      FORM fill_accountgl                                           *
form fill_accountgl.
  clear it_accountgl.
  it_accountgl-itemno_acc     = 2.
  it_accountgl-gl_account     = '0021510201'.
  it_accountgl-item_text      = 'BAPI Test G/L line item'.  "#EC NOTEXT
it_accountgl-bus_area       = '01'.
it_accountgl-profit_ctr     = '0000010101'.
it_accountgl-comp_code      = 'SLOC'.
  append it_accountgl.
  clear it_accountgl.
  it_accountgl-itemno_acc     = 3.
  it_accountgl-gl_account     = '0082000201'.
  it_accountgl-item_text      = 'BAPI Test G/L line item'.  "#EC NOTEXT
  it_accountgl-bus_area       = '01'.
  it_accountgl-profit_ctr     = '0000010101'.
  it_accountgl-comp_code      = 'SLOC'.
  it_accountgl-tax_code       = 'A3'.
  append it_accountgl.
  clear it_accountgl.
  it_accountgl-itemno_acc     = 5.
  it_accountgl-gl_account     = '0021510201'.
  it_accountgl-item_text      = 'BAPI Test G/L line item'.  "#EC NOTEXT
it_accountgl-bus_area       = '01'.
it_accountgl-profit_ctr     = '0000010301'.
it_accountgl-comp_code      = 'SLOC'.
  append it_accountgl.
  clear it_accountgl.
  it_accountgl-itemno_acc     = 6.
  it_accountgl-gl_account     = '0082000201'.
  it_accountgl-item_text      = 'BAPI Test G/L line item'.  "#EC NOTEXT
  it_accountgl-bus_area       = '01'.
  it_accountgl-profit_ctr     = '0000010301'.
  it_accountgl-comp_code      = 'SLOC'.
  it_accountgl-tax_code       = 'A3'.
  append it_accountgl.
  clear it_accountgl.
  it_accountgl-itemno_acc     = 7.
it_accountgl-itemno_acc     = 8.
  it_accountgl-gl_account     = '0021510201'.
  it_accountgl-item_text      = 'BAPI Test G/L line item'.  "#EC NOTEXT
it_accountgl-bus_area       = '90'.
it_accountgl-profit_ctr     = '0000900008'.
it_accountgl-comp_code      = 'CORP'.
  append it_accountgl.
  clear it_accountgl.
  it_accountgl-itemno_acc     = 8.
it_accountgl-itemno_acc     = 9.
  it_accountgl-gl_account     = '0082000201'.
  it_accountgl-item_text      = 'BAPI Test G/L line item'.  "#EC NOTEXT
  it_accountgl-bus_area       = '90'.
  it_accountgl-profit_ctr     = '0000900008'.
  it_accountgl-comp_code      = 'CORP'.
it_accountgl-tax_code       = 'A3'.
  append it_accountgl.
endform.                    "fill_accountgl
      FORM fill_header                                              *
form fill_header.
CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
   IMPORTING
     own_logical_system = gd_documentheader-obj_sys.
OBJ_TYPE has to be replaced by customers object key (Y* or Z*)
gd_documentheader-obj_type   = 'IDOC'.
gd_documentheader-obj_key    = ref_key.
  gd_documentheader-username   = sy-uname.
  gd_documentheader-header_txt = 'BAPI Test'.               "#EC NOTEXT
gd_documentheader-obj_key_r  =
GD_DOCUMENTHEADER-reason_rev =
gd_documentheader-comp_code  = 'SLOC'.
GD_DOCUMENTHEADER-AC_DOC_NO  =
  gd_documentheader-fisc_year  = sy-datum(4).
  gd_documentheader-doc_date   = sy-datum.
  gd_documentheader-pstng_date = sy-datum.
GD_DOCUMENTHEADER-TRANS_DATE =
GD_DOCUMENTHEADER-VALUE_DATE =
GD_DOCUMENTHEADER-FIS_PERIOD =
gd_documentheader-doc_type   = 'KR'.
gd_documentheader-ref_doc_no = 'xxxx'.
GD_DOCUMENTHEADER-COMPO_ACC  =
  gd_documentheader-bus_act    = 'RFBU'.
endform.                    "fill_header
      FORM fill_contractheader                                     *
form fill_contractheader.
gd_fica_hd-doc_no           =
gd_fica_hd-doc_type_ca      =
gd_fica_hd-res_key          =
gd_fica_hd-fikey            =
gd_fica_hd-payment_form_ref =
endform.                    "fill_contractheader
      FORM fill_cpd                                                 *
form fill_cpd.
gd_customercpd-name
gd_customercpd-name_2
gd_customercpd-name_3
gd_customercpd-name_4
gd_customercpd-postl_code
gd_customercpd-city
gd_customercpd-country
gd_customercpd-country_iso
gd_customercpd-street
gd_customercpd-po_box
gd_customercpd-pobx_pcd
gd_customercpd-pobk_curac
gd_customercpd-bank_acct
gd_customercpd-bank_no
gd_customercpd-bank_ctry
gd_customercpd-bank_ctry_iso
gd_customercpd-tax_no_1
gd_customercpd-tax_no_2
gd_customercpd-tax
gd_customercpd-equal_tax
gd_customercpd-region
gd_customercpd-ctrl_key
gd_customercpd-instr_key
gd_customercpd-dme_ind
gd_customercpd-langu_iso
endform.                    "fill_cpd
      FORM fill_ar                                                  *
form fill_accountar.
CLEAR it_accountreceivable.
it_accountreceivable-itemno_acc =
it_accountreceivable-customer   =
IT_ACCOUNTRECEIVABLE-REF_KEY_1  =
IT_ACCOUNTRECEIVABLE-REF_KEY_2  =
IT_ACCOUNTRECEIVABLE-REF_KEY_3  =
IT_ACCOUNTRECEIVABLE-PMNTTRMS   =
IT_ACCOUNTRECEIVABLE-BLINE_DATE =
IT_ACCOUNTRECEIVABLE-DSCT_DAYS1 =
IT_ACCOUNTRECEIVABLE-DSCT_DAYS2 =
IT_ACCOUNTRECEIVABLE-NETTERMS   =
IT_ACCOUNTRECEIVABLE-DSCT_PCT1  =
IT_ACCOUNTRECEIVABLE-DSCT_PCT2  =
IT_ACCOUNTRECEIVABLE-PYMT_METH  =
IT_ACCOUNTRECEIVABLE-DUNN_KEY   =
IT_ACCOUNTRECEIVABLE-DUNN_BLOCK =
IT_ACCOUNTRECEIVABLE-PMNT_BLOCK =
IT_ACCOUNTRECEIVABLE-VAT_REG_NO =
IT_ACCOUNTRECEIVABLE-ALLOC_NMBR =
it_accountreceivable-item_text  =
IT_ACCOUNTRECEIVABLE-PARTNER_BK =
IT_ACCOUNTRECEIVABLE-GL_ACCOUNT =
it_accountreceivable-comp_code
it_accountreceivable-bus_area
it_accountreceivable-pmtmthsupl
it_accountreceivable-paymt_ref
it_accountreceivable-scbank_ind
it_accountreceivable-businessplace
it_accountreceivable-sectioncode
it_accountreceivable-branch
it_accountreceivable-pymt_cur
it_accountreceivable-pymt_cur_iso
it_accountreceivable-pymt_amt
it_accountreceivable-c_ctr_area
it_accountreceivable-bank_id
it_accountreceivable-supcountry
it_accountreceivable-supcountry_iso
it_accountreceivable-tax_code
it_accountreceivable-taxjurcode
it_accountreceivable-tax_date
it_accountreceivable-sp_gl_ind
it_accountreceivable-partner_guid = '1465464654'.
APPEND it_accountreceivable.
endform.                    "fill_accountar
      FORM fill_ap                                                  *
form fill_accountap.
  clear it_accountpayable.
  it_accountpayable-itemno_acc = 1.
it_accountpayable-vendor_no  = '0000060259'.
  it_accountpayable-vendor_no  = '0000060693'.
it_accountpayable-gl_account
it_accountpayable-ref_key_1
it_accountpayable-ref_key_2
it_accountpayable-ref_key_3
it_accountpayable-comp_code = 'SLOC'.
it_accountpayable-bus_area = '01'.
it_accountpayable-pmnttrms = 'A000'.
it_accountpayable-bline_date
it_accountpayable-dsct_days1
it_accountpayable-dsct_days2
it_accountpayable-netterms
it_accountpayable-dsct_pct1
it_accountpayable-dsct_pct2
it_accountpayable-pymt_meth
it_accountpayable-pmtmthsupl
it_accountpayable-pmnt_block
it_accountpayable-scbank_ind
it_accountpayable-supcountry
it_accountpayable-supcountry_iso
it_accountpayable-bllsrv_ind
it_accountpayable-alloc_nmbr
  it_accountpayable-item_text  = 'BAPI Test A/P line item'. "#EC NOTEXT
it_accountpayable-po_sub_no
it_accountpayable-po_checkdg
it_accountpayable-po_ref_no
it_accountpayable-w_tax_code
it_accountpayable-businessplace
it_accountpayable-sectioncode
it_accountpayable-instr1
it_accountpayable-instr2
it_accountpayable-instr3
it_accountpayable-instr4
it_accountpayable-branch
it_accountpayable-pymt_cur
it_accountpayable-pymt_amt
it_accountpayable-pymt_cur_iso
it_accountpayable-sp_gl_ind
  append it_accountpayable.
endform.                    "fill_accountap
      FORM fill_tax                                                 *
form fill_accounttax.
  clear it_accounttax.
  it_accounttax-itemno_acc = 4.
  it_accounttax-gl_account = '0011361502'.
  it_accounttax-tax_code   = 'A3'.
  it_accounttax-acct_key   = 'VST'.
  it_accounttax-cond_key   = 'MWVS'.
it_accounttax-itemno_tax = 8.
  append it_accounttax.
clear it_accounttax.
it_accounttax-itemno_acc = 7.
it_accounttax-gl_account = '0011361502'.
it_accounttax-tax_code   = 'A3'.
it_accounttax-acct_key   = 'VST'.
it_accounttax-COND_KEY   = 'MWVS'.
append it_accounttax.
clear it_accounttax.
it_accounttax-itemno_acc = 10.
it_accounttax-itemno_acc = 9.
it_accounttax-gl_account = '0011361502'.
it_accounttax-tax_code   = 'A3'.
it_accounttax-acct_key   = 'VST'.
it_accounttax-cond_key   = 'MWVS'.
it_accounttax-itemno_tax = 4.
append it_accounttax.
endform.                    "fill_accounttax
      FORM fill_currencyamount                                      *
form fill_currencyamount.
  clear it_currencyamount.
  it_currencyamount-itemno_acc   = 1.
  it_currencyamount-curr_type    = '00'.
  it_currencyamount-currency     = 'MXN'.
  it_currencyamount-amt_doccur   = '-7408036.2'.
  append it_currencyamount.
  clear it_currencyamount.
  it_currencyamount-itemno_acc   = 2.
  it_currencyamount-curr_type    = '00'.
  it_currencyamount-currency     = 'MXN'.
  it_currencyamount-amt_doccur   = '5336472.00'.
  append it_currencyamount.
  clear it_currencyamount.
  it_currencyamount-itemno_acc   = 3.
  it_currencyamount-curr_type    = '00'.
  it_currencyamount-currency     = 'MXN'.
  it_currencyamount-amt_doccur   = '3840.00'.
  append it_currencyamount.
  clear it_currencyamount.
  it_currencyamount-itemno_acc   = 4.
  it_currencyamount-curr_type    = '00'.
  it_currencyamount-currency     = 'MXN'.
  it_currencyamount-amt_base   = '5548.00'.
  it_currencyamount-amt_doccur   = '832.2'.
it_currencyamount-amt_doccur   = '576.00'.
it_currencyamount-amt_base   = '3840.00'.
  append it_currencyamount.
  clear it_currencyamount.
  it_currencyamount-itemno_acc   = 5.
  it_currencyamount-curr_type    = '00'.
  it_currencyamount-currency     = 'MXN'.
  it_currencyamount-amt_doccur   = '2051279.00'.
  append it_currencyamount.
  clear it_currencyamount.
  it_currencyamount-itemno_acc   = 6.
  it_currencyamount-curr_type    = '00'.
  it_currencyamount-currency     = 'MXN'.
  it_currencyamount-amt_doccur   = '1690.00'.
  append it_currencyamount.
clear it_currencyamount.
it_currencyamount-itemno_acc   = 7.
it_currencyamount-curr_type    = '00'.
it_currencyamount-currency     = 'MXN'.
it_currencyamount-amt_base     = '1690.00'.
it_currencyamount-amt_doccur   = '253.5'.
append it_currencyamount.
  clear it_currencyamount.
it_currencyamount-itemno_acc   = 8.
  it_currencyamount-itemno_acc   = 7.
  it_currencyamount-curr_type    = '00'.
  it_currencyamount-currency     = 'MXN'.
  it_currencyamount-amt_doccur   = '13905.00'.
  append it_currencyamount.
  clear it_currencyamount.
it_currencyamount-itemno_acc   = 9.
  it_currencyamount-itemno_acc   = 8.
  it_currencyamount-curr_type    = '00'.
  it_currencyamount-currency     = 'MXN'.
it_currencyamount-amt_base     = '2.70'.
  it_currencyamount-amt_doccur   = '18.00'.
  append it_currencyamount.
clear it_currencyamount.
it_currencyamount-itemno_acc   = 10.
it_currencyamount-itemno_acc   = 9.
it_currencyamount-curr_type    = '00'.
it_currencyamount-currency     = 'MXN'.
it_currencyamount-amt_doccur   = '2.70'.
it_currencyamount-amt_base     = '18.00'.
append it_currencyamount.
endform.                    "fill_currencyamount
      FORM fill_criteria                                            *
form fill_criteria.
CLEAR it_criteria.
it_criteria-itemno_acc = 2.
it_criteria-fieldname = 'BZIRK'.
it_criteria-character = '000001'.
append it_criteria.
endform.                    "fill_criteria
      FORM fill_valuefield                                          *
form fill_valuefield.
CLEAR it_valuefield.
it_valuefield-itemno_acc = 2.
it_valuefield-fieldname = 'VV010'.
it_valuefield-curr_type
it_valuefield-currency = 'EUR'.
it_valuefield-currency_iso
it_valuefield-amt_valcom
it_valuefield-base_uom
it_valuefield-base_uom_iso
it_valuefield-qua_valcom
append it_valuefield.
endform.                    "fill_valuefield
      FORM fill_extension                                           *
form fill_extension.
CLEAR it_ext.
it_ext-field1
it_ext-field2
it_ext-field3
it_ext-field4
APPEND it_ext.
DATA: ls_zzz TYPE ZZZ_ACCIT.
CLEAR it_ext2.
it_ext2-structure = 'ZZZ_ACCIT'.
ls_zzz-posnr = 2.
ls_zzz-awref_reb = '123654'.
ls_zzz-aworg_reb = '654654'.
ls_zzz-grant_nbr = '0022002'.
MOVE ls_zzz TO it_ext2-valuepart1.
APPEND it_ext2.
endform.                    "fill_extension
      FORM fill_paymentcard                                         *
form fill_paymentcard.
CLEAR it_paymentcard.
it_paymentcard-itemno_acc = 1.
it_paymentcard-cc_glaccount
it_paymentcard-cc_type
it_paymentcard-cc_number
it_paymentcard-cc_seq_no
it_paymentcard-cc_valid_f
it_paymentcard-cc_valid_t
it_paymentcard-cc_name
it_paymentcard-dataorigin
it_paymentcard-authamount = '100'.
it_paymentcard-currency = 'EUR'.
it_paymentcard-currency_iso
it_paymentcard-cc_autth_no
it_paymentcard-auth_refno
it_paymentcard-auth_date
it_paymentcard-auth_time
it_paymentcard-merchidcl
it_paymentcard-point_of_receipt
it_paymentcard-terminal
it_paymentcard-cctyp = '1'.
APPEND it_paymentcard.
endform.                    "fill_paymentcard
      FORM fill_contractitem                                        *
form fill_contractitem.
CLEAR it_fica_it.
it_fica_it-itemno_acc
it_fica_it-cont_acct
it_fica_it-main_trans
it_fica_it-sub_trans
it_fica_it-func_area
it_fica_it-fm_area
it_fica_it-cmmt_item
it_fica_it-funds_ctr
it_fica_it-fund
append it_fica_it.
endform.                    "fill_contractitem
*&      Form  fill_re
form fill_re .
CLEAR it_re.
it_re-itemno_acc      =
it_re-business_entity =
it_re-building        =
it_re-property        =
it_re-rental_object   =
it_re-serv_charge_key =
it_re-settlement_unit =
it_re-contract_no     =
APPEND it_re.
endform.                    "fill_re
Please check these links
http://sap4.com/wiki/index.php?title=BAPI_ACC_DOCUMENT_POST
http://www.sapfans.com/forums/viewtopic.php?p=76232&sid=b6519d31b5097f49dc303d03b35eed43
http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bapi_acc_document_post-622561
Regards,
Raj.

Similar Messages

  • Bapi for posting FI documents for new General ledger accounting

    Hi,
    We have a requirement for posting FI documents for new General ledger i.e for transaction FB01L. Is there any BAPI for the same so that BDC can be avoided.
    The BAPI "BAPI_ACC_DOCUMENT_POST" is used for FB01. Can we use it for FB01L?? As in this BAPI ledger group field is not there. Please suggest.
    Thanks in advance.
    Regards,
    Gaurav

    Hi Sandra,
    Solved myself using the below options.
    If you are using the BAPI - BAPI_ACC_GL_POSTING_POST, you can pass accounting principle field in importing structure BAPIACHE08. The relation between Legder group & accounting principle has to be configured in SPRO by FICO consultant. Once they configured in the system, get the accounting principles and then pass the accounting principle .
    Code:  s_documentheader-acc_principle  = wa_header-acc_principle.
    Reward me if this will help you.
    Thanks,
    Yerukala Setty

  • BAPI for Posting Asset Documents

    Dear All,
    I have a requirement where I have to post Asset Accounting Documents. The purchase is done from the Vendor. I need to pass the Vendor code, Special GL Indicator and reconciliation Account in one line item and Asset Number in another line item.
    I need to find a BAPI to pass the above values.
    Regards,
    Venkatesh

    Dear All,
    I have a requirement where I have to post Asset Accounting Documents. The purchase is done from the Vendor. I need to pass the Vendor code, Special GL Indicator and reconciliation Account in one line item and Asset Number in another line item.
    I need to find a BAPI to pass the above values.
    Regards,
    Venkatesh

  • BAPI for posting account with special GL indicator

    Hi all,
    is there any other BAPI except than BAPI_ACC_DOCUMENT_POST that can be used to post unt with special GL indicator

    use program RFBIBL00, by setting the TCODE 'FB01' in the structure BBKPF, but if the transaction FB01 does not support the special G/L indicator you require, it may not be possible. I would still give it a shot.
    read the documentation of the program. Additionally, it can be used in conjunction with LSMW for easy setup.
    Re: program to upload vendor/customer items with special GL indicator?

  • ECC 5.0 BAPI for posting documents only in non-leading ledger

    Hello,
    for an FI-interface i want to call an BAPI for posting the documents. The document were posted to the leading ledger and to the non-leading ledger by usage of BAPI_ACC_DOCUMENT_POST.
    Now there are cases to post documents only to the non-leading ledger.
    Is there anywhere a possibility to tell the BAPI (e.g. enter the ledger group) only to post to the non-leading ledger or is another BAPI available to do so.
    Thank you for your help.
    Thomas

    Hi Thomas,
    You can use the same BAPI for any type of ledger postings. You can restrict your postings to Type of ledger.
    Cheers
    Srinivas

  • Example program - posting accounting document,  Idoc ( ACC_DOCUMENT )

    Hi fellows developers,
    here is an example of  usage of the IDOC, directly in program for an accounting document
    (ALE message type ACC_DOCUMENT, bapi BAPI_ACC_DOCUMENT_POST )).
    It was inspired  by the lack of a flexible usage of this IDOC in LSMW
    (f.e. booking of Gl and Vendor from the same file).
    Both cases inbound and outbound are covered, although the outbound idoc was delivered in state
    for furthere dispatching and was further not tested.
    You can adapt this example to any idoc type (bapi type) and load data from anywhere ( file, table, etc.).
    If you have question please ask.
    On my system works !!!:)))
    I hope it will help you in your daily work.
    Regards,
    Miroslaw
    *& Report  Z_MKPR87
    *& Version 1.0 - creates idoc for accounting document with status
    *&  64 - inbound and 30 - outbound.
    *& Then you need to execute program RBDAPP01 for this message type (inbound),
    *& for outbound further dispatching with appropriate tool is required (not tested here).
    *& For inbound, complete booking of document was tested. For outbound
    *& only to the stage 30 - 'Idoc ready for dispatch'.
    *& Program does not require any additional DDIC objects.
    *& The solution gives you possibility for example to book document G/L + Vendor items,
    *& strictly speaking the whole power of this bapi in IDOC can be used. Unfortunately
    *& in LSMW its not the case.:)
    *& Data for idoc is takken from internal table, but can be loaded from anywhere.
    REPORT  Z_MKPR87.
    INCLUDE Z_MKPPR87_TOP.
    INCLUDE Z_MKPPR87_SEL.
    INCLUDE Z_MKPPR87_EVN.
    INCLUDE Z_MKPPR87_IDOC.
    *&  Include           Z_MKPPR87_TOP
    CONSTANTS:
    input structure for idoc ***
    Achtung! don't use BAPI input structures
    they are similar but not flat ( the casting cannot occure, since idoc
    needs flat data - see 'sdata' field in edidd )
    gc_idoc_structure1(27) TYPE c VALUE 'E1BPACHE09',
    gc_idoc_structure2(27) TYPE c VALUE 'E1BPACGL09',
    gc_idoc_structure3(27) TYPE c VALUE 'E1BPACCR09'.
    Structrures for IDOC : ALE message type - ACC_DOCUMENT
                         BAPI - BAPI_ACC_DOCUMENT_POST
    NOTE!  The E1BPXXXXXX structures are flat (char type), opposite to
    BAPI structures (BAPIACHE09. etc. )
    DATA:      gs_DOCUMENTHEADER  TYPE E1BPACHE09,
                    gt_ACCOUNTGL  TYPE TABLE OF E1BPACGL09,
               gt_CURRENCYAMOUNT  TYPE TABLE OF E1BPACCR09,
                gt_idoc_str_names TYPE TABLE OF char15,
                     gs_edidc     LIKE edidc,
               gt_idoc_data TYPE  TABLE OF       edidd,
               gt_comm_idoc_control TYPE TABLE OF edidc.
    *&  Include           Z_MKPPR87_SEL
    SELECTION-SCREEN BEGIN OF BLOCK bk2 WITH FRAME TITLE text-002.
    PARAMETERS:
              p_itype TYPE char15 DEFAULT 'ACC_DOCUMENT03',
    *'CREMAS04',
              p_mtype TYPE EDIDC-mestyp  DEFAULT 'ACC_DOCUMENT',
              p_rport TYPE EDIDC-rcvpor DEFAULT 'LSMW',
              p_rtype TYPE EDIDC-rcvprt DEFAULT 'US',
              p_rname TYPE EDIDC-rcvprn  DEFAULT 'Z_MKARAS',
              p_inbd    TYPE c DEFAULT 'X'.  " C - inbound (2), space - outbound (1)
    SELECTION-SCREEN END OF BLOCK bk2.
    *&  Include           Z_MKPPR87_EVN
    INITIALIZATION.
    PERFORM initialize_idoc_const.
    START-OF-SELECTION.
    PERFORM create_idoc.
    *&  Include           Z_MKPPR87_IDOC
    *&      Form  create_idoc
          text
    FORM create_idoc.
      PERFORM set_bussines_data
                  USING
                     gs_documentheader
                     gt_accountgl
                     gt_currencyamount.
      PERFORM build_idoc_from_bus_dat
                  USING
                     gs_documentheader
                     gt_accountgl
                     gt_currencyamount
                  CHANGING
                     gt_idoc_data.
    CASE p_inbd.
    WHEN 'X'.
       PERFORM create_inbound_idoc.
    WHEN space.
       PERFORM create_outbound_idoc.
    ENDCASE.
    ENDFORM.                    "create_idoc
    *&      Form  create_inbound_idoc
          text
    FORM create_inbound_idoc.
      PERFORM set_idoc_control_inbound CHANGING gs_edidc.
      CALL FUNCTION 'IDOC_WRITE_AND_START_INBOUND'
        EXPORTING
          i_edidc = gs_edidc
        TABLES
          i_edidd = gt_idoc_data.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ELSE.
       MESSAGE 'Inbound idoc(s) created, check in TAC WE02' TYPE 'I'.
      ENDIF.
    ENDFORM.                    "create_inbound_idoc
    *&      Form  create_outbound_idoc
          text
    FORM create_outbound_idoc.
      PERFORM set_idoc_control_outbound   CHANGING   gs_edidc.
      CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
        EXPORTING
          master_idoc_control        = gs_edidc
        TABLES
          communication_idoc_control = gt_comm_idoc_control
          master_idoc_data           = gt_idoc_data.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSE.
       MESSAGE 'Outbound idoc(s) created, check in TAC WE02' TYPE 'I'.
      ENDIF.
    ENDFORM.                    "create_outbound_idoc
    *&      Form  set_idoc_control_inbound
          text
         -->CT_EDIDC   text
    FORM set_idoc_control_inbound CHANGING cs_edidc LIKE gs_edidc.
      DATA: ls_edidc TYPE  edidc.
      cs_edidc-direct = '2'.
      cs_edidc-idoctp = p_itype.
      cs_edidc-mestyp = p_mtype.
      cs_edidc-rcvpor = 'SAPECI'.
      cs_edidc-rcvprt = p_rtype.
      cs_edidc-rcvprn = p_rname.
      cs_edidc-sndpor = p_rport.
      cs_edidc-sndprt = p_rtype.
      cs_edidc-sndprn = p_rname.
      cs_edidc-credat = sy-datum.
      cs_edidc-cretim = sy-uzeit.
    ENDFORM.                    "set_idoc_control
    *&      Form  set_idoc_control_outbound
          text
         -->CS_EDIDC   text
    FORM set_idoc_control_outbound CHANGING cs_edidc LIKE gs_edidc.
      DATA: ls_edidc TYPE  edidc.
      cs_edidc-direct = '1'.
      cs_edidc-idoctp = p_itype.
      cs_edidc-mestyp = p_mtype.
      cs_edidc-rcvpor = p_rport.
      cs_edidc-rcvprt = p_rtype.
      cs_edidc-rcvprn = p_rname.
      cs_edidc-sndpor = 'SAPECI'.
      cs_edidc-sndprt = p_rtype.
      cs_edidc-sndprn = p_rname.
      cs_edidc-credat = sy-datum.
      cs_edidc-cretim = sy-uzeit.
    ENDFORM.                    "set_idoc_control_outbound
    *&      Form  set_bussines_data
          text
         -->CS_DOCUMENTHEADER  text
         -->CT_ACCOUNTGL       text
         -->CT_CURRENCYAMOUNT  text
    FORM set_bussines_data USING cs_documentheader LIKE gs_documentheader
                                 ct_accountgl      LIKE gt_accountgl
                                 ct_currencyamount LIKE gt_currencyamount.
                            CHANGING ct_idoc_data LIKE edidd.
      DATA:
             ls_documentheader TYPE e1bpache09,
             ls_accountgl      LIKE LINE OF  gt_accountgl,
             ls_currencyamount LIKE LINE OF gt_currencyamount.
    HEADER **
      cs_documentheader-bus_act =  'RFBU'.
      cs_documentheader-username = 'RNOWAK'.
      cs_documentheader-comp_code = '1000'.
      cs_documentheader-doc_date = '20071205'.
      cs_documentheader-pstng_date = '20071205'.
      cs_documentheader-fisc_year =  '2007'.
      cs_documentheader-fis_period = '12'.
      cs_documentheader-doc_type = 'JE'.
    POSITIONS ***
    111111111 ****
      ls_accountgl-itemno_acc = '0000000001'.
      ls_accountgl-gl_account = '0000473110'.
      ls_accountgl-item_text = 'MIK test dokumentu GL z programu IUE'.
      ls_accountgl-comp_code = '1000'.
      ls_accountgl-tax_code = '0I'.
      ls_accountgl-costcenter = '0000001000'.
      ls_currencyamount-itemno_acc = '0000000001'.
      ls_currencyamount-currency = 'PLN'.
      ls_currencyamount-amt_doccur = '496'.
      APPEND ls_accountgl TO ct_accountgl.
      APPEND ls_currencyamount TO ct_currencyamount.
    2222222222 ****
      ls_accountgl-itemno_acc = '0000000002'.
      ls_accountgl-gl_account = '0000113302'.
      ls_accountgl-item_text = 'MIK test dokumentu GL z programu IUE'.
      ls_accountgl-comp_code = '1000'.
      ls_accountgl-tax_code = ''.
      ls_accountgl-costcenter = ''.
      ls_currencyamount-itemno_acc = '0000000002'.
      ls_currencyamount-currency = 'PLN'.
      ls_currencyamount-amt_doccur = '-496'.
      APPEND ls_accountgl TO ct_accountgl.
      APPEND ls_currencyamount TO ct_currencyamount.
    ENDFORM.                    "set_bussines_data
    *&      Form  build_idoc_from_bus_dat
          text
         -->IS_DOCUMENTHEADER  text
         -->IT_ACCOUNTGL       text
         -->IT_CURRENCYAMOUNT  text
         -->CT_IDOC_DATA       text
    FORM build_idoc_from_bus_dat USING is_documentheader LIKE gs_documentheader
                                            it_accountgl LIKE gt_accountgl
                                       it_currencyamount LIKE gt_currencyamount
                                   CHANGING ct_idoc_data LIKE gt_idoc_data.
      DATA:
      ls_documentheader LIKE is_documentheader,
      ls_accountgl     LIKE LINE OF it_accountgl ,
      ls_currencyamount LIKE LINE OF  it_currencyamount,
      ls_idoc_data LIKE LINE OF ct_idoc_data.
    Document header *****
      ls_documentheader = is_documentheader.
      ls_idoc_data-segnam = gc_idoc_structure1.
      ls_idoc_data-sdata = ls_documentheader.
      APPEND ls_idoc_data TO ct_idoc_data.
    Positions G/L part ************
      LOOP AT it_accountgl INTO ls_accountgl.
        ls_idoc_data-segnam = gc_idoc_structure2.
        ls_idoc_data-sdata = ls_accountgl.
        APPEND ls_idoc_data TO ct_idoc_data.
      ENDLOOP.
    Currency Items part ******
      LOOP AT  it_currencyamount INTO  ls_currencyamount.
        ls_idoc_data-segnam = gc_idoc_structure3.
        ls_idoc_data-sdata = ls_currencyamount.
        APPEND ls_idoc_data TO ct_idoc_data.
      ENDLOOP.
    ENDFORM.                    "build_idoc_from_bus_dat
    *&      Form  initialize_idoc_const
          text
    FORM initialize_idoc_const.
      APPEND gc_idoc_structure1 TO gt_idoc_str_names.
      APPEND gc_idoc_structure2 TO gt_idoc_str_names.
      APPEND gc_idoc_structure3 TO gt_idoc_str_names.
    ENDFORM.                    "initialize_idoc_const

    I summarized postings and posted again into the same system.  Yes, you can save an IDOC in your own system...There's an IDOC FM that will do just that...  In my case, I did:
    after receipt of IDOC and posting,
    process the idoc tables, rebuilding the input into tables.
    Summarize the tables, as needed.
    Create a new IDOC with a specific function code.
    Save the IDOC in my own system, using IDOC_INBOUND_ASYNCHRONOUS, as I recall.
    I had a custom process code that fired off the standard FM to process the JE posting.  I don't remember all the variables, but I have this stored as my example:
    DATA : p_sndprn TYPE edi_sndpn3.
    * Control Record Build.
      CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
        IMPORTING
          own_logical_system = p_sndprn
        EXCEPTIONS
          OTHERS             = 0.
      iedidc-direct   =  '2'.
      iedidc-idoctyp  =  'FIDCCP02'.
      iedidc-mestyp   =  'FIDCC2'.
      iedidc-mesfct   =  'ACC'.  <customer made up....used to control which process codes fire off when for standard message.
      iedidc-sndprt   =  'LS'.
      iedidc-sndprn   =   p_sndprn.
      iedidc-rcvprn   =   wa-rcvprn.
      iedidc-rcvprt   =  'LS'.
      iedidc-sndpor   =  'SAP_EDI_SC'.
      iedidc-credat   =  sy-datum.
      iedidc-cretim   =  sy-uzeit.
      APPEND iedidc.
    * IDOC store routine...must commit work
    * to get IDOC transferred to the IDOC processor.
      CALL FUNCTION 'IDOC_INBOUND_ASYNCHRONOUS'
        TABLES
          idoc_control_rec_40 = iedidc
          idoc_data_rec_40    = iedidd.
    ENDFORM.                    " send_idoc
    Edited by: DaveL on Oct 25, 2011 8:15 PM

  • Function modules or BAPI for posting plan costs for WBS Element

    Hi all,
    Does anyone know, whether there exists a function module or BAPI for posting plan costs to a WBS Element? K_COSTS_PLAN_PS does not work, because RKP1 is not allowed.
    Greetings

    check
    BAPI_COSTACTPLN_POSTACTINPUT   Activity Input Planning: Posting                
    BAPI_COSTACTPLN_POSTACTOUTPUT  Activity/Price Planning: Posting                
    BAPI_COSTACTPLN_POSTKEYFIGURE  Stat. Key Figure Planning: Postings             
    BAPI_COSTACTPLN_POSTPRIMCOST   Primary Cost Planning: Postings                 
    BAPI_PDTRANSCO_POSTPRIMCOST    Transfer of Planning Data: Post Primary Costs   
    K40C                           CO Actual Postings, Manual                      
    BAPI_ACC_PRIMARY_COSTS_POST    Accounting: Post Primary Costs                  
    BAPI_COPAACTUALS_POSTCOSTDATA  BAPI Operating Concern: Post Costing-Based Actua
    BAPI_PRIM_COST_CHECK_AND_POST  Primary Costs: Formal Parameter Check           
    S@meer

  • Bapi for posting IR line item at a time

    Hi....
    Do we have a bapi for posting invoive receipt line item wise instead of posting the PO at a time......this wud be more precise for my requirement.....presently i'm using bapi_acc_document_post but this wud clear the document with single document number.....but i want it to be posted line item wise to see the amount individually item wise instead of combined one....similar to what we have in the IR which shows amount of individual items........

    This is an old bug that keeps popping up:
    https://forums.lenovo.com/t5/T400-T500-and-newer-T-series/Vertical-scrolling-got-reset-everytime-I-use-Ultra-Nav-to-scroll/td-p/343477

  • Posting accounting documents in G/L accounts.

    HI friends,
    what are the tables involved in posting accounting documents in G/L accounts.
    Please let me know.
    Thanks in advance.
    Roberts.K

    Hi Roberts,
    BKPF and BSEG are your tables for the accounting documents.
    Regards,
    Srinivas

  • BAPI for post Tax Amount

    Hi,
    Please tell me BAPI for post Tax Amount.
    Which tcode use for Post tax code, is it FB01 or FB60.
    Regards
    Jana

    Hi,
    Use BAPI_ACC_DOCUMENT_POST
    TCodes
    FB41    Post Tax Payable
    FB05    Post with Clearing
    FB01    Post Document
    Edited by: Neenu Jose on Nov 18, 2008 1:15 PM
    Edited by: Neenu Jose on Nov 18, 2008 1:16 PM
    Edited by: Neenu Jose on Nov 18, 2008 1:17 PM
    Edited by: Neenu Jose on Nov 18, 2008 1:18 PM

  • BDC / Bapi For  Post Incoming Payment (F-28)

    Hi
    Im creating BDC for F-28. But it got error coming out.
    >> It says DB05B-PSZAH(02) is not an input field.
    What I do is: First, I search for Line Item then Document Number. Then It return to basic list. Then I loop again for the second Line Item Number and Document Number.
    I can activate the first amount but cannot for the next amount and so on.
    Anybody could help me on this??
    Is there any BAPI for Post Incoming Payment (F-28)?
    Thank you.
    Regards.

    i dont think there is a BAPI for this Transaction...
    i have done a BDC on F-28 myself....pasting the code....hope it helps you....
    *******NOTE********
    the parameter in the subroutine is to see if there is a single document or multiple documents being posted.
    FORM fill_bdc_data_f-28_9005 USING p_i_mult_doc TYPE c.
    **BDC from screen 9005
      DATA : l_amt_bdc(13), l_amt_bdc_remain(13), l_amt_bdc_mult(13),
             l_amt_bdc_mult_remain(13), l_assignment(14), l_period(2),
             l_amount(13).
      CLEAR t_bdcdata.
      REFRESH t_bdcdata.
      PERFORM bdc_dynpro USING 'SAPMF05A' '0103'.
      PERFORM bdc_field USING 'BDC_OKCODE' '=AB'.   "OK CODE - doc overview
    **get user default date format and pass date in that format
      PERFORM convert_date_to_user_format USING bkpf-bldat.
      PERFORM bdc_field USING 'BKPF-BLDAT' w_date.  "cheque date
      CLEAR w_date.
      PERFORM bdc_field USING 'BKPF-BLART' i_blart.  "doc type
      PERFORM bdc_field USING 'BKPF-BUKRS' i_bukrs.  "comp code
    **get user default date format and pass date in that format
      PERFORM convert_date_to_user_format USING bkpf-budat.
      PERFORM bdc_field USING 'BKPF-BUDAT' w_date.  "posting date
      CLEAR w_date.
      l_period = sy-datum+4(2).
      PERFORM bdc_field USING 'BKPF-MONAT' l_period. "period
      PERFORM bdc_field USING 'BKPF-WAERS' 'INR'.    "currency
      PERFORM bdc_field USING 'BKPF-BKTXT' i_bankl.  "doc. hdr. text
      PERFORM bdc_field USING 'BKPF-XBLNR' i_xblnr.  "Ref. Document No.
      PERFORM bdc_field USING 'BSEG-ZUONR' i_zuonr.  "Assignment(Depot Code)
      PERFORM bdc_field USING 'RF05A-KONTO' i_bank_gl. "Bank GL acc
      PERFORM bdc_field USING 'BSEG-GSBER' i_gsber.  "Business Area
      l_amount = bseg-wrbtr.
      PERFORM bdc_field USING 'BSEG-WRBTR' l_amount. "Amount
      PERFORM bdc_field USING 'BSEG-PRCTR' ''.  "Profit Center
    **open items data
      PERFORM bdc_field USING 'RF05A-AGKOA' 'D'.     "Acc type (D=customers)
      PERFORM bdc_field USING 'RF05A-XNOPS' 'X'.     "Std OIs check box
    **end of first screen
    **document overview screen
      PERFORM bdc_dynpro USING 'SAPMF05A' '0700'.    "Overview Screen
      PERFORM bdc_field USING 'BDC_CURSOR' 'RF05A-AZEI1(01)'.     "cursor
      PERFORM bdc_field USING 'BDC_OKCODE' '/00'.     "OK CODE
      PERFORM bdc_field USING 'RF05A-NEWBS' '19'.    "posting key
      PERFORM bdc_field USING 'RF05A-NEWKO' i_kunnr. "customer
      PERFORM bdc_field USING 'RF05A-NEWUM' 'B'.     "Spl GL Indicator
    **for single document selected
      CLEAR l_amt_bdc.
      IF p_i_mult_doc = ''.
    ***new screen - next line item
        PERFORM bdc_dynpro USING 'SAPMF05A' '0303'.
        PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.    "OK CODE
    **for single document, use the bouncing amount calculated earlier
        l_amt_bdc = w_amt_ant_bouncing.
        PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc. "amount
    **due date - same as posting date on screen
    **get user default date format and pass date in that format
        PERFORM convert_date_to_user_format USING bkpf-budat.
        PERFORM bdc_field USING 'BSEG-ZFBDT' w_date.  "due date
        CLEAR w_date.
    **assignment
        CLEAR l_assignment.
        CONCATENATE t_seldoc_ant_bouncing-belnr
                    t_seldoc_ant_bouncing-gjahr INTO l_assignment.
        PERFORM bdc_field USING 'BSEG-ZUONR' l_assignment. "assignment
        PERFORM bdc_field USING 'BSEG-GSBER' i_gsber.
    **if there is some remaining amount, then go for another line item
        IF w_rem_amt_ant_bouncing > 0.
          PERFORM bdc_field USING 'RF05A-NEWBS' '15'.    "posting key
          PERFORM bdc_field USING 'RF05A-NEWKO' i_kunnr. "customer
    **new screen
          PERFORM bdc_dynpro USING 'SAPMF05A' '0301'.
          PERFORM bdc_field USING 'BDC_CURSOR' 'BSEG-ZTERM'. "CURSOR
          PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.    "OK CODE-ENTER
          l_amt_bdc_remain = w_rem_amt_ant_bouncing.
          PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc_remain.
          PERFORM bdc_field USING 'BSEG-ZTERM' '0001'.
    **AGAIN
          PERFORM bdc_dynpro USING 'SAPMF05A' '0301'.
          PERFORM bdc_field USING 'BDC_CURSOR' 'BSEG-WRBTR'. "CURSOR
          PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.    "OK CODE-SAVE
          PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc_remain.
          PERFORM bdc_field USING 'BSEG-ZTERM' '0001'. "pmt term -hardcoded
          PERFORM bdc_field USING 'BSEG-SKFBT' l_amt_bdc_remain.
        ENDIF.
    **multiple documents
      ELSE.
    **initialize remaining amount to amt entered on screen
        l_amt_bdc_mult_remain = bseg-wrbtr.
        LOOP AT t_seldoc_ant_bouncing.
          IF l_amt_bdc_mult_remain > 0.
            IF bseg-wrbtr > t_seldoc_ant_bouncing-rem_amt.
              l_amt_bdc_mult = t_seldoc_ant_bouncing-rem_amt.
            ELSE.
              l_amt_bdc_mult = bseg-wrbtr.
            ENDIF.
    **remaining amt = screen amt - amt calculated above.
            l_amt_bdc_mult_remain = l_amt_bdc_mult_remain - l_amt_bdc_mult.
            PERFORM bdc_dynpro USING 'SAPMF05A' '0303'.
            PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.    "OK CODE
            PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc_mult. "amount
            PERFORM bdc_field USING 'BSEG-GSBER' i_gsber.  "Business Area
    **due date - same as posting date on screen
    **get user default date format and pass date in that format
            PERFORM convert_date_to_user_format USING bkpf-budat.
            PERFORM bdc_field USING 'BSEG-ZFBDT' w_date.  "due date
            CLEAR w_date.
    **assignment
            CLEAR l_assignment.
            CONCATENATE t_seldoc_ant_bouncing-belnr
                        t_seldoc_ant_bouncing-gjahr INTO l_assignment.
            PERFORM bdc_field USING 'BSEG-ZUONR' l_assignment. "assignment
    **posting key 19 for all but last document
            PERFORM bdc_field USING 'RF05A-NEWBS' '19'.    "posting key
            PERFORM bdc_field USING 'RF05A-NEWKO' i_kunnr. "customer
            PERFORM bdc_field USING 'RF05A-NEWUM' 'B'.     "Spl GL
          ENDIF.
        ENDLOOP.
      ENDIF.
    **post remaining amount
      IF p_i_mult_doc = 'X'.
    **new screen if there is some amount left
        IF l_amt_bdc_mult_remain > 0.
    **posting key 15 with remaining amount
          PERFORM bdc_field USING 'RF05A-NEWBS' '15'.    "posting key
          PERFORM bdc_field USING 'RF05A-NEWKO' i_kunnr. "customer
          PERFORM bdc_field USING 'RF05A-NEWUM' ''.     "Spl GL
    **new screen
          PERFORM bdc_dynpro USING 'SAPMF05A' '0301'.
          PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.    "OK CODE
          PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc_mult_remain.
          PERFORM bdc_field USING 'BSEG-ZTERM' '0001'. "pmt term - hardcoded
        ELSE.
    **if no amount is left, no need for a further line item
          PERFORM bdc_field USING 'RF05A-NEWBS' ''.    "posting key
          PERFORM bdc_field USING 'RF05A-NEWKO' ''. "customer
          PERFORM bdc_field USING 'RF05A-NEWUM' ''.     "Spl GL
        ENDIF.
      ENDIF.
    **clear variables
      CLEAR : l_amount, l_assignment, l_amt_bdc,
              l_amt_bdc_remain,l_amt_bdc_mult, l_amt_bdc_mult_remain.
    ENDFORM.                    " fill_bdc_data_F-28_9005

  • FM/BAPI for Parking a document ( FBV1 )

    Hi Experts,
    We have a requirement where we need to POST a document & then Park It.
    We are able to post a document using "BAPI_ACC_DOCUMENT_POST ".
    But we are unable to find a FM/BAPI for Parking a document.
    We cannot use BDC as the document type is not fixed. The transaction has different screens for each document type.
    Any pointers to FM/BAPI or any other alternative solution to Park a document.
    Thanks,
    Best regards,
    Prashant

    Hi Prashant,
       Refer the below link it will help u.
    https://forums.sdn.sap.com/click.jspa?searchID=11002520&messageID=3632073
    https://forums.sdn.sap.com/click.jspa?searchID=11002520&messageID=3475534
    Regards
    Kiran Sure

  • Using FM PRELIMINARY_POSTING_FB01 for Posting a Document

    Hi there,
    Can we use FM PRELIMINARY_POSTING_FB01 for Posting a document? Has anybody done that? Please let me know which of the following needs to be populated? Thanks a lot.
    (TEXT_UPDATE)
    TEXT_ITEM_UPDATE)
    (I_UF05A)
    (I_XCMPL)
    (FS006_FB01)
    (I_TCODE)
    (I_PARGB)
    (I_TCODE_INT)
    Does anybody have any documentation/help on this FM? Please let me know - as I need to do this sometime next week.
    Edited by: sam jose on Apr 29, 2010 4:50 PM
    Edited by: Rob Burbank on May 5, 2010 10:13 AM

    Dear Sam,
    You can Use the bapi BAPI_ACC_DOCUMENT_POST. By using the extension tables of the BAPI when creating the accoutning documents you will pass all the fields you did not found on the standard tables.
    Now, you will use the BTE (Business Transaction Event) RWBAPI01 : SAMPLE_INTERFACE_RWBAPI01, and you will find all the data you fill in the tables Extension in the bapi, and you have to transfer it to table IT_ACCIT.
    You can fill even specific fields of table BSEG if you want.
    Regards,
    Yassine NEJMY

  • BDC Program for posting FI document

    Hi everyone!
    Anyone out there already made a BDC program for posting FI documents with this concept:
    User will upload a spreadsheet file with the line items per row
    User will input which TCODE user will use for posting
    BDC program will then post the document using the line items in the spreadsheet file
    I need to make a BDC program with that concept but having a hard time to think of a good algorithm to make my program very flexible.
    Thanks!

    you can use batch input program RFBIBL00 to pasrk document. Please check these links for more information.
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CAGTFADM/CAGTFADM-FI.pdf
    http://help.sap.com/printdocu/core/print46b/en/data/en/pdf/CAGTFADM-FI.pdf
    Have a processing routine defined for the specific Idocs that come into SAP.
    So, as and when the idocs are in, the routine triggers and you can codeappropriately in the routine for parking the idocs.
    Check these threads
    BAPI For Parking FI Document
    Post FI Parked Documents
    You can use message type INVOIC, IDoc Type INVOIC01/02 with process code INVF (FM IDOC_INPUT_INVOIC_FI) for FBV1 transaction.
    See if there are any BAPI/FMs for parking an FI document.
    1.. Use INVOIC01 IDOC with INVF process code (This works for Vendor Line Items only). I read the documentation somewhere that, this would work even if the line items are > 999
    2.. BAPI_ACC_INVOICE_RECEIPT_POST (This works for Vendor Line Items only)
    3.. BAPI_ACC_DOCUMENT_POST (Tax jurisdiction allocation not calculated properly)
    4.. BAPI_ACC_GL_POSTING_POST (No tax line items allowed for this BAPI)

  • BTE while posting accounting document through MIRO

    Hi All,
    I am doing MIRO posting with PO,while MIRO posting accounting document is getting created for it.  I need a BTE while posting accounting document through MIRO to trigger workflow(through event).
    For direct accounting document posting I found the BTE 1030 to trigger workflow.
    Thanks
    Sree

    Hello !
          The BTE required is "00001120     DOCUMENT POSTING:  Field substitution header/items".
          Double click on this entry at FIBF transaction and you will find the function module SAMPLE_PROCESS_00001120
          Take a copy of this function module and go ahead.It is not possible to change the tables T_BKPF and T_BSEG. So, use the tables T_BKPFSUB and T_BSEGSUB.
    Regards,
    S.Suresh

Maybe you are looking for

  • Spry Menu Vertical - Border thickness problem in IE 7

    Hello, No. I'm not using the last 1.6.1 file, because I have change the css vertical menu to fit my design style. Errors that I get: They are all with IE 7 versions. In Firefox, everything is great. 1) A weird refresh when I click on the submenu link

  • Special procurement Key in APO

    How do I define in APO the special procurement key relationships between plants within the company or consignment/ subcontracting, just want to maintain the same relationship as in R/3. I know you answered about special procurement type U: stock tran

  • Help in enhancing CRM logon function module

    Hello all, We have a situation where in the past we have allowed the creation of multiple Business Partners sharing the same e-mail address. We are about to close this loophole but we have this as a master data issue for some existing Customers/Busin

  • Workflow Modularization and Performance

    One of the great benefits of workflow system is the flexibility to develop reuseable, integrated processes.  In a recent discussion with a SAP representative he mentioned that when developing a workflow it is important to be mindful of the resources

  • Function module for logical database

    hi which function module will return the logical database for a given application component from the SAP hierarchy. Example: Input- application component- LO output- MSM, etc., Thank you.