<?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 Handling Errors While Using BAPI_ACC_GL_POSTING_POST in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-errors-while-using-bapi-acc-gl-posting-post/m-p/4390807#M1044098</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All, &lt;/P&gt;&lt;P&gt;I have to use BAPI_ACC_GL_POSTING_POST for gl account posting. &lt;/P&gt;&lt;P&gt;I have a flat file with multiple Headers and each header will have multiple line items. &lt;/P&gt;&lt;P&gt;1.How to post these type of flat file using Bapi?(i have to pass 998 line items as one set,and 999th set shound be balancing entry). &lt;/P&gt;&lt;P&gt;2.After posting through bapi_acc_gl_posting_post, i have to generate a report showing Detail of line item in which error has occured.(details like lineitem,company code,costcenter,profit center posting key,amt,tax amont and total). &lt;/P&gt;&lt;P&gt;3.And also if bapi fails to popst set of 998 line items,all these have to go to BDC session. &lt;/P&gt;&lt;P&gt;please suggest me something regarding this requirement.(if that would be code related to this requirement it will be more help full). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you all in advance!!!! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 31 Aug 2008 11:55:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-08-31T11:55:14Z</dc:date>
    <item>
      <title>Handling Errors While Using BAPI_ACC_GL_POSTING_POST</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-errors-while-using-bapi-acc-gl-posting-post/m-p/4390807#M1044098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All, &lt;/P&gt;&lt;P&gt;I have to use BAPI_ACC_GL_POSTING_POST for gl account posting. &lt;/P&gt;&lt;P&gt;I have a flat file with multiple Headers and each header will have multiple line items. &lt;/P&gt;&lt;P&gt;1.How to post these type of flat file using Bapi?(i have to pass 998 line items as one set,and 999th set shound be balancing entry). &lt;/P&gt;&lt;P&gt;2.After posting through bapi_acc_gl_posting_post, i have to generate a report showing Detail of line item in which error has occured.(details like lineitem,company code,costcenter,profit center posting key,amt,tax amont and total). &lt;/P&gt;&lt;P&gt;3.And also if bapi fails to popst set of 998 line items,all these have to go to BDC session. &lt;/P&gt;&lt;P&gt;please suggest me something regarding this requirement.(if that would be code related to this requirement it will be more help full). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you all in advance!!!! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 31 Aug 2008 11:55:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-errors-while-using-bapi-acc-gl-posting-post/m-p/4390807#M1044098</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-31T11:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Errors While Using BAPI_ACC_GL_POSTING_POST</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-errors-while-using-bapi-acc-gl-posting-post/m-p/4390808#M1044099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ravikiran,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please follow these steps&lt;/P&gt;&lt;P&gt;First step:  Please build a internal table with fields from you file.&lt;/P&gt;&lt;P&gt;i hope you would have the following fields in the file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: BEGIN OF gt_table,&lt;/P&gt;&lt;P&gt;       blart   TYPE bkpf-blart,            "(Document type)&lt;/P&gt;&lt;P&gt;       message(120)  TYPE c,           "(message)&lt;/P&gt;&lt;P&gt;       bldat   TYPE bkpf-bldat,           "(Document date)&lt;/P&gt;&lt;P&gt;       budat   TYPE bkpf-budat,         "(Posting date)&lt;/P&gt;&lt;P&gt;       waers   TYPE bkpf-waers,        "(Currency)&lt;/P&gt;&lt;P&gt;       xblnr   TYPE bkpf-xblnr,            "(Header Ref)&lt;/P&gt;&lt;P&gt;       bktxt   TYPE bapiache09-header_txt,    "(Header Text)&lt;/P&gt;&lt;P&gt;       newbs   TYPE rf05a-newbs,                  "(Posting Key)&lt;/P&gt;&lt;P&gt;       newbw   TYPE rf05a-newbw,           "(Transaction type)&lt;/P&gt;&lt;P&gt;       newko   TYPE bapiacgl09-gl_account,    "(Account code)&lt;/P&gt;&lt;P&gt;       aufnr   TYPE cobl-aufnr,                          "(Internal order)&lt;/P&gt;&lt;P&gt;       prctr   TYPE bseg-prctr,                          "(Profit center)&lt;/P&gt;&lt;P&gt;       kostl   TYPE cobl-kostl,                          "(Cost center)&lt;/P&gt;&lt;P&gt;       wrbtr   TYPE bseg-wrbtr, "(Amount in Transaction Curr)&lt;/P&gt;&lt;P&gt;       zuonr   TYPE bseg-zuonr,                     "(Assignment)&lt;/P&gt;&lt;P&gt;       sgtxt   TYPE bseg-sgtxt,                      "(Text)&lt;/P&gt;&lt;P&gt;       mwskz   TYPE bseg-mwskz,                "(Tax Code)&lt;/P&gt;&lt;P&gt;       zterm   TYPE bseg-zterm,                    "(payment terms)&lt;/P&gt;&lt;P&gt;       kkber   TYPE bseg-kkber,                 "(Credit control area)&lt;/P&gt;&lt;P&gt;       zfbdt   TYPE bseg-zfbdt,                   "(Baseline Date)&lt;/P&gt;&lt;P&gt;       bukrs   TYPE bkpf-bukrs,                  "(Company Code)&lt;/P&gt;&lt;P&gt;       gjahr   TYPE bseg-gjahr,                   "(Fiscal Year)&lt;/P&gt;&lt;P&gt;end of gt_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second step:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the FM GUI_UPLOAD with the following parameters to upload the data in the flat file into your internal table., &lt;/P&gt;&lt;P&gt;        EXPORTING&lt;/P&gt;&lt;P&gt;          filename                   = lv_filename&lt;/P&gt;&lt;P&gt;          filetype                   = 'ASC'&lt;/P&gt;&lt;P&gt;       has_field_separator           = cl_abap_char_utilities=&amp;gt;horizontal_tab&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        TABLES&lt;/P&gt;&lt;P&gt;          data_tab                     = gt_table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Third step: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are seperate structures in the Bapi, ie, DOCUMENTHEADER, ACCOUNTGL, CURRENCYAMOUNT which needs to be filled from the internal table.&lt;/P&gt;&lt;P&gt;You cannot post all the documents to gether in a single call to the bapi. So you have to loop at the table and at the end of each document you should call the bapi and pass the relevant details to the structures.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will give the mandatory fields that you have to pass to the structures, anythign additional pls add as per you requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;looping at the table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Header structure: DOCUMENTHEADER,&lt;/P&gt;&lt;P&gt;        wa_header-username   = g_uname.&lt;/P&gt;&lt;P&gt;        wa_header-comp_code  = p_bukrs.&lt;/P&gt;&lt;P&gt;        wa_header-doc_date    = wa_table-bldat.&lt;/P&gt;&lt;P&gt;        wa_header-pstng_date = wa_table-budat.&lt;/P&gt;&lt;P&gt;        wa_header-doc_type    = wa_table-blart.&lt;/P&gt;&lt;P&gt;        wa_header-fisc_year    = wa_table-gjahr.&lt;/P&gt;&lt;P&gt;        wa_header-header_txt  = wa_table-bktxt.&lt;/P&gt;&lt;P&gt;G/L account structure : ACCOUNTGL&lt;/P&gt;&lt;P&gt;        wa_accountgl-itemno_acc = '0000000001'.&lt;/P&gt;&lt;P&gt;        wa_accountgl-gl_account = wa_table-newko.&lt;/P&gt;&lt;P&gt;        wa_accountgl-item_text  = wa_table-sgtxt.&lt;/P&gt;&lt;P&gt;        wa_accountgl-doc_type   = wa_table-blart.&lt;/P&gt;&lt;P&gt;        wa_accountgl-comp_code  = wa_table-bukrs.&lt;/P&gt;&lt;P&gt;        wa_accountgl-fisc_year  =  wa_table-gjahr.&lt;/P&gt;&lt;P&gt;        wa_accountgl-pstng_date =  wa_table-budat.&lt;/P&gt;&lt;P&gt;        wa_accountgl-costcenter = wa_table-kostl.&lt;/P&gt;&lt;P&gt;        wa_accountgl-profit_ctr = wa_without_copa-prctr.&lt;/P&gt;&lt;P&gt;        wa_accountgl-orderid    = wa_without_copa-aufnr.&lt;/P&gt;&lt;P&gt;        wa_accountgl-alloc_nmbr = wa_without_copa-zuonr.&lt;/P&gt;&lt;P&gt;        wa_accountgl-tax_code   = wa_without_copa-mwskz.&lt;/P&gt;&lt;P&gt;	append wa_accountgl to gt_accountgl.&lt;/P&gt;&lt;P&gt;Currency structure: CURRENCYAMOUNT&lt;/P&gt;&lt;P&gt;        wa_currency-itemno_acc   =   '0000000001'.&lt;/P&gt;&lt;P&gt;        wa_currency-CURRENCY     = wa_without_copa-waers.&lt;/P&gt;&lt;P&gt;        IF wa_without_copa-newbs IN r_newbs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          wa_currency-amt_doccur  = wa_without_copa-wrbtr * -1.&lt;/P&gt;&lt;P&gt;        ELSE.&lt;/P&gt;&lt;P&gt;          wa_currency-amt_doccur  = wa_without_copa-wrbtr.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;        APPEND wa_currency TO gt_currency.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note : 1) Please note that &lt;/P&gt;&lt;P&gt; wa_header is of type BAPIACHE08&lt;/P&gt;&lt;P&gt; gt_accountgl and wa_accountgl are of type BAPIACGL08, &lt;/P&gt;&lt;P&gt; gt_currency  and wa_currency  are of type BAPIACCR08.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) The itemno_acc, a item number should maintained same for a line item in both accountgl and currency structure. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) PLease append header details only at the start of new document, do not fil it for all line items.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) To pass the posting key we dont have a parameter, so better decide the number posting keys used and in the amount please add the sign according to the posting key , in my case i have created a range for negative posting keys and have put a condition to decide on the sign of the amount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fourth step: At the end of a document, call the bapi, BAPI_ACC_GL_POSTING_POST&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;         documentheader        = wa_header&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  CUSTOMERCPD             =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  CONTRACTHEADER          =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   obj_type               =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      obj_key                 =  g_objkey&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  OBJ_SYS                 =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;         TABLES&lt;/P&gt;&lt;P&gt;      accountgl                =  gt_accountgl&lt;/P&gt;&lt;P&gt;         currencyamount        =  gt_currency&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  VALUEFIELD              =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  extension1               = &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      return                   = gt_return&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  PAYMENTCARD             =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  CONTRACTITEM            =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  EXTENSION2              =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  REALESTATE              =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  ACCOUNTWT               =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;               .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would request you to try to pass the values manually into the Bapi and then do it, so that you will understand better.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gt_return will get you the error or success message for each posting, so you can fetch the error records from that.&lt;/P&gt;&lt;P&gt;To create a BDC session you can use the FMs&lt;/P&gt;&lt;P&gt;BDC_OPEN_GROUP , BDC_insert and BDC_CLOSE_GROUP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Sep 2008 10:47:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-errors-while-using-bapi-acc-gl-posting-post/m-p/4390808#M1044099</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-01T10:47:54Z</dc:date>
    </item>
  </channel>
</rss>

