<?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: Purshase req- BAPI in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/purshase-req-bapi/m-p/12169715#M1978900</link>
    <description>&lt;P&gt;Thanks. I'm glad it worked out.&lt;/P&gt;Kind regards,&lt;BR /&gt;Mateusz</description>
    <pubDate>Wed, 03 Jun 2020 06:09:00 GMT</pubDate>
    <dc:creator>MateuszAdamus</dc:creator>
    <dc:date>2020-06-03T06:09:00Z</dc:date>
    <item>
      <title>Purshase req- BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/purshase-req-bapi/m-p/12169708#M1978893</link>
      <description>&lt;P&gt;&lt;A href="https://answers.sap.com/storage/temp/1810962-pr.txt"&gt;pr.txt&lt;/A&gt;Hi Guys, &lt;/P&gt;
  &lt;P&gt;I am new to BAPI , I have created an PR using 'BAPI_PR_CREATE', but i got an runtime error ."&lt;STRONG&gt;&lt;U&gt; In FM you can spectific only fields of spectific length and under PR header&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;Please help me on this issue.. &lt;/P&gt;
  &lt;P&gt;I have pasted my piece of code here:-&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2020 11:30:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/purshase-req-bapi/m-p/12169708#M1978893</guid>
      <dc:creator>divsmart</dc:creator>
      <dc:date>2020-06-02T11:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Purshase req- BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/purshase-req-bapi/m-p/12169709#M1978894</link>
      <description>&lt;P&gt;Putting you code as a commend so it's clearly visible:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TABLES: eban.

DATA: wa_header TYPE bapimereqheader-preq_no VALUE '0010000004',
      wa_headerx TYPE bapimereqheaderx-preq_no VALUE 'X',
*      wa_doc    TYPE bapimereqheader-pr_type VALUE 'NS',

      it_item TYPE TABLE OF bapimereqitemimp,
      wa_item TYPE          bapimereqitemimp,

      it_itemx TYPE TABLE OF bapimereqitemx,
      wa_itemx TYPE          bapimereqitemx,

      it_return TYPE TABLE OF bapiret2,
      wa_return TYPE          bapiret2.

**Assign the value for item's...

wa_item-preq_item = '10'.
wa_item-pur_group = 'WIN'.
wa_item-material = 'E001789'.
wa_item-plant = '1000'.
wa_item-store_loc = '9000'.

wa_item-preq_item = 'X'.
wa_item-pur_group = 'X'.
wa_item-material = 'X'.
wa_item-plant = 'X'.
wa_item-store_loc = 'X'.

BREAK-POINT.

CALL FUNCTION 'BAPI_PR_CREATE'
 EXPORTING
   prheader                    = wa_header
   prheaderx                   = wa_headerx
*   TESTRUN                     =
* IMPORTING
*   NUMBER                      =
*   prheaderexp                 = wa_doc
  TABLES
   return                      = it_return
    pritem                      = it_item
   pritemx                     = it_itemx.
*   PRITEMEXP                   =
*   PRITEMSOURCE                =
*   PRACCOUNT                   =
*   PRACCOUNTPROITSEGMENT       =
*   PRACCOUNTX                  =
*   PRADDRDELIVERY              =
*   PRITEMTEXT                  =
*   PRHEADERTEXT                =
*   EXTENSIONIN                 =
*   EXTENSIONOUT                =
*   PRVERSION                   =
*   PRVERSIONX                  =
*   ALLVERSIONS                 =


WRITE: / 'TYPE : ' ,wa_return-type,
         /'Id :' , wa_return-id,
         /'Message : ' , wa_return-message.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
*   WAIT          =
 IMPORTING
   return        = wa_return.
&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jun 2020 11:37:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/purshase-req-bapi/m-p/12169709#M1978894</guid>
      <dc:creator>Dominik_Tylczynski</dc:creator>
      <dc:date>2020-06-02T11:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: Purshase req- BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/purshase-req-bapi/m-p/12169710#M1978895</link>
      <description>&lt;P&gt;Hello &lt;SPAN class="mention-scrubbed"&gt;divsmart&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The obvious error here is that you don't fill up it_item or it_itemx internal tables and pass them empty to BAPI_PR_CREATE. You just maintain work area of the table i.e. wa_item structure.&lt;/P&gt;&lt;P&gt;Moreover you are using wa_item instead of wa_itemx in:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;wa_item-preq_item = 'X'.
wa_item-pur_group = 'X'.
wa_item-material = 'X'.
wa_item-plant = 'X'.
wa_item-store_loc = 'X'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Dominik Tylczynski&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2020 11:40:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/purshase-req-bapi/m-p/12169710#M1978895</guid>
      <dc:creator>Dominik_Tylczynski</dc:creator>
      <dc:date>2020-06-02T11:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: Purshase req- BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/purshase-req-bapi/m-p/12169711#M1978896</link>
      <description>&lt;P&gt;Hello  &lt;SPAN class="mention-scrubbed"&gt;divsmart&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;Here are my comments to your code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: wa_header TYPE bapimereqheader-preq_no VALUE '0010000004',
      wa_headerx TYPE bapimereqheaderx-preq_no VALUE 'X',&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The WA_HEADER and WA_HEADERX should be defined as structures. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: wa_header TYPE bapimereqheader,
      wa_headerx TYPE bapimereqheaderx.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In these structures, you should provide any required and important information that is relevant for the whole PR document creation. You should not provide the PR document number, in most cases (unless the number range for this document type is defined as external). The document's number will be generates automatically by the system.&lt;/P&gt;&lt;P&gt;You have defined the item structures correctly. Also, the internal tables for items are fine.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;      it_item TYPE TABLE OF bapimereqitemimp,
      wa_item TYPE          bapimereqitemimp,

      it_itemx TYPE TABLE OF bapimereqitemx,
      wa_itemx TYPE          bapimereqitemx,


**Assign the value for item's...
wa_item-preq_item = '10'.
wa_item-pur_group = 'WIN'.
wa_item-material = 'E001789'.
wa_item-plant = '1000'.
wa_item-store_loc = '9000'.

wa_item-preq_item = 'X'.
wa_item-pur_group = 'X'.
wa_item-material = 'X'.
wa_item-plant = 'X'.
wa_item-store_loc = 'X'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, you're not adding the item structures to item tables after the structures are filled. &lt;/P&gt;&lt;P&gt;You need to use the APPEND or INSERT statements. For example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;APPEND wa_item TO it_item.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Additionally, you're assigning the information about the modified fields the the incorrect structure. You're using the WA_ITEM structure, when you should be using the WA_ITEMX structure instead.&lt;/P&gt;&lt;P&gt;The PREQ_ITEM field of the WA_ITEMX structure should have the item number for which this structure holds the information.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;wa_itemx-preq_item = '10'.
wa_itemx-pur_group = 'X'.
wa_itemx-material = 'X'.
wa_itemx-plant = 'X'.
wa_itemx-store_loc = 'X'.
APPEND wa_itemx TO it_itemx.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If you want to get the number of the created document, you need to uncomment the NUMBER parameter of the function. If you want to get more details about the header of the document - then the PRHEADEREXP parameter.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'BAPI_PR_CREATE'
 EXPORTING
   prheader                    = wa_header
   prheaderx                   = wa_headerx
*   TESTRUN                     =
  IMPORTING
    NUMBER                      = lv_number
    prheaderexp                 = wa_doc
  TABLES
   return                      = it_return
    pritem                      = it_item
   pritemx                     = it_itemx.
*   PRITEMEXP                   =
*   PRITEMSOURCE                =
*   PRACCOUNT                   =
*   PRACCOUNTPROITSEGMENT       =
*   PRACCOUNTX                  =
*   PRADDRDELIVERY              =
*   PRITEMTEXT                  =
*   PRHEADERTEXT                =
*   EXTENSIONIN                 =
*   EXTENSIONOUT                =
*   PRVERSION                   =
*   PRVERSIONX                  =
*   ALLVERSIONS                 =&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;NUMBER is of type BANFN and PRHEADEREXP is a structure of type BAPIMEREQHEADER.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
  lv_number TYPE banfn,
  wa_doc TYPE bapimereqheader.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here is another example of how to use the BAPI: &lt;A href="https://answers.sap.com/answers/7128805/view.html" target="test_blank"&gt;https://answers.sap.com/answers/7128805/view.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;Mateusz</description>
      <pubDate>Tue, 02 Jun 2020 11:48:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/purshase-req-bapi/m-p/12169711#M1978896</guid>
      <dc:creator>MateuszAdamus</dc:creator>
      <dc:date>2020-06-02T11:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Purshase req- BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/purshase-req-bapi/m-p/12169712#M1978897</link>
      <description>&lt;P&gt;Dominik Tylczynski.  Thanks for response... &lt;/P&gt;&lt;P&gt;I have changed the 'wa_itemx' as below. &lt;/P&gt;&lt;P&gt;wa_itemx-preq_item = 'X'.wa_itemx-pur_group = 'X'.
wa_itemx-material = 'X'.
wa_itemx-plant = 'X'.
wa_itemx-store_loc = 'X'. but 'My Error is in PR Header' as mentioned above '&lt;STRONG&gt;&lt;U&gt;In FM you can spectific only fields of spectific length and under PR header... &lt;/U&gt;&lt;/STRONG&gt;' Please help... &lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2020 11:56:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/purshase-req-bapi/m-p/12169712#M1978897</guid>
      <dc:creator>divsmart</dc:creator>
      <dc:date>2020-06-02T11:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: Purshase req- BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/purshase-req-bapi/m-p/12169713#M1978898</link>
      <description>&lt;P&gt;Hello  &lt;SPAN class="mention-scrubbed"&gt;divsmart&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;Please use the "Comment" option to ask or add additional information to the question/answer.&lt;/P&gt;Kind regards,&lt;BR /&gt;Mateusz</description>
      <pubDate>Tue, 02 Jun 2020 13:10:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/purshase-req-bapi/m-p/12169713#M1978898</guid>
      <dc:creator>MateuszAdamus</dc:creator>
      <dc:date>2020-06-02T13:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: Purshase req- BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/purshase-req-bapi/m-p/12169714#M1978899</link>
      <description>&lt;P&gt;Hi Mateusz, &lt;/P&gt;&lt;P&gt;Thanks for your swift response , Now my BAPI working fine &amp;amp; all data's are upload as per my requirment.. &lt;/P&gt;&lt;P&gt;Your are great!!! Rewards point as 10... &lt;/P&gt;&lt;P&gt;Regards, &lt;/P&gt;&lt;P&gt;Senthil.G&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 04:57:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/purshase-req-bapi/m-p/12169714#M1978899</guid>
      <dc:creator>divsmart</dc:creator>
      <dc:date>2020-06-03T04:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Purshase req- BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/purshase-req-bapi/m-p/12169715#M1978900</link>
      <description>&lt;P&gt;Thanks. I'm glad it worked out.&lt;/P&gt;Kind regards,&lt;BR /&gt;Mateusz</description>
      <pubDate>Wed, 03 Jun 2020 06:09:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/purshase-req-bapi/m-p/12169715#M1978900</guid>
      <dc:creator>MateuszAdamus</dc:creator>
      <dc:date>2020-06-03T06:09:00Z</dc:date>
    </item>
  </channel>
</rss>

