<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problem with  bapi &amp;quot;BAPI_ACC_DOCUMENT_POST&amp;quot; in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bapi-quot-bapi-acc-document-post-quot/m-p/5420484#M1244165</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the sample code...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check you r entries and correct..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  loop at gt_header.
*    GT_HEADER-BUDAT = sy-datum - 5.
*    GT_HEADER-BLDAT = sy-datum.
    vcounter = 1.
    gt_header-wrbtr = gt_header-wrbtr  * -1.
*FILLING INPORTING PARAMETER STRUCTURE.
    wa_documentheader-comp_code = gt_header-bukrs.
    wa_documentheader-doc_date = gt_header-bldat.
    wa_documentheader-pstng_date = gt_header-budat.
    wa_documentheader-username = sy-uname.
    wa_documentheader-bus_act = 'RFBU'.
    wa_documentheader-doc_type = 'KR'.

    gt_accountpayable-itemno_acc = vcounter.
    gt_accountpayable-vendor_no =  gt_header-accnt.
    append gt_accountpayable.
    clear gt_accountpayable.

    gt_currencyamount-itemno_acc = vcounter.
    gt_currencyamount-currency = 'INR'.
    gt_currencyamount-amt_doccur = gt_header-wrbtr.
    append gt_currencyamount.
    clear gt_currencyamount.
    loop at gt_item where identifier = gt_header-identifier.
      vcounter = vcounter + 1.           .
      gt_accountgl-itemno_acc = vcounter.


      call function 'CONVERSION_EXIT_ALPHA_INPUT'
        exporting
          input  = gt_item-hkont
        importing
          output = gt_item-hkont.
      gt_accountgl-gl_account = gt_item-hkont.


      call function 'CONVERSION_EXIT_ALPHA_INPUT'
        exporting
          input  = gt_item-kostl
        importing
          output = gt_item-kostl.

      gt_accountgl-costcenter = gt_item-kostl.
      gt_accountgl-pstng_date = gt_header-budat.
      append gt_accountgl.
      clear gt_accountgl.
      gt_currencyamount-itemno_acc = vcounter.
      gt_currencyamount-currency = 'INR'.
      gt_currencyamount-amt_doccur = gt_item-wrbtr.
      append gt_currencyamount.
      clear gt_currencyamount.
    endloop.
    call function 'BAPI_ACC_DOCUMENT_POST'
      exporting
        documentheader          = wa_documentheader
*       CUSTOMERCPD             = CUSTOMERCPD
*       CONTRACTHEADER          = CONTRACTHEADER
     importing
*       OBJ_TYPE                = OBJ_TYPE
       obj_key                 =  v_refkey
*       OBJ_SYS                 = OBJ_SYS
      tables
       accountgl               = gt_accountgl
*       ACCOUNTRECEIVABLE       = ACCOUNTRECEIVABLE
       accountpayable          = gt_accountpayable
*       ACCOUNTTAX              = ACCOUNTTAX
        currencyamount          = gt_currencyamount
*       CRITERIA                = CRITERIA
*       VALUEFIELD              = VALUEFIELD
*       EXTENSION1              = EXTENSION1
        return                  = gt_return
*       PAYMENTCARD             = PAYMENTCARD
*       CONTRACTITEM            = CONTRACTITEM
*       EXTENSION2              = EXTENSION2
*       REALESTATE              = REALESTATE
.

    break-point.

    if p_test is initial.
      call function 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
*   WAIT          = WAIT
* IMPORTING
*   RETURN        = RETURN
      .
    endif.         .


  endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Prabhudas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Mar 2009 18:09:11 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-03-30T18:09:11Z</dc:date>
    <item>
      <title>Problem with  bapi "BAPI_ACC_DOCUMENT_POST"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bapi-quot-bapi-acc-document-post-quot/m-p/5420480#M1244161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                        I am using the bapi BAPI_ACC_DOCUMENT_POST for posting the document. In that I am passing the value to DOCUMENTHEADER-VATDAT from program this is a header field. After execution of this BAPI. document get posted. but DOCUMENTHEADER-VATDAT  field is not updates in BKPF table in BKPF-VATDATE field, and other fields are updating in BKPF table. &lt;/P&gt;&lt;P&gt;                     Can anyone guide me....why this is happening?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;/P&gt;&lt;P&gt;Chetan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2009 15:24:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bapi-quot-bapi-acc-document-post-quot/m-p/5420480#M1244161</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-30T15:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with  bapi "BAPI_ACC_DOCUMENT_POST"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bapi-quot-bapi-acc-document-post-quot/m-p/5420481#M1244162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chetan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is no field in Documentheader and BKPF named VATDAT/VATDATE.&lt;/P&gt;&lt;P&gt;If its the document date, pass it in DOCUMENTHEADER-DOC_Date and it should be updated in BKPF-BFDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ashish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2009 15:42:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bapi-quot-bapi-acc-document-post-quot/m-p/5420481#M1244162</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-30T15:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with  bapi "BAPI_ACC_DOCUMENT_POST"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bapi-quot-bapi-acc-document-post-quot/m-p/5420482#M1244163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;see the sample code and correct where u did mistake..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  Z_BAPI_1_NVK
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*

report  z_bapi_1_nvk.
data : st_header type bapiache09,
       it_account_gl type  table of bapiacgl09
                     with header line,
       it_account_payable type  table of bapiacap09
                     with header line,
       it_currency_amount type  table of bapiaccr09
                     with header line,
       it_return type table of bapiret2 with header line,
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;                    INTERNAL TABLE TO READ THE FILE
*&amp;amp;---------------------------------------------------------------------*
      begin of it_getfile occurs 0,
        strng type string,
      end of it_getfile,
      begin of it_downfile occurs 0,
       strng2 type string,
      end of it_downfile,
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;                    INTERNAL TABLE TO HOLD THE DATA
*&amp;amp;---------------------------------------------------------------------*
     begin of it_head occurs 0,
         reccount(2),
         identifier(4),
         compcod(10),
         accnt(10),
         bldat like sy-datum,
         budat like sy-datum,
         wrbtr(15),
     end of it_head,
     begin of it_item occurs 0,
         reccount(2),
         identifier(4),
         hkont(10),
         wrbtr(15),
         kostl(10),
     end of it_item,
*     INTERNAL TABLES TO HOLD ERRORS IN HEADER LEVER/ ITEM LEVEL.
    begin of it_head_er occurs 0,
         reccount(2),
         identifier(4),
         accnt(30),
         bldat like sy-datum,
         budat like sy-datum,
         wrbtr(30),
     end of it_head_er,
     begin of it_item_er occurs 0,
         reccount(2),
         identifier(4),
         hkont(30),
         wrbtr(30),
         kostl(30),
     end of it_item_er,
     v_file_name   type string,
     v_defile type string,
     counter type i,
     credit type c,
     credit1 like it_head-wrbtr.
selection-screen begin of block b1 with frame title text-001.
parameters:p_tstdt as checkbox default 'X'.
selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-002.
parameters:p_get  like  ibipparms-path obligatory.
selection-screen end of block b2.
selection-screen begin of block b3 with frame title text-003.
parameters: p_give like  ibipparms-path obligatory.
selection-screen end of block b3.

at selection-screen on value-request for p_get.
  perform f4_filename using 'P_GET'
                      changing p_get.

at selection-screen on value-request for p_give.
  perform f4_filename using 'P_GIVE'
                      changing p_give.



start-of-selection.
  v_file_name = p_get.
    perform  upload.
  perform splitstring.
  perform build_bapi.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  F4_FILENAME
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;P_0290   text
*      &amp;lt;--P_P_GET  text
*----------------------------------------------------------------------*
form f4_filename  using    p_name
                  changing p_value.
*CALLING F4_FILENAME FUNCTION MODULE TO GET THE F4 HELP.
  call function 'F4_FILENAME'
    exporting
      program_name  = syst-cprog
      dynpro_number = syst-dynnr
      field_name    = p_name
    importing
      file_name     = p_value.
endform.                    " F4_FILENAME


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  UPLOAD
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form upload .
  call function 'GUI_UPLOAD'
    exporting
      filename                      = v_file_name
*     FILETYPE                      = 'ASC'
*     HAS_FIELD_SEPARATOR           = ' '
*     HEADER_LENGTH                 = 0
*     READ_BY_LINE                  = 'X'
*     DAT_MODE                      = ' '
*     CODEPAGE                      = ' '
*     IGNORE_CERR                   = ABAP_TRUE
*     REPLACEMENT                   = '#'
*     CHECK_BOM                     = ' '
*     VIRUS_SCAN_PROFILE            = VIRUS_SCAN_PROFILE
*     NO_AUTH_CHECK                 = ' '
*   IMPORTING
*     FILELENGTH                    = FILELENGTH
*     HEADER                        = HEADER
    tables
      data_tab                      = it_getfile
   exceptions
     file_open_error               = 1
     file_read_error               = 2
     no_batch                      = 3
     gui_refuse_filetransfer       = 4
     invalid_type                  = 5
     no_authority                  = 6
     unknown_error                 = 7
     bad_data_format               = 8
     header_not_allowed            = 9
     separator_not_allowed         = 10
     header_too_long               = 11
     unknown_dp_error              = 12
     access_denied                 = 13
     dp_out_of_memory              = 14
     disk_full                     = 15
     dp_timeout                    = 16
     others                        = 17
            .
  if sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.



endform.                    " UPLOAD

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  splitstring
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form splitstring .
  loop at it_getfile.
    if it_getfile-strng+0(1)  = '1'.
      split it_getfile-strng at cl_abap_char_utilities=&amp;gt;horizontal_tab
                                  into
                                  it_head-reccount
                                  it_head-identifier
                                  it_head-compcod
                                  it_head-accnt
                                  it_head-bldat
                                  it_head-budat
                                  it_head-wrbtr.
      append it_head.
      clear it_head.
    else.
      split it_getfile-strng at cl_abap_char_utilities=&amp;gt;horizontal_tab
                                into
                                it_item-reccount
                                it_item-identifier
                                it_item-hkont
                                it_item-wrbtr
                                it_item-kostl.
      append it_item.
      clear it_item.

    endif.
  endloop.
endform.                    " splitstring
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  build_bapi
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form build_bapi .

  loop at it_head.
    counter = 1.

    it_head-wrbtr = it_head-wrbtr * -1.

    st_header-comp_code = it_head-compcod.
    st_header-doc_date = it_head-bldat.
    st_header-pstng_date = it_head-budat.
    st_header-username = sy-uname.
    st_header-bus_act = 'RFBU'.
    st_header-doc_type = 'KR'.

    it_account_payable-itemno_acc  = counter.
    it_account_payable-vendor_no    = it_head-accnt.
    append it_account_payable.
    clear it_account_payable.

    it_currency_amount-itemno_acc = counter.
    it_currency_amount-currency = 'INR'.
    it_currency_amount-amt_doccur = it_head-wrbtr.
    append it_currency_amount.
    clear it_currency_amount.



    loop at it_item where identifier = it_head-identifier.
      counter = counter + 1.


      call function 'CONVERSION_EXIT_ALPHA_INPUT'
        exporting
          input  = it_item-hkont
        importing
          output = it_item-hkont.
      call function 'CONVERSION_EXIT_ALPHA_INPUT'
        exporting
          input  = it_item-kostl
        importing
          output = it_item-kostl.
      it_account_gl-itemno_acc  = counter.
      it_account_gl-gl_account    = it_item-hkont.
      it_account_gl-costcenter    = it_item-kostl.
      append it_account_gl.
      clear it_account_gl.

      it_currency_amount-itemno_acc = counter.
      it_currency_amount-currency = 'INR'.
      it_currency_amount-amt_doccur = it_item-wrbtr.
      append it_currency_amount.
      clear it_currency_amount.

    endloop.
    call function 'BAPI_ACC_DOCUMENT_POST'
       exporting
         documentheader          = st_header
*           CUSTOMERCPD             = CUSTOMERCPD
*           CONTRACTHEADER          = CONTRACTHEADER
*         IMPORTING
*           OBJ_TYPE                = OBJ_TYPE
*           OBJ_KEY                 = OBJ_KEY
*           OBJ_SYS                 = OBJ_SYS
       tables
             accountgl               = it_account_gl
*           ACCOUNTRECEIVABLE       = ACCOUNTRECEIVABLE
             accountpayable          = it_account_payable
*           ACCOUNTTAX              = ACCOUNTTAX
             currencyamount          = it_currency_amount
*           CRITERIA                = CRITERIA
*           VALUEFIELD              = VALUEFIELD
*           EXTENSION1              = EXTENSION1
         return                  = it_return
*           PAYMENTCARD             = PAYMENTCARD
*           CONTRACTITEM            = CONTRACTITEM
*           EXTENSION2              = EXTENSION2
*           REALESTATE              = REALESTATE
       .
    if p_tstdt is initial.
      call function 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
*   WAIT          =
* IMPORTING
*   RETURN        =
                .
    endif.
break-point.
    loop at it_return.
    write: /1(2) it_head-identifier,3(1) '|', 4(50) it_return-message.
    endloop.
  refresh:it_account_gl,
          it_account_payable,
          it_currency_amount,
          it_return.
  endloop.

endform.                    " build_bapi
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Prabhudas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2009 18:01:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bapi-quot-bapi-acc-document-post-quot/m-p/5420482#M1244163</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-30T18:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with  bapi "BAPI_ACC_DOCUMENT_POST"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bapi-quot-bapi-acc-document-post-quot/m-p/5420483#M1244164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for above post..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the sample code and correct the you r code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  Z_BAPI_1_NVK
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*

report  z_bapi_1_nvk.
data : st_header type bapiache09,
       it_account_gl type  table of bapiacgl09
                     with header line,
       it_account_payable type  table of bapiacap09
                     with header line,
       it_currency_amount type  table of bapiaccr09
                     with header line,
       it_return type table of bapiret2 with header line,
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;                    INTERNAL TABLE TO READ THE FILE
*&amp;amp;---------------------------------------------------------------------*
      begin of it_getfile occurs 0,
        strng type string,
      end of it_getfile,
      begin of it_downfile occurs 0,
       strng2 type string,
      end of it_downfile,
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;                    INTERNAL TABLE TO HOLD THE DATA
*&amp;amp;---------------------------------------------------------------------*
     begin of it_head occurs 0,
         reccount(2),
         identifier(4),
         compcod(10),
         accnt(10),
         bldat like sy-datum,
         budat like sy-datum,
         wrbtr(15),
     end of it_head,
     begin of it_item occurs 0,
         reccount(2),
         identifier(4),
         hkont(10),
         wrbtr(15),
         kostl(10),
     end of it_item,
*     INTERNAL TABLES TO HOLD ERRORS IN HEADER LEVER/ ITEM LEVEL.
    begin of it_head_er occurs 0,
         reccount(2),
         identifier(4),
         accnt(30),
         bldat like sy-datum,
         budat like sy-datum,
         wrbtr(30),
     end of it_head_er,
     begin of it_item_er occurs 0,
         reccount(2),
         identifier(4),
         hkont(30),
         wrbtr(30),
         kostl(30),
     end of it_item_er,
     v_file_name   type string,
     v_defile type string,
     counter type i,
     credit type c,
     credit1 like it_head-wrbtr.
selection-screen begin of block b1 with frame title text-001.
parameters:p_tstdt as checkbox default 'X'.
selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-002.
parameters:p_get  like  ibipparms-path obligatory.
selection-screen end of block b2.
selection-screen begin of block b3 with frame title text-003.
parameters: p_give like  ibipparms-path obligatory.
selection-screen end of block b3.

at selection-screen on value-request for p_get.
  perform f4_filename using 'P_GET'
                      changing p_get.

at selection-screen on value-request for p_give.
  perform f4_filename using 'P_GIVE'
                      changing p_give.



start-of-selection.
  v_file_name = p_get.
    perform  upload.
  perform splitstring.
  perform build_bapi.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  F4_FILENAME
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;P_0290   text
*      &amp;lt;--P_P_GET  text
*----------------------------------------------------------------------*
form f4_filename  using    p_name
                  changing p_value.
*CALLING F4_FILENAME FUNCTION MODULE TO GET THE F4 HELP.
  call function 'F4_FILENAME'
    exporting
      program_name  = syst-cprog
      dynpro_number = syst-dynnr
      field_name    = p_name
    importing
      file_name     = p_value.
endform.                    " F4_FILENAME


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  UPLOAD
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form upload .
  call function 'GUI_UPLOAD'
    exporting
      filename                      = v_file_name
*     FILETYPE                      = 'ASC'
*     HAS_FIELD_SEPARATOR           = ' '
*     HEADER_LENGTH                 = 0
*     READ_BY_LINE                  = 'X'
*     DAT_MODE                      = ' '
*     CODEPAGE                      = ' '
*     IGNORE_CERR                   = ABAP_TRUE
*     REPLACEMENT                   = '#'
*     CHECK_BOM                     = ' '
*     VIRUS_SCAN_PROFILE            = VIRUS_SCAN_PROFILE
*     NO_AUTH_CHECK                 = ' '
*   IMPORTING
*     FILELENGTH                    = FILELENGTH
*     HEADER                        = HEADER
    tables
      data_tab                      = it_getfile
   exceptions
     file_open_error               = 1
     file_read_error               = 2
     no_batch                      = 3
     gui_refuse_filetransfer       = 4
     invalid_type                  = 5
     no_authority                  = 6
     unknown_error                 = 7
     bad_data_format               = 8
     header_not_allowed            = 9
     separator_not_allowed         = 10
     header_too_long               = 11
     unknown_dp_error              = 12
     access_denied                 = 13
     dp_out_of_memory              = 14
     disk_full                     = 15
     dp_timeout                    = 16
     others                        = 17
            .
  if sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.



endform.                    " UPLOAD

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  splitstring
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form splitstring .
  loop at it_getfile.
    if it_getfile-strng+0(1)  = '1'.
      split it_getfile-strng at cl_abap_char_utilities=&amp;gt;horizontal_tab
                                  into
                                  it_head-reccount
                                  it_head-identifier
                                  it_head-compcod
                                  it_head-accnt
                                  it_head-bldat
                                  it_head-budat
                                  it_head-wrbtr.
      append it_head.
      clear it_head.
    else.
      split it_getfile-strng at cl_abap_char_utilities=&amp;gt;horizontal_tab
                                into
                                it_item-reccount
                                it_item-identifier
                                it_item-hkont
                                it_item-wrbtr
                                it_item-kostl.
      append it_item.
      clear it_item.

    endif.
  endloop.
endform.                    " splitstring
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  build_bapi
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form build_bapi .

  loop at it_head.
    counter = 1.

    it_head-wrbtr = it_head-wrbtr * -1.

    st_header-comp_code = it_head-compcod.
    st_header-doc_date = it_head-bldat.
    st_header-pstng_date = it_head-budat.
    st_header-username = sy-uname.
    st_header-bus_act = 'RFBU'.
    st_header-doc_type = 'KR'.

    it_account_payable-itemno_acc  = counter.
    it_account_payable-vendor_no    = it_head-accnt.
    append it_account_payable.
    clear it_account_payable.

    it_currency_amount-itemno_acc = counter.
    it_currency_amount-currency = 'INR'.
    it_currency_amount-amt_doccur = it_head-wrbtr.
    append it_currency_amount.
    clear it_currency_amount.



    loop at it_item where identifier = it_head-identifier.
      counter = counter + 1.


      call function 'CONVERSION_EXIT_ALPHA_INPUT'
        exporting
          input  = it_item-hkont
        importing
          output = it_item-hkont.
      call function 'CONVERSION_EXIT_ALPHA_INPUT'
        exporting
          input  = it_item-kostl
        importing
          output = it_item-kostl.
      it_account_gl-itemno_acc  = counter.
      it_account_gl-gl_account    = it_item-hkont.
      it_account_gl-costcenter    = it_item-kostl.
      append it_account_gl.
      clear it_account_gl.

      it_currency_amount-itemno_acc = counter.
      it_currency_amount-currency = 'INR'.
      it_currency_amount-amt_doccur = it_item-wrbtr.
      append it_currency_amount.
      clear it_currency_amount.

    endloop.
    call function 'BAPI_ACC_DOCUMENT_POST'
       exporting
         documentheader          = st_header
*           CUSTOMERCPD             = CUSTOMERCPD
*           CONTRACTHEADER          = CONTRACTHEADER
*         IMPORTING
*           OBJ_TYPE                = OBJ_TYPE
*           OBJ_KEY                 = OBJ_KEY
*           OBJ_SYS                 = OBJ_SYS
       tables
             accountgl               = it_account_gl
*           ACCOUNTRECEIVABLE       = ACCOUNTRECEIVABLE
             accountpayable          = it_account_payable
*           ACCOUNTTAX              = ACCOUNTTAX
             currencyamount          = it_currency_amount
*           CRITERIA                = CRITERIA
*           VALUEFIELD              = VALUEFIELD
*           EXTENSION1              = EXTENSION1
         return                  = it_return
*           PAYMENTCARD             = PAYMENTCARD
*           CONTRACTITEM            = CONTRACTITEM
*           EXTENSION2              = EXTENSION2
*           REALESTATE              = REALESTATE
       .
    if p_tstdt is initial.
      call function 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
*   WAIT          =
* IMPORTING
*   RETURN        =
                .
    endif.
break-point.
    loop at it_return.
    write: /1(2) it_head-identifier,3(1) '|', 4(50) it_return-message.
    endloop.
  refresh:it_account_gl,
          it_account_payable,
          it_currency_amount,
          it_return.
  endloop.

endform.                    " build_bapi
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Prabhudas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2009 18:02:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bapi-quot-bapi-acc-document-post-quot/m-p/5420483#M1244164</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-30T18:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with  bapi "BAPI_ACC_DOCUMENT_POST"</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bapi-quot-bapi-acc-document-post-quot/m-p/5420484#M1244165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the sample code...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check you r entries and correct..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  loop at gt_header.
*    GT_HEADER-BUDAT = sy-datum - 5.
*    GT_HEADER-BLDAT = sy-datum.
    vcounter = 1.
    gt_header-wrbtr = gt_header-wrbtr  * -1.
*FILLING INPORTING PARAMETER STRUCTURE.
    wa_documentheader-comp_code = gt_header-bukrs.
    wa_documentheader-doc_date = gt_header-bldat.
    wa_documentheader-pstng_date = gt_header-budat.
    wa_documentheader-username = sy-uname.
    wa_documentheader-bus_act = 'RFBU'.
    wa_documentheader-doc_type = 'KR'.

    gt_accountpayable-itemno_acc = vcounter.
    gt_accountpayable-vendor_no =  gt_header-accnt.
    append gt_accountpayable.
    clear gt_accountpayable.

    gt_currencyamount-itemno_acc = vcounter.
    gt_currencyamount-currency = 'INR'.
    gt_currencyamount-amt_doccur = gt_header-wrbtr.
    append gt_currencyamount.
    clear gt_currencyamount.
    loop at gt_item where identifier = gt_header-identifier.
      vcounter = vcounter + 1.           .
      gt_accountgl-itemno_acc = vcounter.


      call function 'CONVERSION_EXIT_ALPHA_INPUT'
        exporting
          input  = gt_item-hkont
        importing
          output = gt_item-hkont.
      gt_accountgl-gl_account = gt_item-hkont.


      call function 'CONVERSION_EXIT_ALPHA_INPUT'
        exporting
          input  = gt_item-kostl
        importing
          output = gt_item-kostl.

      gt_accountgl-costcenter = gt_item-kostl.
      gt_accountgl-pstng_date = gt_header-budat.
      append gt_accountgl.
      clear gt_accountgl.
      gt_currencyamount-itemno_acc = vcounter.
      gt_currencyamount-currency = 'INR'.
      gt_currencyamount-amt_doccur = gt_item-wrbtr.
      append gt_currencyamount.
      clear gt_currencyamount.
    endloop.
    call function 'BAPI_ACC_DOCUMENT_POST'
      exporting
        documentheader          = wa_documentheader
*       CUSTOMERCPD             = CUSTOMERCPD
*       CONTRACTHEADER          = CONTRACTHEADER
     importing
*       OBJ_TYPE                = OBJ_TYPE
       obj_key                 =  v_refkey
*       OBJ_SYS                 = OBJ_SYS
      tables
       accountgl               = gt_accountgl
*       ACCOUNTRECEIVABLE       = ACCOUNTRECEIVABLE
       accountpayable          = gt_accountpayable
*       ACCOUNTTAX              = ACCOUNTTAX
        currencyamount          = gt_currencyamount
*       CRITERIA                = CRITERIA
*       VALUEFIELD              = VALUEFIELD
*       EXTENSION1              = EXTENSION1
        return                  = gt_return
*       PAYMENTCARD             = PAYMENTCARD
*       CONTRACTITEM            = CONTRACTITEM
*       EXTENSION2              = EXTENSION2
*       REALESTATE              = REALESTATE
.

    break-point.

    if p_test is initial.
      call function 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
*   WAIT          = WAIT
* IMPORTING
*   RETURN        = RETURN
      .
    endif.         .


  endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Prabhudas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Mar 2009 18:09:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-bapi-quot-bapi-acc-document-post-quot/m-p/5420484#M1244165</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-30T18:09:11Z</dc:date>
    </item>
  </channel>
</rss>

