<?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: can we create purchase order through report programming? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-we-create-purchase-order-through-report-programming/m-p/5521962#M1262045</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;Use this code in a program by using a BAPI function module&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anothe rway is using classical/ALV report using call transaction from a report for changing the PO &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 loop at i_header.

    header-ref_1         = i_header-legacy.
    headerx-ref_1        = c_x.

    header-doc_type      = i_header-bsart.
    headerx-doc_type     = c_x.

    header-comp_code     = i_header-bukrs.
    headerx-comp_code    = c_x.

    header-purch_org     = i_header-ekorg.
    headerx-purch_org    = c_x.

    header-pur_group     = i_header-ekgrp.
    headerx-pur_group    = c_x.

    header-vendor        = i_header-lifnr.
    headerx-vendor       = c_x.

    concatenate i_header-bedat+4(4)
                i_header-bedat+0(2)
                i_header-bedat+2(2)
                into header-doc_date.

    headerx-doc_date     = c_x.

    header-created_by    = i_header-ernam.
    headerx-created_by   = c_x.


    header-currency      = i_header-waers.
    headerx-currency     = c_x.

    concatenate i_header-kdatb+4(4)
                i_header-kdatb+0(2)
                i_header-kdatb+2(2)
                into header-vper_start.

    headerx-vper_start   = c_x.



    loop at i_items where legacy = i_header-legacy.


      item-po_item            =  i_items-ebelp.
      itemx-po_item           =  i_items-ebelp.
      itemx-po_itemx          =  c_x.

      if i_header-bsart = 'NB'.
        item-material            =  i_items-ematn.
        itemx-material           =  c_x.

        schedule-quantity        =  i_items-menge * 1000.
        schedulex-quantity       =  c_x.
      else.

        item-short_text          = i_items-ematn.
        itemx-short_text         = c_x.
*
        item-matl_group          = '1000'.
        itemx-matl_group         = c_x.

        schedule-quantity        =  '1'.
        schedulex-quantity       =  c_x.

      endif.

      item-plant               =  i_items-werks.
      itemx-plant              =  c_x.

      schedule-po_item         = i_items-ebelp.
      schedule-sched_line      = '1'.

      schedulex-po_item        = i_items-ebelp.
      schedulex-sched_line     = '1'.

      schedulex-po_itemx       = c_x.
      schedulex-sched_linex    = c_x.


      concatenate  i_items-eildt+0(2)
                   '/'
                   i_items-eildt+2(2)
                   '/'
                   i_items-eildt+4(4)
                   into schedule-delivery_date.


      schedulex-delivery_date  =  c_x.




      item-price_unit          =  i_items-peinh * 100.
      itemx-price_unit         =  c_x.


      item-tax_code            =  i_items-mwskz.
      itemx-tax_code           =  c_x.

      item-shipping            =  i_items-evers.
      itemx-shipping           =  c_x.


      account-po_item          = i_items-ebelp.
      accountx-po_item         = i_items-ebelp.
      accountx-po_itemx        = c_x.

      if i_header-bsart = 'FO'.

        item-pckg_no  = sy-tabix.
        itemx-pckg_no = 'X'.

        limits-pckg_no        = sy-tabix.
        limits-limit          = i_items-overalllimit.
        limits-exp_value      = i_items-expectedoverall.

        posrvaccessvalues-pckg_no    = sy-tabix.
        posrvaccessvalues-line_no    = '0'.
        posrvaccessvalues-serno_line = '00'.
        posrvaccessvalues-percentage = '100.0'.
        posrvaccessvalues-serial_no  = '01'.

        account-serial_no     = '1'.
        accountx-serial_no    = '1'.
        accountx-serial_nox   = c_x.

        account-quantity  = '1'.
        accountx-quantity = c_x.

        call function 'CONVERSION_EXIT_ALPHA_INPUT'
          exporting
            input  = i_items-kostl
          importing
            output = account-costcenter.

        accountx-costcenter   = c_x.

        call function 'CONVERSION_EXIT_ALPHA_INPUT'
          exporting
            input  = i_items-sakto
          importing
            output = account-gl_account.

        accountx-gl_account   = c_x.

        item-acctasscat       = i_items-knttp.
        itemx-acctasscat      = c_x.

        item-item_cat         = i_items-epstp.
        itemx-item_cat        = c_x.

      endif.

      append:item,itemx,schedule,schedulex,account,accountx,limits,posrvaccessvalues.
      clear :item,itemx,schedule,schedulex,account,accountx,limits,posrvaccessvalues.

    endloop.

    call function 'BAPI_PO_CREATE1'
      exporting
        poheader                     = header
        poheaderx                    = headerx
*   POADDRVENDOR                 =
*   TESTRUN                      =
*   MEMORY_UNCOMPLETE            =
*   MEMORY_COMPLETE              =
*   POEXPIMPHEADER               =
*   POEXPIMPHEADERX              =
*   VERSIONS                     =
*   NO_MESSAGING                 =
*   NO_MESSAGE_REQ               =
*   NO_AUTHORITY                 =
*   NO_PRICE_FROM_PO             =
        importing
        exppurchaseorder             = ponumber
*   EXPHEADER                    =
*   EXPPOEXPIMPHEADER            =
        tables
        return                       = return
        poitem                       = item
        poitemx                      = itemx
*   POADDRDELIVERY               =
        poschedule                   = schedule
        poschedulex                  = schedulex
        poaccount                    = account
*   POACCOUNTPROFITSEGMENT       =
        poaccountx                   = accountx
*   POCONDHEADER                 =
*   POCONDHEADERX                =
*   POCOND                       =
*   POCONDX                      =
        polimits                     = limits
*   POCONTRACTLIMITS             =
*   POSERVICES                   =
   posrvaccessvalues            = posrvaccessvalues.
*   POSERVICESTEXT               =
*   EXTENSIONIN                  =
*   EXTENSIONOUT                 =
*   POEXPIMPITEM                 =
*   POEXPIMPITEMX                =
*   POTEXTHEADER                 =
*   POTEXTITEM                   =
*   ALLVERSIONS                  =
*   POPARTNER                    =


    if ponumber eq space.

      loop at return where type = 'E'.
        clear buffer.
        move-corresponding return to e_return.
        concatenate i_header-legacy e_return into buffer.

        transfer buffer to p2_file.

      endloop.

      move-corresponding i_header to i_eheader.
      transfer i_eheader to p3_file.

      loop at i_items where legacy = i_header-legacy.
        move-corresponding i_items to i_eitems.
        transfer i_eitems to p4_file.

      endloop.

    else.



      commit work and wait.

    endif.

    clear:ponumber,header,headerx,item,itemx,account,accountx,limits,return,schedule,schedulex,posrvaccessvalues.
    refresh:item,itemx,account,accountx,limits,return,schedule,schedulex,posrvaccessvalues.

  endloop.
  close dataset p2_file.
  close dataset p3_file.
  close dataset p4_file.



&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Krishna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Apr 2009 12:18:58 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-04-22T12:18:58Z</dc:date>
    <item>
      <title>can we create purchase order through report programming?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-we-create-purchase-order-through-report-programming/m-p/5521960#M1262043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi experts.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can we create purchase order through report programming?If yes plz give me the thread details?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Apr 2009 12:07:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-we-create-purchase-order-through-report-programming/m-p/5521960#M1262043</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-22T12:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: can we create purchase order through report programming?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-we-create-purchase-order-through-report-programming/m-p/5521961#M1262044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;SEARCH&lt;/STRONG&gt; in SCN for bapi &lt;STRONG&gt;BAPI_PO_CREATE1&lt;/STRONG&gt;, you will get lot of posts.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Apr 2009 12:15:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-we-create-purchase-order-through-report-programming/m-p/5521961#M1262044</guid>
      <dc:creator>GauthamV</dc:creator>
      <dc:date>2009-04-22T12:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: can we create purchase order through report programming?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-we-create-purchase-order-through-report-programming/m-p/5521962#M1262045</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;Use this code in a program by using a BAPI function module&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anothe rway is using classical/ALV report using call transaction from a report for changing the PO &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 loop at i_header.

    header-ref_1         = i_header-legacy.
    headerx-ref_1        = c_x.

    header-doc_type      = i_header-bsart.
    headerx-doc_type     = c_x.

    header-comp_code     = i_header-bukrs.
    headerx-comp_code    = c_x.

    header-purch_org     = i_header-ekorg.
    headerx-purch_org    = c_x.

    header-pur_group     = i_header-ekgrp.
    headerx-pur_group    = c_x.

    header-vendor        = i_header-lifnr.
    headerx-vendor       = c_x.

    concatenate i_header-bedat+4(4)
                i_header-bedat+0(2)
                i_header-bedat+2(2)
                into header-doc_date.

    headerx-doc_date     = c_x.

    header-created_by    = i_header-ernam.
    headerx-created_by   = c_x.


    header-currency      = i_header-waers.
    headerx-currency     = c_x.

    concatenate i_header-kdatb+4(4)
                i_header-kdatb+0(2)
                i_header-kdatb+2(2)
                into header-vper_start.

    headerx-vper_start   = c_x.



    loop at i_items where legacy = i_header-legacy.


      item-po_item            =  i_items-ebelp.
      itemx-po_item           =  i_items-ebelp.
      itemx-po_itemx          =  c_x.

      if i_header-bsart = 'NB'.
        item-material            =  i_items-ematn.
        itemx-material           =  c_x.

        schedule-quantity        =  i_items-menge * 1000.
        schedulex-quantity       =  c_x.
      else.

        item-short_text          = i_items-ematn.
        itemx-short_text         = c_x.
*
        item-matl_group          = '1000'.
        itemx-matl_group         = c_x.

        schedule-quantity        =  '1'.
        schedulex-quantity       =  c_x.

      endif.

      item-plant               =  i_items-werks.
      itemx-plant              =  c_x.

      schedule-po_item         = i_items-ebelp.
      schedule-sched_line      = '1'.

      schedulex-po_item        = i_items-ebelp.
      schedulex-sched_line     = '1'.

      schedulex-po_itemx       = c_x.
      schedulex-sched_linex    = c_x.


      concatenate  i_items-eildt+0(2)
                   '/'
                   i_items-eildt+2(2)
                   '/'
                   i_items-eildt+4(4)
                   into schedule-delivery_date.


      schedulex-delivery_date  =  c_x.




      item-price_unit          =  i_items-peinh * 100.
      itemx-price_unit         =  c_x.


      item-tax_code            =  i_items-mwskz.
      itemx-tax_code           =  c_x.

      item-shipping            =  i_items-evers.
      itemx-shipping           =  c_x.


      account-po_item          = i_items-ebelp.
      accountx-po_item         = i_items-ebelp.
      accountx-po_itemx        = c_x.

      if i_header-bsart = 'FO'.

        item-pckg_no  = sy-tabix.
        itemx-pckg_no = 'X'.

        limits-pckg_no        = sy-tabix.
        limits-limit          = i_items-overalllimit.
        limits-exp_value      = i_items-expectedoverall.

        posrvaccessvalues-pckg_no    = sy-tabix.
        posrvaccessvalues-line_no    = '0'.
        posrvaccessvalues-serno_line = '00'.
        posrvaccessvalues-percentage = '100.0'.
        posrvaccessvalues-serial_no  = '01'.

        account-serial_no     = '1'.
        accountx-serial_no    = '1'.
        accountx-serial_nox   = c_x.

        account-quantity  = '1'.
        accountx-quantity = c_x.

        call function 'CONVERSION_EXIT_ALPHA_INPUT'
          exporting
            input  = i_items-kostl
          importing
            output = account-costcenter.

        accountx-costcenter   = c_x.

        call function 'CONVERSION_EXIT_ALPHA_INPUT'
          exporting
            input  = i_items-sakto
          importing
            output = account-gl_account.

        accountx-gl_account   = c_x.

        item-acctasscat       = i_items-knttp.
        itemx-acctasscat      = c_x.

        item-item_cat         = i_items-epstp.
        itemx-item_cat        = c_x.

      endif.

      append:item,itemx,schedule,schedulex,account,accountx,limits,posrvaccessvalues.
      clear :item,itemx,schedule,schedulex,account,accountx,limits,posrvaccessvalues.

    endloop.

    call function 'BAPI_PO_CREATE1'
      exporting
        poheader                     = header
        poheaderx                    = headerx
*   POADDRVENDOR                 =
*   TESTRUN                      =
*   MEMORY_UNCOMPLETE            =
*   MEMORY_COMPLETE              =
*   POEXPIMPHEADER               =
*   POEXPIMPHEADERX              =
*   VERSIONS                     =
*   NO_MESSAGING                 =
*   NO_MESSAGE_REQ               =
*   NO_AUTHORITY                 =
*   NO_PRICE_FROM_PO             =
        importing
        exppurchaseorder             = ponumber
*   EXPHEADER                    =
*   EXPPOEXPIMPHEADER            =
        tables
        return                       = return
        poitem                       = item
        poitemx                      = itemx
*   POADDRDELIVERY               =
        poschedule                   = schedule
        poschedulex                  = schedulex
        poaccount                    = account
*   POACCOUNTPROFITSEGMENT       =
        poaccountx                   = accountx
*   POCONDHEADER                 =
*   POCONDHEADERX                =
*   POCOND                       =
*   POCONDX                      =
        polimits                     = limits
*   POCONTRACTLIMITS             =
*   POSERVICES                   =
   posrvaccessvalues            = posrvaccessvalues.
*   POSERVICESTEXT               =
*   EXTENSIONIN                  =
*   EXTENSIONOUT                 =
*   POEXPIMPITEM                 =
*   POEXPIMPITEMX                =
*   POTEXTHEADER                 =
*   POTEXTITEM                   =
*   ALLVERSIONS                  =
*   POPARTNER                    =


    if ponumber eq space.

      loop at return where type = 'E'.
        clear buffer.
        move-corresponding return to e_return.
        concatenate i_header-legacy e_return into buffer.

        transfer buffer to p2_file.

      endloop.

      move-corresponding i_header to i_eheader.
      transfer i_eheader to p3_file.

      loop at i_items where legacy = i_header-legacy.
        move-corresponding i_items to i_eitems.
        transfer i_eitems to p4_file.

      endloop.

    else.



      commit work and wait.

    endif.

    clear:ponumber,header,headerx,item,itemx,account,accountx,limits,return,schedule,schedulex,posrvaccessvalues.
    refresh:item,itemx,account,accountx,limits,return,schedule,schedulex,posrvaccessvalues.

  endloop.
  close dataset p2_file.
  close dataset p3_file.
  close dataset p4_file.



&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Krishna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Apr 2009 12:18:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-we-create-purchase-order-through-report-programming/m-p/5521962#M1262045</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-22T12:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: can we create purchase order through report programming?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-we-create-purchase-order-through-report-programming/m-p/5521963#M1262046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi new to xi  ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes.You can create purchase order through report programming.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can do it by calling the Function Module BAPI_PO_CREATE by passing the all the maddtory fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rama chary.Pammi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Apr 2009 13:01:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-we-create-purchase-order-through-report-programming/m-p/5521963#M1262046</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-22T13:01:28Z</dc:date>
    </item>
  </channel>
</rss>

