<?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: passing BAPI inside loop of internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-bapi-inside-loop-of-internal-table/m-p/5446542#M1248738</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;Can you be more specific about your qestion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or looking for this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

wa_header-co_area = 1000.
wa_header-docdate = sy-datum.
wa_header-username = sy-uname.

SORT item BY job.
LOOP AT item INTO wa_item.
  APPEND wa_item TO doc_item.
  AT END OF job.
    CALL FUNCTION 'BAPI_ACC_STAT_KEY_FIG_POST'
      EXPORTING
        doc_header      = wa_header
        ignore_warnings = 'X'
      TABLES
        doc_items       = doc_items
        return          = return.
    REFRESH doc_item.
  ENDAT.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Avinash Kodarapu on Mar 27, 2009 10:36 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Mar 2009 17:00:02 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-03-27T17:00:02Z</dc:date>
    <item>
      <title>passing BAPI inside loop of internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-bapi-inside-loop-of-internal-table/m-p/5446541#M1248737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;My internal table has follwing entries and now I should create 3 documents using BAPI.&lt;/P&gt;&lt;P&gt;How do i do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;job	 Phase	   Quantity
100       9700      60
100       9700      90
**************
200       9500      10
200       9500      20
200       9600      10
200       9600      70
*************
300       9800      30
300       9800      80
300       9900      20
300       9900      50&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_header is always &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;wa_header-co_area = 1000.
      wa_header-docdate = sy-datum.
      wa_header-username = sy-uname.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;doc_items -1 -  

100       9700      60
100       9700      90

doc_items -2-

200       9500      10
200       9500      20
200       9600      10
200       9600      70

....


 CALL FUNCTION 'BAPI_ACC_STAT_KEY_FIG_POST'
        EXPORTING
          doc_header            = wa_header
         ignore_warnings       = 'X'
        TABLES
          doc_items             = doc_items
          return                = return&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Mar 2009 16:53:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/passing-bapi-inside-loop-of-internal-table/m-p/5446541#M1248737</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-27T16:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: passing BAPI inside loop of internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-bapi-inside-loop-of-internal-table/m-p/5446542#M1248738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;Can you be more specific about your qestion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or looking for this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

wa_header-co_area = 1000.
wa_header-docdate = sy-datum.
wa_header-username = sy-uname.

SORT item BY job.
LOOP AT item INTO wa_item.
  APPEND wa_item TO doc_item.
  AT END OF job.
    CALL FUNCTION 'BAPI_ACC_STAT_KEY_FIG_POST'
      EXPORTING
        doc_header      = wa_header
        ignore_warnings = 'X'
      TABLES
        doc_items       = doc_items
        return          = return.
    REFRESH doc_item.
  ENDAT.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Avinash Kodarapu on Mar 27, 2009 10:36 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Mar 2009 17:00:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/passing-bapi-inside-loop-of-internal-table/m-p/5446542#M1248738</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-27T17:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: passing BAPI inside loop of internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-bapi-inside-loop-of-internal-table/m-p/5446543#M1248739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
Loop 

At end of 'Job'

Call Function 'BAPI........'

Endloop
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this way you can create a FI doc when job will change &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kuntal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Mar 2009 17:00:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/passing-bapi-inside-loop-of-internal-table/m-p/5446543#M1248739</guid>
      <dc:creator>former_member376453</dc:creator>
      <dc:date>2009-03-27T17:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: passing BAPI inside loop of internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-bapi-inside-loop-of-internal-table/m-p/5446544#M1248740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your internal table is job - phase - quantity&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can do this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_header-co_area = 1000.&lt;/P&gt;&lt;P&gt;wa_header-docdate = sy-datum.&lt;/P&gt;&lt;P&gt;wa_header-username = sy-uname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at internal table into work_area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at new job.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;fill fields on DOC_ITEMS structures using phase and quantity.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at end of job.&lt;/P&gt;&lt;P&gt; CALL FUNCTION 'BAPI_ACC_STAT_KEY_FIG_POST'&lt;/P&gt;&lt;P&gt;        EXPORTING&lt;/P&gt;&lt;P&gt;          doc_header            = wa_header&lt;/P&gt;&lt;P&gt;         ignore_warnings       = 'X'&lt;/P&gt;&lt;P&gt;        TABLES&lt;/P&gt;&lt;P&gt;          doc_items             = doc_items&lt;/P&gt;&lt;P&gt;          return                = return&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Mar 2009 17:04:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/passing-bapi-inside-loop-of-internal-table/m-p/5446544#M1248740</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-27T17:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: passing BAPI inside loop of internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-bapi-inside-loop-of-internal-table/m-p/5446545#M1248741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Avinash,&lt;/P&gt;&lt;P&gt;Now that I have Internal table in my requried format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create a document for each Job using BAPI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are 3 jobs i.e 100,200,300 &amp;amp; Items should be their respective records &lt;/P&gt;&lt;P&gt;like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;doc_items -1 -  
 
100       9700      60
100       9700      90&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;et..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds&lt;/P&gt;&lt;P&gt;Praveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Mar 2009 17:10:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/passing-bapi-inside-loop-of-internal-table/m-p/5446545#M1248741</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-27T17:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: passing BAPI inside loop of internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-bapi-inside-loop-of-internal-table/m-p/5446546#M1248742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Just try this code once... and then tell if its working or not&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;wa_header-co_area = 1000.
wa_header-docdate = sy-datum.
wa_header-username = sy-uname.

loop at internal table into work_area.

append work_area to doc_items.  "  if the structure is different then move work_area to doc_items structure 
" and then append it.....  no at events required here

at end of job.
CALL FUNCTION 'BAPI_ACC_STAT_KEY_FIG_POST'
EXPORTING
doc_header = wa_header
ignore_warnings = 'X'
TABLES
doc_items = doc_items
return = return.

clear doc_items.   "  Clearing doc_items is very important.
endat.

endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Siddarth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Mar 2009 17:11:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/passing-bapi-inside-loop-of-internal-table/m-p/5446546#M1248742</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-27T17:11:46Z</dc:date>
    </item>
  </channel>
</rss>

