<?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 'BAPI_ACC_DOCUMENT_POST' in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-acc-document-post/m-p/2914002#M685879</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working on an interface where I need to post an accounting document using &lt;/P&gt;&lt;P&gt;f-43 and for this I have identified this bapi 'BAPI_ACC_DOCUMENT_POST', and I have written the following code. everything is working properly but the only problem is, the posting keys I am using are 31 and 40 but when I run my program and look into the document created, it shows me the posting keys as 40 and 50 instead of 31 and 40, can you please tell me how to get rid of this thing .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  v_semfile = p_ifname.&lt;/P&gt;&lt;P&gt;  refresh it_input_file.&lt;/P&gt;&lt;P&gt;  call function 'WS_UPLOAD'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      filename                = v_semfile&lt;/P&gt;&lt;P&gt;      filetype                = 'DAT'&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      data_tab                = it_input&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      conversion_error        = 1&lt;/P&gt;&lt;P&gt;      file_open_error         = 2&lt;/P&gt;&lt;P&gt;      file_read_error         = 3&lt;/P&gt;&lt;P&gt;      invalid_type            = 4&lt;/P&gt;&lt;P&gt;      no_batch                = 5&lt;/P&gt;&lt;P&gt;      unknown_error           = 6&lt;/P&gt;&lt;P&gt;      invalid_table_width     = 7&lt;/P&gt;&lt;P&gt;      gui_refuse_filetransfer = 8&lt;/P&gt;&lt;P&gt;      customer_error          = 9&lt;/P&gt;&lt;P&gt;      others                  = 10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  move:&lt;/P&gt;&lt;P&gt;    'RFBU'                  to documentheader-bus_act,&lt;/P&gt;&lt;P&gt;    it_input-doc_date2 to documentheader-doc_date,&lt;/P&gt;&lt;P&gt;    it_input-pos_date2 to documentheader-pstng_date,&lt;/P&gt;&lt;P&gt;    it_inputdoc_type  to documentheader-doc_type,&lt;/P&gt;&lt;P&gt;    it_inputbukrs     to documentheader-comp_code,&lt;/P&gt;&lt;P&gt;    it_input-pos_per   to documentheader-fis_period,&lt;/P&gt;&lt;P&gt;    it_input-fis_year  to documentheader-fisc_year,&lt;/P&gt;&lt;P&gt;    it_input-reference to documentheader-ref_doc_no,&lt;/P&gt;&lt;P&gt;    it_input-h_text    to documentheader-header_txt,&lt;/P&gt;&lt;P&gt;    syst-uname              to documentheader-username.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if it_input_file-pos_key eq 31.&lt;/P&gt;&lt;P&gt;    move:&lt;/P&gt;&lt;P&gt;      v_count                 to glaccount-ITEMNO_ACC,&lt;/P&gt;&lt;P&gt;      it_input-glaccount to glaccount-gl_account,&lt;/P&gt;&lt;P&gt;      it_input-kostl     to glaccount-COSTCENTER,&lt;/P&gt;&lt;P&gt;      it_input-prctr     to glaccount-PROFIT_CTR,&lt;/P&gt;&lt;P&gt;      it_input-bus_area  to glaccount-bus_area,&lt;/P&gt;&lt;P&gt;      it_input-item_text to glaccount-ITEM_TEXT,&lt;/P&gt;&lt;P&gt;      it_input-assignment to glaccount-ALLOC_NMBR.&lt;/P&gt;&lt;P&gt;    append glaccount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    move:&lt;/P&gt;&lt;P&gt;      v_count                 to currencyamount-ITEMNO_ACC,&lt;/P&gt;&lt;P&gt;      it_input-currency  to currencyamount-CURRENCY,&lt;/P&gt;&lt;P&gt;      it_input-amount    to currencyamount-AMT_DOCCUR .&lt;/P&gt;&lt;P&gt;    append currencyamount.&lt;/P&gt;&lt;P&gt;    clear: glaccount, currencyamount.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;     move: v_count                to glaccount-ITEMNO_ACC,&lt;/P&gt;&lt;P&gt;          it_input-glaccount to glaccount-gl_account,&lt;/P&gt;&lt;P&gt;          it_input-kostl     to glaccount-COSTCENTER,&lt;/P&gt;&lt;P&gt;          it_input-prctr     to glaccount-PROFIT_CTR,&lt;/P&gt;&lt;P&gt;          it_input-bus_area  to glaccount-bus_area,&lt;/P&gt;&lt;P&gt;          it_input-item_text to glaccount-ITEM_TEXT,&lt;/P&gt;&lt;P&gt;          it_input-assignment to glaccount-ALLOC_NMBR.&lt;/P&gt;&lt;P&gt;    append glaccount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    move:&lt;/P&gt;&lt;P&gt;      v_count                 to currencyamount-ITEMNO_ACC,&lt;/P&gt;&lt;P&gt;      it_input-currency  to currencyamount-CURRENCY.&lt;/P&gt;&lt;P&gt;    currencyamount-AMT_DOCCUR = it_input-amount * -1.&lt;/P&gt;&lt;P&gt;    append currencyamount.&lt;/P&gt;&lt;P&gt;    clear: glaccount, currencyamount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      DOCUMENTHEADER = documentheader&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      OBJ_TYPE       = obj_type&lt;/P&gt;&lt;P&gt;      OBJ_KEY        = obj_key&lt;/P&gt;&lt;P&gt;      OBJ_SYS        = obj_sys&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      ACCOUNTGL      = glaccount&lt;/P&gt;&lt;P&gt;      ACCOUNTPAYABLE = ap&lt;/P&gt;&lt;P&gt;      CURRENCYAMOUNT = currencyamount&lt;/P&gt;&lt;P&gt;      RETURN         = return.&lt;/P&gt;&lt;P&gt;  read table return with key type = 'S'.&lt;/P&gt;&lt;P&gt;  if syst-subrc eq 0.&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    WAIT          =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;     IMPORTING&lt;/P&gt;&lt;P&gt;       RETURN        = return2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*****************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will really appreciate your help &amp;lt;b&amp;gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&amp;lt;/b&amp;gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Rajeev&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Alvaro Tejada Galindo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Oct 2007 19:56:42 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-10-15T19:56:42Z</dc:date>
    <item>
      <title>'BAPI_ACC_DOCUMENT_POST'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-acc-document-post/m-p/2914002#M685879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working on an interface where I need to post an accounting document using &lt;/P&gt;&lt;P&gt;f-43 and for this I have identified this bapi 'BAPI_ACC_DOCUMENT_POST', and I have written the following code. everything is working properly but the only problem is, the posting keys I am using are 31 and 40 but when I run my program and look into the document created, it shows me the posting keys as 40 and 50 instead of 31 and 40, can you please tell me how to get rid of this thing .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  v_semfile = p_ifname.&lt;/P&gt;&lt;P&gt;  refresh it_input_file.&lt;/P&gt;&lt;P&gt;  call function 'WS_UPLOAD'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      filename                = v_semfile&lt;/P&gt;&lt;P&gt;      filetype                = 'DAT'&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      data_tab                = it_input&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      conversion_error        = 1&lt;/P&gt;&lt;P&gt;      file_open_error         = 2&lt;/P&gt;&lt;P&gt;      file_read_error         = 3&lt;/P&gt;&lt;P&gt;      invalid_type            = 4&lt;/P&gt;&lt;P&gt;      no_batch                = 5&lt;/P&gt;&lt;P&gt;      unknown_error           = 6&lt;/P&gt;&lt;P&gt;      invalid_table_width     = 7&lt;/P&gt;&lt;P&gt;      gui_refuse_filetransfer = 8&lt;/P&gt;&lt;P&gt;      customer_error          = 9&lt;/P&gt;&lt;P&gt;      others                  = 10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  move:&lt;/P&gt;&lt;P&gt;    'RFBU'                  to documentheader-bus_act,&lt;/P&gt;&lt;P&gt;    it_input-doc_date2 to documentheader-doc_date,&lt;/P&gt;&lt;P&gt;    it_input-pos_date2 to documentheader-pstng_date,&lt;/P&gt;&lt;P&gt;    it_inputdoc_type  to documentheader-doc_type,&lt;/P&gt;&lt;P&gt;    it_inputbukrs     to documentheader-comp_code,&lt;/P&gt;&lt;P&gt;    it_input-pos_per   to documentheader-fis_period,&lt;/P&gt;&lt;P&gt;    it_input-fis_year  to documentheader-fisc_year,&lt;/P&gt;&lt;P&gt;    it_input-reference to documentheader-ref_doc_no,&lt;/P&gt;&lt;P&gt;    it_input-h_text    to documentheader-header_txt,&lt;/P&gt;&lt;P&gt;    syst-uname              to documentheader-username.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if it_input_file-pos_key eq 31.&lt;/P&gt;&lt;P&gt;    move:&lt;/P&gt;&lt;P&gt;      v_count                 to glaccount-ITEMNO_ACC,&lt;/P&gt;&lt;P&gt;      it_input-glaccount to glaccount-gl_account,&lt;/P&gt;&lt;P&gt;      it_input-kostl     to glaccount-COSTCENTER,&lt;/P&gt;&lt;P&gt;      it_input-prctr     to glaccount-PROFIT_CTR,&lt;/P&gt;&lt;P&gt;      it_input-bus_area  to glaccount-bus_area,&lt;/P&gt;&lt;P&gt;      it_input-item_text to glaccount-ITEM_TEXT,&lt;/P&gt;&lt;P&gt;      it_input-assignment to glaccount-ALLOC_NMBR.&lt;/P&gt;&lt;P&gt;    append glaccount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    move:&lt;/P&gt;&lt;P&gt;      v_count                 to currencyamount-ITEMNO_ACC,&lt;/P&gt;&lt;P&gt;      it_input-currency  to currencyamount-CURRENCY,&lt;/P&gt;&lt;P&gt;      it_input-amount    to currencyamount-AMT_DOCCUR .&lt;/P&gt;&lt;P&gt;    append currencyamount.&lt;/P&gt;&lt;P&gt;    clear: glaccount, currencyamount.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;     move: v_count                to glaccount-ITEMNO_ACC,&lt;/P&gt;&lt;P&gt;          it_input-glaccount to glaccount-gl_account,&lt;/P&gt;&lt;P&gt;          it_input-kostl     to glaccount-COSTCENTER,&lt;/P&gt;&lt;P&gt;          it_input-prctr     to glaccount-PROFIT_CTR,&lt;/P&gt;&lt;P&gt;          it_input-bus_area  to glaccount-bus_area,&lt;/P&gt;&lt;P&gt;          it_input-item_text to glaccount-ITEM_TEXT,&lt;/P&gt;&lt;P&gt;          it_input-assignment to glaccount-ALLOC_NMBR.&lt;/P&gt;&lt;P&gt;    append glaccount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    move:&lt;/P&gt;&lt;P&gt;      v_count                 to currencyamount-ITEMNO_ACC,&lt;/P&gt;&lt;P&gt;      it_input-currency  to currencyamount-CURRENCY.&lt;/P&gt;&lt;P&gt;    currencyamount-AMT_DOCCUR = it_input-amount * -1.&lt;/P&gt;&lt;P&gt;    append currencyamount.&lt;/P&gt;&lt;P&gt;    clear: glaccount, currencyamount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      DOCUMENTHEADER = documentheader&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      OBJ_TYPE       = obj_type&lt;/P&gt;&lt;P&gt;      OBJ_KEY        = obj_key&lt;/P&gt;&lt;P&gt;      OBJ_SYS        = obj_sys&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      ACCOUNTGL      = glaccount&lt;/P&gt;&lt;P&gt;      ACCOUNTPAYABLE = ap&lt;/P&gt;&lt;P&gt;      CURRENCYAMOUNT = currencyamount&lt;/P&gt;&lt;P&gt;      RETURN         = return.&lt;/P&gt;&lt;P&gt;  read table return with key type = 'S'.&lt;/P&gt;&lt;P&gt;  if syst-subrc eq 0.&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    WAIT          =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;     IMPORTING&lt;/P&gt;&lt;P&gt;       RETURN        = return2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*****************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will really appreciate your help &amp;lt;b&amp;gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&amp;lt;/b&amp;gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Rajeev&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Alvaro Tejada Galindo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Oct 2007 19:56:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-acc-document-post/m-p/2914002#M685879</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-15T19:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: 'BAPI_ACC_DOCUMENT_POST'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-acc-document-post/m-p/2914003#M685880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I didn't get any reply&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2007 15:48:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-acc-document-post/m-p/2914003#M685880</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-22T15:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: 'BAPI_ACC_DOCUMENT_POST'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-acc-document-post/m-p/2914004#M685881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;When u you use the bapi 'BAPI_ACC_DOCUMENT_POST',&lt;/P&gt;&lt;P&gt;it does 2 things : 1.it credits one account and (say cost of goods sale)&lt;/P&gt;&lt;P&gt;                         2.debits the other account((say dealer /customer account).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now the posting key for debit is 40 and posting key for credit is 50 and that is what you aare getting in the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;also you need to multiply the currency with '-1'  when you credit a account.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Challa.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2007 15:57:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-acc-document-post/m-p/2914004#M685881</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-22T15:57:13Z</dc:date>
    </item>
  </channel>
</rss>

