<?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 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1772626#M333496</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all. I am new to bapi's. i want to know about bapi. what is th purpose of those of BAPI.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Dec 2006 05:16:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-12-22T05:16:14Z</dc:date>
    <item>
      <title>BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1772626#M333496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all. I am new to bapi's. i want to know about bapi. what is th purpose of those of BAPI.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Dec 2006 05:16:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1772626#M333496</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-22T05:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1772627#M333497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check this link -  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/fu026.htm" target="test_blank"&gt;http://www.sap-img.com/fu026.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if helpfull&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Dec 2006 05:19:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1772627#M333497</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-22T05:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1772628#M333498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;BAPI-step by step&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapgenie.com/abap/bapi/example.htm" target="test_blank"&gt;http://www.sapgenie.com/abap/bapi/example.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.sap.com/www.sappoint.com/abap/bapiintro.pdf" target="test_blank"&gt;www.sappoint.com/abap/bapiintro.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.sap.com/www.sap-img.com/bapi.htm" target="test_blank"&gt;www.sap-img.com/bapi.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.sap.com/www.sap-img.com/abap/bapi-conventions.htm" target="test_blank"&gt;www.sap-img.com/abap/bapi-conventions.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.sap.com/www.planetsap.com/Bapi_main_page.htm" target="test_blank"&gt;www.planetsap.com/Bapi_main_page.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.sap.com/www.sapgenie.com/abap/bapi/index.htm" target="test_blank"&gt;www.sapgenie.com/abap/bapi/index.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/bapi-to-copy-materials-from-one-plant-to-another.htm" target="test_blank"&gt;http://www.sap-img.com/abap/bapi-to-copy-materials-from-one-plant-to-another.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;P&gt;Note - Please mark all the helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Dec 2006 05:20:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1772628#M333498</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-22T05:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1772629#M333499</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;Please go through the below link..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/message/2711273#2711273 &lt;B&gt;[original link is broken]&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;nagaraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Dec 2006 05:24:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1772629#M333499</guid>
      <dc:creator>former_member404244</dc:creator>
      <dc:date>2006-12-22T05:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1772630#M333500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dinesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please go through the following information regarding BAPI's.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Purpose&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;SAP created the Business Framework to allow the technical integration and exchange of business data among SAP components and between SAP and non-SAP components. Important components of the Business Framework are the Business Application Programming Interfaces (BAPIs), which represent visible interfaces at the component boundaries and whose properties serve to integrate these components. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The integration can include both components within a local network and components that are connected with one another through the Internet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BAPIs allow integration at the business level, not the technical level. This provides for greater stability in the link , and independence from the underlying communication technology.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Integration&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BAPIs can be used for the following types of integration:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Connecting R/3 Systems to the Internet using the SAP Business Connector or Internet Application Components (IACs)&lt;/P&gt;&lt;P&gt;BAPIs also allow the creation of true component software, as they enable standardized communication between SAP components. The aim is to encapsulate the functions of the SAP system in independent business components that are integrated through a common interface (the BAPIs).&lt;/P&gt;&lt;P&gt;The integration of new SAP components (such as Advanced Planner and Optimizer (APO) and Business Information Warehouse (BW)), non-SAP software, and legacy systems&lt;/P&gt;&lt;P&gt;Implementation of distributed R/3 scenarios with asynchronous connections using Application Link Enabling (ALE)&lt;/P&gt;&lt;P&gt;Using PC programs as frontends to the R/3 System These can be developed with Visual Basic (Microsoft), for example, or with Visual Age for Java (IBM)&lt;/P&gt;&lt;P&gt;Workflow applications that extend beyond system boundaries&lt;/P&gt;&lt;P&gt;Customers&amp;#146; and partners&amp;#146; own developments&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please reward if you find it useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sadhu Kishore&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jan 2007 12:56:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1772630#M333500</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-03T12:56:44Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1772631#M333501</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;BAPI is an method  to define a SAP Business Object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It let's us integrate all the other external components to R/3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It provides us an access externally to extract the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An alternative to BDC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A Function Module which is RFC enabled is called as BAPI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All errors will be captured in RETURN structure as BAPI won't return any sy-subrc value.Hence,not all Functional Modules which are RFC enabled can be termed as BAPI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;K.Kiran.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;K.Kiran.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jan 2007 14:44:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1772631#M333501</guid>
      <dc:creator>kiran_k8</dc:creator>
      <dc:date>2007-01-03T14:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1772632#M333502</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;REPORT z_po_create NO STANDARD PAGE HEADING&lt;/P&gt;&lt;P&gt;MESSAGE-ID z0lo_scm&lt;/P&gt;&lt;P&gt;LINE-SIZE 220&lt;/P&gt;&lt;P&gt;LINE-COUNT 65 .&lt;/P&gt;&lt;P&gt;TABLES : ekko,&lt;/P&gt;&lt;P&gt;ekpo.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;D A T A D E C L A R A T I O N S &lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="------------------------------------------------------------------" /&gt;&lt;P&gt;*--Type declaration to store data read from table EKKO.&lt;/P&gt;&lt;P&gt;TYPES : BEGIN OF t_ekko,&lt;/P&gt;&lt;P&gt;ebeln TYPE ekko-ebeln,&lt;/P&gt;&lt;P&gt;bukrs TYPE ekko-bukrs,&lt;/P&gt;&lt;P&gt;bsart TYPE ekko-bsart,&lt;/P&gt;&lt;P&gt;aedat TYPE ekko-aedat,&lt;/P&gt;&lt;P&gt;ernam TYPE ekko-ernam,&lt;/P&gt;&lt;P&gt;lifnr TYPE ekko-lifnr,&lt;/P&gt;&lt;P&gt;ekorg TYPE ekko-ekorg,&lt;/P&gt;&lt;P&gt;ekgrp TYPE ekko-ekgrp,&lt;/P&gt;&lt;P&gt;spras TYPE ekko-spras,&lt;/P&gt;&lt;P&gt;werks TYPE ekpo-werks,&lt;/P&gt;&lt;P&gt;END OF t_ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--Type declaration to store data read from table EKPO.&lt;/P&gt;&lt;P&gt;TYPES : BEGIN OF t_ekpo,&lt;/P&gt;&lt;P&gt;ebeln TYPE ekpo-ebeln,&lt;/P&gt;&lt;P&gt;ebelp TYPE ekpo-ebelp,&lt;/P&gt;&lt;P&gt;matnr TYPE ekpo-matnr,&lt;/P&gt;&lt;P&gt;werks TYPE ekpo-werks,&lt;/P&gt;&lt;P&gt;lgort TYPE ekpo-lgort,&lt;/P&gt;&lt;P&gt;menge TYPE ekpo-menge,&lt;/P&gt;&lt;P&gt;knttp TYPE ekpo-knttp,&lt;/P&gt;&lt;P&gt;matkl TYPE ekpo-matkl,&lt;/P&gt;&lt;P&gt;bednr TYPE ekpo-bednr,&lt;/P&gt;&lt;P&gt;afnam TYPE ekpo-afnam,&lt;/P&gt;&lt;P&gt;meins TYPE ekpo-meins,&lt;/P&gt;&lt;P&gt;bpumz TYPE ekpo-bpumz,&lt;/P&gt;&lt;P&gt;bpumn TYPE ekpo-bpumn,&lt;/P&gt;&lt;P&gt;netpr TYPE ekpo-netpr,&lt;/P&gt;&lt;P&gt;peinh TYPE ekpo-peinh,&lt;/P&gt;&lt;P&gt;webaz TYPE ekpo-webaz,&lt;/P&gt;&lt;P&gt;END OF t_ekpo.&lt;/P&gt;&lt;P&gt;TYPES : BEGIN OF t_head_item,&lt;/P&gt;&lt;P&gt;ebeln TYPE ekko-ebeln,&lt;/P&gt;&lt;P&gt;bukrs TYPE ekko-bukrs,&lt;/P&gt;&lt;P&gt;bsart TYPE ekko-bsart,&lt;/P&gt;&lt;P&gt;aedat TYPE ekko-aedat,&lt;/P&gt;&lt;P&gt;ernam TYPE ekko-ernam,&lt;/P&gt;&lt;P&gt;lifnr TYPE ekko-lifnr,&lt;/P&gt;&lt;P&gt;ekorg TYPE ekko-ekorg,&lt;/P&gt;&lt;P&gt;ekgrp TYPE ekko-ekgrp,&lt;/P&gt;&lt;P&gt;spras TYPE ekko-spras,&lt;/P&gt;&lt;P&gt;pincr TYPE ekko-pincr,&lt;/P&gt;&lt;P&gt;zterm TYPE ekko-zterm,&lt;/P&gt;&lt;P&gt;waers TYPE ekko-waers,&lt;/P&gt;&lt;P&gt;inco1 TYPE ekko-inco1,&lt;/P&gt;&lt;P&gt;inco2 TYPE ekko-inco2,&lt;/P&gt;&lt;P&gt;bedat TYPE ekko-bedat,&lt;/P&gt;&lt;P&gt;ebelp TYPE ekpo-ebelp,&lt;/P&gt;&lt;P&gt;txz01 TYPE ekpo-txz01,&lt;/P&gt;&lt;P&gt;matnr TYPE ekpo-matnr,&lt;/P&gt;&lt;P&gt;werks TYPE ekpo-werks,&lt;/P&gt;&lt;P&gt;lgort TYPE ekpo-lgort,&lt;/P&gt;&lt;P&gt;menge TYPE ekpo-menge,&lt;/P&gt;&lt;P&gt;knttp TYPE ekpo-knttp,&lt;/P&gt;&lt;P&gt;matkl TYPE ekpo-matkl,&lt;/P&gt;&lt;P&gt;bednr TYPE ekpo-bednr,&lt;/P&gt;&lt;P&gt;afnam TYPE ekpo-afnam,&lt;/P&gt;&lt;P&gt;meins TYPE ekpo-meins,&lt;/P&gt;&lt;P&gt;bpumz TYPE ekpo-bpumz,&lt;/P&gt;&lt;P&gt;bpumn TYPE ekpo-bpumn,&lt;/P&gt;&lt;P&gt;netpr TYPE ekpo-netpr,&lt;/P&gt;&lt;P&gt;peinh TYPE ekpo-peinh,&lt;/P&gt;&lt;P&gt;webaz TYPE ekpo-webaz,&lt;/P&gt;&lt;P&gt;mwskz TYPE ekpo-mwskz,&lt;/P&gt;&lt;P&gt;adrn2 TYPE ekpo-adrn2,&lt;/P&gt;&lt;P&gt;END OF t_head_item.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES : BEGIN OF t_sucess,&lt;/P&gt;&lt;P&gt;ebeln TYPE ekko-ebeln,&lt;/P&gt;&lt;P&gt;END OF t_sucess.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES : BEGIN OF t_ekko_ekpo,&lt;/P&gt;&lt;P&gt;ebeln TYPE ekko-ebeln,&lt;/P&gt;&lt;P&gt;lifnr TYPE ekko-lifnr,&lt;/P&gt;&lt;P&gt;inco1 TYPE ekko-inco1,&lt;/P&gt;&lt;P&gt;inco2 TYPE ekko-inco2,&lt;/P&gt;&lt;P&gt;zterm TYPE ekko-zterm,&lt;/P&gt;&lt;P&gt;ebelp TYPE ekpo-ebelp,&lt;/P&gt;&lt;P&gt;matnr TYPE ekpo-matnr,&lt;/P&gt;&lt;P&gt;END OF t_ekko_ekpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF t_err_log,&lt;/P&gt;&lt;P&gt;ebeln TYPE ebeln, " Purchase order no.&lt;/P&gt;&lt;P&gt;bstpo TYPE bstpo, " Purchase order line item&lt;/P&gt;&lt;P&gt;etenr TYPE etenr, " Schedule line&lt;/P&gt;&lt;P&gt;err_val(20) TYPE c, " Error value&lt;/P&gt;&lt;P&gt;err_msg(100) TYPE c, " Error message&lt;/P&gt;&lt;P&gt;pogr_err(1) TYPE c, " If 'X' indicates PO creation error,&lt;/P&gt;&lt;P&gt;" else, indicates GR creation error&lt;/P&gt;&lt;P&gt;END OF t_err_log.&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;Variables declarations. &lt;/P&gt;&lt;P&gt;DATA : v_ebeln TYPE ekko-ebeln, "PO Number&lt;/P&gt;&lt;P&gt;v_bsart TYPE ekko-bsart,&lt;/P&gt;&lt;P&gt;v_ekorg TYPE ekko-ekorg, "Purchasing Organization&lt;/P&gt;&lt;P&gt;v_ekgrp TYPE ekko-ekgrp, "Purchasing group&lt;/P&gt;&lt;P&gt;v_lifnr TYPE ekko-lifnr, "Vendor Number&lt;/P&gt;&lt;P&gt;v_werks TYPE ekpo-werks, "Plant&lt;/P&gt;&lt;P&gt;v_matnr TYPE ekpo-matnr, "Material Number&lt;/P&gt;&lt;P&gt;v_infnr TYPE ekpo-infnr. "Agreement&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;Constants declarations. &lt;/P&gt;&lt;P&gt;CONSTANTS: c_bstyp TYPE ekpo-bstyp VALUE 'K',&lt;/P&gt;&lt;P&gt;c_bstyp1 TYPE ekpo-bstyp VALUE 'F',&lt;/P&gt;&lt;P&gt;c_x VALUE 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;D A T A D E C L A R A T I O N S FOR BAPI &lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**-BAPI structure for Purchase Order Header Data&lt;/P&gt;&lt;P&gt;DATA : x_poheader TYPE bapimepoheader,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**-BAPI structure for Purchase Order Header Data (Change Toolbar)&lt;/P&gt;&lt;P&gt;x_poheaderx TYPE bapimepoheaderx,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**-BAPI structure for Purchase Order Item Data&lt;/P&gt;&lt;P&gt;x_poitem TYPE bapimepoitem,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**-BAPI structure for Purchase Order Item Data (Change Toolbar)&lt;/P&gt;&lt;P&gt;x_poitemx TYPE bapimepoitemx,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**-BAPI structure for messages&lt;/P&gt;&lt;P&gt;x_return TYPE bapiret2,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**-Structure for the error log&lt;/P&gt;&lt;P&gt;x_err_log TYPE t_err_log,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**-BAPI structure for Purchase Order Account assignment Data&lt;/P&gt;&lt;P&gt;x_poaccount TYPE bapimepoaccount,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**-BAPI structure for Purchase Order Account assignment&lt;/P&gt;&lt;P&gt;**-Data (Change Toolbar)&lt;/P&gt;&lt;P&gt;x_poaccountx TYPE bapimepoaccountx,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*ADDRESS&lt;/P&gt;&lt;P&gt;x_deliveryaddr TYPE bapimepoaddrdelivery.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**-BAPI internal table containing purchase order item&lt;/P&gt;&lt;P&gt;DATA : it_poitem TYPE STANDARD TABLE OF bapimepoitem,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**-BAPI internal table containing PO item data (Change Toolbar)&lt;/P&gt;&lt;P&gt;it_poitemx TYPE STANDARD TABLE OF bapimepoitemx,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**-BAPI Return table containing messages&lt;/P&gt;&lt;P&gt;it_return TYPE STANDARD TABLE OF bapiret2,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**-BAPI internal table containing Account Assignment Fields for PO&lt;/P&gt;&lt;P&gt;it_poaccount TYPE STANDARD TABLE OF bapimepoaccount,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**-BAPI internal table containing Account Assignment Fields&lt;/P&gt;&lt;P&gt;**-in Purchase Order (Change Toolbar)&lt;/P&gt;&lt;P&gt;it_poaccountx TYPE STANDARD TABLE OF bapimepoaccountx,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it_deliveryaddr TYPE STANDARD TABLE OF bapimepoaddrdelivery.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I N T E R N A L T A B L E D E C L E R A T I O N S &lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="------------------------------------------------------------------" /&gt;&lt;P&gt;DATA: it_ekko TYPE STANDARD TABLE OF t_ekko WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;it_ekko_dest TYPE STANDARD TABLE OF t_ekko WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;it_ekpo TYPE STANDARD TABLE OF t_ekpo WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;it_head_item TYPE STANDARD TABLE OF t_head_item WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;it_ekko_ekpo TYPE STANDARD TABLE OF t_ekko_ekpo WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;it_sucess TYPE STANDARD TABLE OF t_sucess WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;it_contract TYPE STANDARD TABLE OF t_sucess WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;**-Internal table containing error messages&lt;/P&gt;&lt;P&gt;it_err_log TYPE STANDARD TABLE OF t_err_log.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;S E L E C T I O N S C R E E N &lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="------------------------------------------------------------------" /&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;Selection criteria &lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS:s_ebeln FOR ekko-ebeln, "PO Number&lt;/P&gt;&lt;P&gt;s_bsart FOR ekko-bsart DEFAULT 'ZHBV', "PO Type&lt;/P&gt;&lt;P&gt;s_aedat FOR ekko-aedat DEFAULT sy-datum, "Creation Date&lt;/P&gt;&lt;P&gt;s_ekorg FOR ekko-ekorg, "Purchasing Organization&lt;/P&gt;&lt;P&gt;s_ekgrp FOR ekko-ekgrp, "Purchasing group&lt;/P&gt;&lt;P&gt;s_lifnr FOR ekko-lifnr, "Vendor Number&lt;/P&gt;&lt;P&gt;s_werks FOR ekpo-werks, "Plant&lt;/P&gt;&lt;P&gt;s_matnr FOR ekpo-matnr, "Material Number&lt;/P&gt;&lt;P&gt;s_infnr FOR ekpo-infnr. "Agreement&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK b1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.&lt;/P&gt;&lt;P&gt;PARAMETERS :p_bukrs LIKE ekko-bukrs DEFAULT '9040', "Company Code&lt;/P&gt;&lt;P&gt;p_werks LIKE ekpo-werks DEFAULT '7040', "Plant&lt;/P&gt;&lt;P&gt;p_ekorg LIKE ekko-ekorg DEFAULT '9040', "Purchasing Organization&lt;/P&gt;&lt;P&gt;p_ekgrp LIKE ekko-ekgrp DEFAULT '031', "Purchasing group&lt;/P&gt;&lt;P&gt;p_bsart1 LIKE ekko-bsart DEFAULT 'ZHIH'. "PO Type&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK b2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A T S E L E C T I O N - S C R E E N &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;AT SELECTION-SCREEN.&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;Validating the Selection Screen inputs. &lt;/P&gt;&lt;P&gt;PERFORM validate_user_input.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;S T A R T - O F - S E L E C T I O N &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;START-OF-SELECTION.&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;Getting data from table EKKO. &lt;/P&gt;&lt;P&gt;PERFORM get_purchase_order.&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;Getting data from table EKKO &lt;/P&gt;&lt;P&gt;PERFORM get_po_created.&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;Getting data from table EKKO &amp;amp; EKPO &lt;/P&gt;&lt;P&gt;PERFORM get_contract_num.&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;Creating the PO. &lt;/P&gt;&lt;P&gt;PERFORM create_po.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E N D - O F - S E L E C T I O N &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;END-OF-SELECTION.&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;Display PO which are already created &lt;/P&gt;&lt;P&gt;PERFORM display_createdpo_rept.&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;Display PO which doesnt have contract numbers &lt;/P&gt;&lt;P&gt;PERFORM display_contract_rept.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TOP-OF-PAGE.&lt;/P&gt;&lt;P&gt;PERFORM page_heading.&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form VALIDATE_USER_INPUT&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Form to validate user inputs at Selection Screen. &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;FORM validate_user_input .&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;Validating Purchasing Document Number &lt;/P&gt;&lt;P&gt;IF NOT s_ebeln[] IS INITIAL.&lt;/P&gt;&lt;P&gt;SELECT ebeln&lt;/P&gt;&lt;P&gt;INTO v_ebeln&lt;/P&gt;&lt;P&gt;FROM ekko&lt;/P&gt;&lt;P&gt;UP TO 1 ROWS&lt;/P&gt;&lt;P&gt;WHERE ebeln IN s_ebeln.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;IF sy-subrc 0.&lt;/P&gt;&lt;P&gt;MESSAGE e000 WITH 'Invalid Purchasing Document Number'(004).&lt;/P&gt;&lt;P&gt;ENDIF.&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Validating Purchasing Document Type &lt;/P&gt;&lt;P&gt;IF NOT s_bsart[] IS INITIAL.&lt;/P&gt;&lt;P&gt;SELECT bsart&lt;/P&gt;&lt;P&gt;INTO v_bsart&lt;/P&gt;&lt;P&gt;FROM t161&lt;/P&gt;&lt;P&gt;UP TO 1 ROWS&lt;/P&gt;&lt;P&gt;WHERE bsart IN s_bsart.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;IF sy-subrc 0.&lt;/P&gt;&lt;P&gt;MESSAGE e000 WITH 'Invalid Purchasing Document Type'(005).&lt;/P&gt;&lt;P&gt;ENDIF.&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Validating Purchasing org &lt;/P&gt;&lt;P&gt;IF NOT s_ekorg[] IS INITIAL.&lt;/P&gt;&lt;P&gt;SELECT ekorg&lt;/P&gt;&lt;P&gt;INTO v_ekorg&lt;/P&gt;&lt;P&gt;FROM t024e&lt;/P&gt;&lt;P&gt;UP TO 1 ROWS&lt;/P&gt;&lt;P&gt;WHERE ekorg IN s_ekorg.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;IF sy-subrc 0.&lt;/P&gt;&lt;P&gt;MESSAGE e000 WITH 'Invalid Purchasing Organization'(006).&lt;/P&gt;&lt;P&gt;ENDIF.&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Validating Purchasing group &lt;/P&gt;&lt;P&gt;IF NOT s_ekgrp[] IS INITIAL.&lt;/P&gt;&lt;P&gt;SELECT ekgrp&lt;/P&gt;&lt;P&gt;INTO v_ekgrp&lt;/P&gt;&lt;P&gt;FROM t024&lt;/P&gt;&lt;P&gt;UP TO 1 ROWS&lt;/P&gt;&lt;P&gt;WHERE ekgrp IN s_ekgrp.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;IF sy-subrc 0.&lt;/P&gt;&lt;P&gt;MESSAGE e000 WITH 'Invalid Purchasing Group'(007).&lt;/P&gt;&lt;P&gt;ENDIF.&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Validating Vendor's account number &lt;/P&gt;&lt;P&gt;IF NOT s_lifnr[] IS INITIAL.&lt;/P&gt;&lt;P&gt;SELECT lifnr&lt;/P&gt;&lt;P&gt;INTO v_lifnr&lt;/P&gt;&lt;P&gt;FROM lfa1&lt;/P&gt;&lt;P&gt;UP TO 1 ROWS&lt;/P&gt;&lt;P&gt;WHERE lifnr IN s_lifnr.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;IF sy-subrc 0.&lt;/P&gt;&lt;P&gt;MESSAGE e000 WITH 'Invalid Vendor account number'(008).&lt;/P&gt;&lt;P&gt;ENDIF.&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Validating Plant &lt;/P&gt;&lt;P&gt;IF NOT s_werks[] IS INITIAL.&lt;/P&gt;&lt;P&gt;SELECT werks&lt;/P&gt;&lt;P&gt;INTO v_werks&lt;/P&gt;&lt;P&gt;FROM t001w&lt;/P&gt;&lt;P&gt;UP TO 1 ROWS&lt;/P&gt;&lt;P&gt;WHERE werks IN s_werks.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;IF sy-subrc 0.&lt;/P&gt;&lt;P&gt;MESSAGE e000 WITH 'Invalid Plant'(009).&lt;/P&gt;&lt;P&gt;ENDIF.&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Validating Material &lt;/P&gt;&lt;P&gt;IF NOT s_matnr[] IS INITIAL.&lt;/P&gt;&lt;P&gt;SELECT matnr&lt;/P&gt;&lt;P&gt;INTO v_matnr&lt;/P&gt;&lt;P&gt;FROM mara&lt;/P&gt;&lt;P&gt;UP TO 1 ROWS&lt;/P&gt;&lt;P&gt;WHERE matnr IN s_matnr.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;IF sy-subrc 0.&lt;/P&gt;&lt;P&gt;MESSAGE e000 WITH 'Invalid Material Number'(010).&lt;/P&gt;&lt;P&gt;ENDIF.&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Validating info record(Agreement) &lt;/P&gt;&lt;P&gt;IF NOT s_infnr[] IS INITIAL.&lt;/P&gt;&lt;P&gt;SELECT infnr&lt;/P&gt;&lt;P&gt;INTO v_infnr&lt;/P&gt;&lt;P&gt;FROM eina&lt;/P&gt;&lt;P&gt;UP TO 1 ROWS&lt;/P&gt;&lt;P&gt;WHERE infnr IN s_infnr.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;IF sy-subrc 0.&lt;/P&gt;&lt;P&gt;MESSAGE e000 WITH 'Invalid purchasing info record'(011).&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM. " VALIDATE_USER_INPUT&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form GET_PURCHASE_ORDER&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Form to fetch data required from table EKKO &amp;amp; EKPO into internal table. &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;FORM get_purchase_order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REFRESH it_head_item.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Getting data from table EKKO &amp;amp; EKPO. &lt;/P&gt;&lt;P&gt;SELECT a~ebeln&lt;/P&gt;&lt;P&gt;a~bukrs&lt;/P&gt;&lt;P&gt;a~bsart&lt;/P&gt;&lt;P&gt;a~aedat&lt;/P&gt;&lt;P&gt;a~ernam&lt;/P&gt;&lt;P&gt;a~lifnr&lt;/P&gt;&lt;P&gt;a~ekorg&lt;/P&gt;&lt;P&gt;a~ekgrp&lt;/P&gt;&lt;P&gt;a~spras&lt;/P&gt;&lt;P&gt;a~pincr&lt;/P&gt;&lt;P&gt;a~zterm&lt;/P&gt;&lt;P&gt;a~waers&lt;/P&gt;&lt;P&gt;a~inco1&lt;/P&gt;&lt;P&gt;a~inco2&lt;/P&gt;&lt;P&gt;a~bedat&lt;/P&gt;&lt;P&gt;b~ebelp&lt;/P&gt;&lt;P&gt;b~txz01&lt;/P&gt;&lt;P&gt;b~matnr&lt;/P&gt;&lt;P&gt;b~werks&lt;/P&gt;&lt;P&gt;b~lgort&lt;/P&gt;&lt;P&gt;b~menge&lt;/P&gt;&lt;P&gt;b~knttp&lt;/P&gt;&lt;P&gt;b~matkl&lt;/P&gt;&lt;P&gt;b~bednr&lt;/P&gt;&lt;P&gt;b~afnam&lt;/P&gt;&lt;P&gt;b~meins&lt;/P&gt;&lt;P&gt;b~bpumz&lt;/P&gt;&lt;P&gt;b~bpumn&lt;/P&gt;&lt;P&gt;b~netpr&lt;/P&gt;&lt;P&gt;b~peinh&lt;/P&gt;&lt;P&gt;b~webaz&lt;/P&gt;&lt;P&gt;b~mwskz&lt;/P&gt;&lt;P&gt;b~adrn2&lt;/P&gt;&lt;P&gt;INTO TABLE it_head_item&lt;/P&gt;&lt;P&gt;FROM ekko AS a&lt;/P&gt;&lt;P&gt;INNER JOIN ekpo AS b&lt;/P&gt;&lt;P&gt;ON a&lt;SUB&gt;ebeln = b&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;WHERE a~ebeln IN s_ebeln&lt;/P&gt;&lt;P&gt;AND a~bsart IN s_bsart&lt;/P&gt;&lt;P&gt;AND a~aedat IN s_aedat&lt;/P&gt;&lt;P&gt;AND a~ekgrp IN s_ekgrp&lt;/P&gt;&lt;P&gt;AND a~ekorg IN s_ekorg&lt;/P&gt;&lt;P&gt;AND a~lifnr IN s_lifnr&lt;/P&gt;&lt;P&gt;AND a~loekz c_x&lt;/P&gt;&lt;P&gt;AND b~werks IN s_werks&lt;/P&gt;&lt;P&gt;AND b~matnr IN s_matnr&lt;/P&gt;&lt;P&gt;AND b~infnr IN s_infnr&lt;/P&gt;&lt;P&gt;AND b~loekz c_x.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;SORT it_head_item BY ebeln.&lt;/P&gt;&lt;P&gt;LOOP AT it_head_item.&lt;/P&gt;&lt;P&gt;it_head_item-ebeln+0(1) = 'I'.&lt;/P&gt;&lt;P&gt;MODIFY it_head_item INDEX sy-tabix.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;MESSAGE i000 WITH 'No Purchase Order is possible for creation'(003).&lt;/P&gt;&lt;P&gt;STOP.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM. " GET_PURCHASE_ORDER&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form GET_PO_CREATED&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Form to fetch data required from table EKKO into internal table. &lt;/P&gt;&lt;P&gt;Delete those records which are already created &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;FORM get_po_created .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--fetch data from table EKKO into internal table&lt;/P&gt;&lt;P&gt;*--Where Docu type = 'ZHIH'&lt;/P&gt;&lt;P&gt;IF NOT it_head_item[] IS INITIAL.&lt;/P&gt;&lt;P&gt;SELECT a~ebeln&lt;/P&gt;&lt;P&gt;a~bukrs&lt;/P&gt;&lt;P&gt;a~bsart&lt;/P&gt;&lt;P&gt;a~aedat&lt;/P&gt;&lt;P&gt;a~ernam&lt;/P&gt;&lt;P&gt;a~lifnr&lt;/P&gt;&lt;P&gt;a~ekorg&lt;/P&gt;&lt;P&gt;a~ekgrp&lt;/P&gt;&lt;P&gt;a~spras&lt;/P&gt;&lt;P&gt;b~werks&lt;/P&gt;&lt;P&gt;INTO TABLE it_ekko_dest&lt;/P&gt;&lt;P&gt;FROM ekko AS a&lt;/P&gt;&lt;P&gt;INNER JOIN ekpo AS b&lt;/P&gt;&lt;P&gt;ON a&lt;SUB&gt;ebeln = b&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN it_head_item&lt;/P&gt;&lt;P&gt;WHERE a~ebeln = it_head_item-ebeln&lt;/P&gt;&lt;P&gt;AND a~bsart = p_bsart1&lt;/P&gt;&lt;P&gt;AND a~bukrs = p_bukrs&lt;/P&gt;&lt;P&gt;AND b~werks = p_werks&lt;/P&gt;&lt;P&gt;AND b~bstyp = c_bstyp1&lt;/P&gt;&lt;P&gt;AND a~ekorg = p_ekorg&lt;/P&gt;&lt;P&gt;AND a~ekgrp = p_ekgrp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;SORT it_ekko_dest BY ebeln.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--Move all the PO numbers into sucess internal table&lt;/P&gt;&lt;P&gt;*--if the PO was already created&lt;/P&gt;&lt;P&gt;LOOP AT it_ekko_dest.&lt;/P&gt;&lt;P&gt;MOVE it_ekko_dest-ebeln TO it_sucess-ebeln.&lt;/P&gt;&lt;P&gt;APPEND it_sucess.&lt;/P&gt;&lt;P&gt;CLEAR it_sucess.&lt;/P&gt;&lt;P&gt;DELETE it_head_item WHERE ebeln = it_ekko_dest-ebeln.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR it_head_item.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF it_head_item[] IS INITIAL.&lt;/P&gt;&lt;P&gt;MESSAGE i000 WITH 'No Purchase Order is possible for creation'(003).&lt;/P&gt;&lt;P&gt;STOP.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM. " GET_PO_CREATED&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form GET_CONTRACT_NUM&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;text &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;FORM get_contract_num .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--Select the data to get contract number&lt;/P&gt;&lt;P&gt;IF NOT it_head_item[] IS INITIAL.&lt;/P&gt;&lt;P&gt;SELECT a~ebeln "contract numbers&lt;/P&gt;&lt;P&gt;a~lifnr&lt;/P&gt;&lt;P&gt;a~inco1 "Incoterm1&lt;/P&gt;&lt;P&gt;a~inco2 "incoterm2&lt;/P&gt;&lt;P&gt;a~zterm&lt;/P&gt;&lt;P&gt;b~ebelp&lt;/P&gt;&lt;P&gt;b~matnr&lt;/P&gt;&lt;P&gt;INTO TABLE it_ekko_ekpo&lt;/P&gt;&lt;P&gt;FROM ekko AS a&lt;/P&gt;&lt;P&gt;INNER JOIN ekpo AS b&lt;/P&gt;&lt;P&gt;ON a&lt;SUB&gt;ebeln = b&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN it_head_item&lt;/P&gt;&lt;P&gt;WHERE b~matnr = it_head_item-matnr&lt;/P&gt;&lt;P&gt;AND a~bukrs = p_bukrs " Company code&lt;/P&gt;&lt;P&gt;AND a~ekorg = p_ekorg " Purchase org&lt;/P&gt;&lt;P&gt;AND a~loekz c_x " Deletion indicator for header data&lt;/P&gt;&lt;P&gt;AND a~kdatb &amp;lt;= sy-datum " Validity period start&lt;/P&gt;&lt;P&gt;AND a~kdate &amp;gt;= sy-datum " Validity period end&lt;/P&gt;&lt;P&gt;AND b~loekz &amp;lt;&amp;gt; c_x " Deletion indicator for item data&lt;/P&gt;&lt;P&gt;AND b~bstyp = c_bstyp. " Purch. doc. category&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;SORT it_ekko_ekpo BY matnr.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;LOOP AT it_head_item.&lt;/P&gt;&lt;P&gt;READ TABLE it_ekko_ekpo WITH KEY matnr = it_head_item-matnr&lt;/P&gt;&lt;P&gt;BINARY SEARCH.&lt;/P&gt;&lt;P&gt;IF sy-subrc 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move the data to the internal table &lt;/P&gt;&lt;P&gt;which doesnt have contract number &lt;/P&gt;&lt;P&gt;it_contract-ebeln = it_head_item-ebeln.&lt;/P&gt;&lt;P&gt;APPEND it_contract.&lt;/P&gt;&lt;P&gt;CLEAR it_contract.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Deleting the record &lt;/P&gt;&lt;P&gt;which doesnt have any contract number &lt;/P&gt;&lt;P&gt;DELETE it_head_item WHERE ebeln = it_head_item-ebeln.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;CLEAR it_head_item.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF it_head_item[] IS INITIAL.&lt;/P&gt;&lt;P&gt;MESSAGE i000 WITH 'No Purchase Order is possible for creation'(003).&lt;/P&gt;&lt;P&gt;STOP.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM. " GET_CONTRACT_NUM&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form CREATE_PO&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE PURCHASE ORDER &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;FORM create_po .&lt;/P&gt;&lt;P&gt;DATA: l_ret_msg(1000) TYPE c. " Success/Error message from BAPI&lt;/P&gt;&lt;P&gt;CLEAR: x_poheader, x_poheaderx.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT it_head_item BY ebeln.&lt;/P&gt;&lt;P&gt;LOOP AT it_head_item.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT NEW ebeln.&lt;/P&gt;&lt;P&gt;READ TABLE it_head_item WITH KEY ebeln = it_head_item-ebeln.&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;**-Populate PO Header structure&lt;/P&gt;&lt;P&gt;x_poheader-po_number = it_head_item-ebeln. " PO no.&lt;/P&gt;&lt;P&gt;x_poheader-comp_code = p_bukrs. " Company code&lt;/P&gt;&lt;P&gt;x_poheader-doc_type = p_bsart1. " Document type&lt;/P&gt;&lt;P&gt;x_poheader-creat_date = it_head_item-aedat. " Date created&lt;/P&gt;&lt;P&gt;x_poheader-created_by = it_head_item-ernam. " Created by&lt;/P&gt;&lt;P&gt;READ TABLE it_ekko_ekpo WITH KEY matnr = it_head_item-matnr&lt;/P&gt;&lt;P&gt;BINARY SEARCH.&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;x_poheader-vendor = it_ekko_ekpo-lifnr. " Vendor no.&lt;/P&gt;&lt;P&gt;x_poheader-incoterms1 = it_ekko_ekpo-inco1. " Incoterms1&lt;/P&gt;&lt;P&gt;x_poheader-incoterms2 = it_ekko_ekpo-inco2. " Incoterms2&lt;/P&gt;&lt;P&gt;x_poheader-pmnttrms = it_ekko_ekpo-zterm. " Payment terms&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;x_poheader-langu = sy-langu. " Language key&lt;/P&gt;&lt;P&gt;x_poheader-langu_iso = sy-langu. " Language key iso&lt;/P&gt;&lt;P&gt;x_poheader-purch_org = p_ekorg. " Purchasing org.&lt;/P&gt;&lt;P&gt;x_poheader-pur_group = p_ekgrp. " Purch. Group&lt;/P&gt;&lt;P&gt;x_poheader-currency = it_head_item-waers. " currency&lt;/P&gt;&lt;P&gt;x_poheader-currency_iso = it_head_item-waers. " currency iso&lt;/P&gt;&lt;P&gt;x_poheader-doc_date = it_head_item-bedat. " Doc date&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**-Populate PO Header 'X' structure&lt;/P&gt;&lt;P&gt;x_poheaderx-po_number = c_x.&lt;/P&gt;&lt;P&gt;x_poheaderx-comp_code = c_x.&lt;/P&gt;&lt;P&gt;x_poheaderx-doc_type = c_x.&lt;/P&gt;&lt;P&gt;x_poheaderx-creat_date = c_x.&lt;/P&gt;&lt;P&gt;x_poheaderx-created_by = c_x.&lt;/P&gt;&lt;P&gt;x_poheaderx-vendor = c_x.&lt;/P&gt;&lt;P&gt;x_poheaderx-langu = c_x.&lt;/P&gt;&lt;P&gt;x_poheaderx-langu_iso = c_x.&lt;/P&gt;&lt;P&gt;x_poheaderx-pmnttrms = c_x.&lt;/P&gt;&lt;P&gt;x_poheaderx-purch_org = c_x.&lt;/P&gt;&lt;P&gt;x_poheaderx-pur_group = c_x.&lt;/P&gt;&lt;P&gt;x_poheaderx-currency = c_x.&lt;/P&gt;&lt;P&gt;x_poheaderx-currency_iso = c_x.&lt;/P&gt;&lt;P&gt;x_poheaderx-doc_date = c_x.&lt;/P&gt;&lt;P&gt;x_poheaderx-incoterms1 = c_x.&lt;/P&gt;&lt;P&gt;x_poheaderx-incoterms2 = c_x.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE it_ekko_ekpo WITH KEY matnr = it_head_item-matnr&lt;/P&gt;&lt;P&gt;BINARY SEARCH.&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;x_poitem-po_item = it_ekko_ekpo-ebelp. " PO Item no.&lt;/P&gt;&lt;P&gt;x_poitem-agreement = it_ekko_ekpo-ebeln. " Agreement NO&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;x_poitem-short_text = it_head_item-txz01. " Item description&lt;/P&gt;&lt;P&gt;x_poitem-material = it_head_item-matnr. " Material no.&lt;/P&gt;&lt;P&gt;x_poitem-plant = p_werks. " Plant&lt;/P&gt;&lt;P&gt;x_poitem-stge_loc = p_werks. " Storage Loc&lt;/P&gt;&lt;P&gt;x_poitem-matl_group = it_head_item-matkl. " Material group&lt;/P&gt;&lt;P&gt;x_poitem-quantity = it_head_item-menge. " Ordered qty.&lt;/P&gt;&lt;P&gt;x_poitem-po_unit = it_head_item-meins. " Order unit&lt;/P&gt;&lt;P&gt;x_poitem-po_unit_iso = it_head_item-meins. " Order unit&lt;/P&gt;&lt;P&gt;x_poitem-net_price = it_head_item-netpr. " Net price&lt;/P&gt;&lt;P&gt;x_poitem-price_unit = it_head_item-peinh. " price per unit&lt;/P&gt;&lt;P&gt;x_poitem-tax_code = it_head_item-mwskz. " Tax Code&lt;/P&gt;&lt;P&gt;x_poitem-acctasscat = it_head_item-knttp. " Account ass cata&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND x_poitem TO it_poitem.&lt;/P&gt;&lt;P&gt;CLEAR x_poitem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**-Populate PO Item 'X' structure&lt;/P&gt;&lt;P&gt;x_poitemx-po_item = it_ekko_ekpo-ebelp. " PO Item no.&lt;/P&gt;&lt;P&gt;x_poitemx-po_itemx = c_x.&lt;/P&gt;&lt;P&gt;x_poitemx-short_text = c_x.&lt;/P&gt;&lt;P&gt;x_poitemx-material = c_x.&lt;/P&gt;&lt;P&gt;x_poitemx-plant = c_x.&lt;/P&gt;&lt;P&gt;x_poitemx-stge_loc = c_x.&lt;/P&gt;&lt;P&gt;x_poitemx-agreement = c_x.&lt;/P&gt;&lt;P&gt;x_poitemx-matl_group = c_x.&lt;/P&gt;&lt;P&gt;x_poitemx-quantity = c_x.&lt;/P&gt;&lt;P&gt;x_poitemx-po_unit = c_x.&lt;/P&gt;&lt;P&gt;x_poitemx-po_unit_iso = c_x.&lt;/P&gt;&lt;P&gt;x_poitemx-net_price = c_x.&lt;/P&gt;&lt;P&gt;x_poitemx-price_unit = c_x.&lt;/P&gt;&lt;P&gt;x_poitemx-tax_code = c_x.&lt;/P&gt;&lt;P&gt;x_poitemx-acctasscat = c_x.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND x_poitemx TO it_poitemx.&lt;/P&gt;&lt;P&gt;CLEAR x_poitemx.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x_deliveryaddr-po_item = it_ekko_ekpo-ebelp.&lt;/P&gt;&lt;P&gt;x_deliveryaddr-addr_no = it_head_item-adrn2.&lt;/P&gt;&lt;P&gt;APPEND x_deliveryaddr TO it_deliveryaddr.&lt;/P&gt;&lt;P&gt;CLEAR x_deliveryaddr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT END OF ebeln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'BAPI_PO_CREATE1'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;poheader = x_poheader&lt;/P&gt;&lt;P&gt;poheaderx = x_poheaderx&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;return = it_return&lt;/P&gt;&lt;P&gt;poitem = it_poitem&lt;/P&gt;&lt;P&gt;poitemx = it_poitemx&lt;/P&gt;&lt;P&gt;poaddrdelivery = it_deliveryaddr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;wait = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REFRESH : it_poitemx,it_poitem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; x_poheader-po_number.&lt;/P&gt;&lt;P&gt;LOOP AT it_return INTO x_return.&lt;/P&gt;&lt;P&gt;WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; x_return-type,&lt;/P&gt;&lt;P&gt;20 x_return-message.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REFRESH : it_poitemx,it_poitem,it_deliveryaddr,it_return.&lt;/P&gt;&lt;P&gt;CLEAR: x_poheader,x_poheaderx,x_poitem,x_poitemx,x_deliveryaddr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDAT.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM. " CREATE_PO&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form display_createdpo_rept&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;text &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;FORM display_createdpo_rept .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**-Column headings&lt;/P&gt;&lt;P&gt;FORMAT COLOR COL_HEADING.&lt;/P&gt;&lt;P&gt;WRITE:/1(100) sy-uline.&lt;/P&gt;&lt;P&gt;WRITE:/1 sy-vline,&lt;/P&gt;&lt;P&gt;30 'List of PO already created',&lt;/P&gt;&lt;P&gt;100 sy-vline.&lt;/P&gt;&lt;P&gt;FORMAT INTENSIFIED OFF.&lt;/P&gt;&lt;P&gt;FORMAT RESET.&lt;/P&gt;&lt;P&gt;WRITE:/1(100) sy-uline.&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;Display PO created sucess report &lt;/P&gt;&lt;P&gt;LOOP AT it_sucess.&lt;/P&gt;&lt;P&gt;WRITE:/1 sy-vline,&lt;/P&gt;&lt;P&gt;15 'Purchase Order NO:',&lt;/P&gt;&lt;P&gt;40 it_sucess-ebeln,&lt;/P&gt;&lt;P&gt;100 sy-vline.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;WRITE:/1 sy-vline,&lt;/P&gt;&lt;P&gt;2(99) sy-uline,&lt;/P&gt;&lt;P&gt;100 sy-vline.&lt;/P&gt;&lt;P&gt;ENDFORM. " display_createdpo_rept&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form display_contract_rept&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;text &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;FORM display_contract_rept .&lt;/P&gt;&lt;P&gt;SKIP 3.&lt;/P&gt;&lt;P&gt;**-Column headings&lt;/P&gt;&lt;P&gt;FORMAT COLOR COL_HEADING.&lt;/P&gt;&lt;P&gt;WRITE:/1(100) sy-uline.&lt;/P&gt;&lt;P&gt;WRITE:/1 sy-vline,&lt;/P&gt;&lt;P&gt;30 'List of Contract Numbers',&lt;/P&gt;&lt;P&gt;100 sy-vline.&lt;/P&gt;&lt;P&gt;FORMAT INTENSIFIED OFF.&lt;/P&gt;&lt;P&gt;FORMAT RESET.&lt;/P&gt;&lt;P&gt;WRITE:/1(100) sy-uline.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT it_contract.&lt;/P&gt;&lt;P&gt;WRITE:/1 sy-vline,&lt;/P&gt;&lt;P&gt;15 'Purchase Order NO:',&lt;/P&gt;&lt;P&gt;40 it_contract-ebeln,&lt;/P&gt;&lt;P&gt;100 sy-vline.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE:/1 sy-vline,&lt;/P&gt;&lt;P&gt;2(99) sy-uline,&lt;/P&gt;&lt;P&gt;100 sy-vline.&lt;/P&gt;&lt;P&gt;ENDFORM. " display_contract_rept&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;**&amp;amp; Form RETURN_MESSAGES&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;text &lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;*FORM return_messages .&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*ENDFORM. " RETURN_MESSAGES&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form PAGE_HEADING&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;text &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;FORM page_heading .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**-List heading&lt;/P&gt;&lt;P&gt;FORMAT COLOR COL_HEADING.&lt;/P&gt;&lt;P&gt;WRITE:/1(100) sy-uline.&lt;/P&gt;&lt;P&gt;WRITE:/1 sy-vline,&lt;/P&gt;&lt;P&gt;40 'Summary Report',&lt;/P&gt;&lt;P&gt;100 sy-vline.&lt;/P&gt;&lt;P&gt;FORMAT INTENSIFIED OFF.&lt;/P&gt;&lt;P&gt;FORMAT RESET.&lt;/P&gt;&lt;P&gt;WRITE:/1(100) sy-uline.&lt;/P&gt;&lt;P&gt;SKIP 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM. " PAGE_HEADING&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2008 06:17:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1772632#M333502</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-19T06:17:00Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1772633#M333503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sir ,&lt;/P&gt;&lt;P&gt;Please have a look below .Hope it is suitable and simpler solution for your question.&lt;/P&gt;&lt;P&gt;Please do reward if useful.&lt;/P&gt;&lt;P&gt;Thankx.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what is BAPI?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BAPI stands for Business API(Application Program Interface).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A BAPI is remotely enabled function module ie it can be invoked from remote programs like standalone JAVA programs, web interface etc..&lt;/P&gt;&lt;P&gt;You can make your function module remotely enabled in attributes of Function module but&lt;/P&gt;&lt;P&gt;A BAPI are standard SAP function modules provided by SAP for remote access. Also they are part of Businees Objest Repository(BOR).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects. You create business objects and those are then registered in your BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA. in this case u only specify the business object and its method from external system in BAPI there is no direct system call. while RFC are direct system call Some BAPIs provide basic functions and can be used for most SAP business object types. These BAPIs should be implemented the same for all business object types. Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs. Whenever possible, a standardized BAPI must be used in preference to an individual BAPI. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following standardized BAPIs are provided: &lt;/P&gt;&lt;P&gt;Reading instances of SAP business objects &lt;/P&gt;&lt;P&gt;GetList ( ) With the BAPI GetList you can select a range of object key values, for example, company codes and material numbers. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The BAPI GetList() is a class method. &lt;/P&gt;&lt;P&gt;GetDetail() With the BAPI GetDetail() the details of an instance of a business object type are retrieved and returned to the calling program. The instance is identified via its key. The BAPI GetDetail() is an instance method. BAPIs that can create, change or delete instances of a business object type &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following BAPIs of the same object type have to be programmed so that they can be called several times within one transaction. For example, if, after sales order 1 has been created, a second sales order 2 is created in the same transaction, the second BAPI call must not affect the consistency of the sales order 2. After completing the transaction with a COMMIT WORK, both the orders are saved consistently in the database. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create( ) and CreateFromData! ( ) &lt;/P&gt;&lt;P&gt;The BAPIs Create() and CreateFromData() create an instance of an SAP business object type, for example, a purchase order. These BAPIs are class methods. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Change( ) &lt;/P&gt;&lt;P&gt;The BAPI Change() changes an existing instance of an SAP business object type, for example, a purchase order. The BAPI Change () is an instance method. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Delete( ) and Undelete( ) The BAPI Delete() deletes an instance of an SAP business object type from the database or sets a deletion flag. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The BAPI Undelete() removes a deletion flag. These BAPIs are instance methods. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cancel ( ) Unlike the BAPI Delete(), the BAPI Cancel() cancels an instance of a business object type. The instance to be cancelled remains in the database and an additional instance is created and this is the one that is actually canceled. The Cancel() BAPI is an instance method. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Add&amp;lt;subobject&amp;gt; ( ) and Remove&amp;lt;subobject&amp;gt; ( ) The BAPI Add&amp;lt;subobject&amp;gt; adds a subobject to an existing object inst! ance and the BAPI and Remove&amp;lt;subobject&amp;gt; removes a subobject from an object instance. These BAPIs are instance methods. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BAPI-step by step&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapgenie.com/abap/bapi/example.htm" target="test_blank"&gt;http://www.sapgenie.com/abap/bapi/example.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;just refer to the link below&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapmaterial.com/?gclid=CN322K28t4sCFQ-WbgodSGbK2g" target="test_blank"&gt;http://www.sapmaterial.com/?gclid=CN322K28t4sCFQ-WbgodSGbK2g&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;list of all bapis&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.planetsap.com/LIST_ALL_BAPIs.htm" target="test_blank"&gt;http://www.planetsap.com/LIST_ALL_BAPIs.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for BAPI's&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sappoint.com/abap/bapiintro.pdf" target="test_blank"&gt;http://www.sappoint.com/abap/bapiintro.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sappoint.com/abap/bapiprg.pdf" target="test_blank"&gt;http://www.sappoint.com/abap/bapiprg.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sappoint.com/abap/bapiactx.pdf" target="test_blank"&gt;http://www.sappoint.com/abap/bapiactx.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sappoint.com/abap/bapilst.pdf" target="test_blank"&gt;http://www.sappoint.com/abap/bapilst.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sappoint.com/abap/bapiexer.pdf" target="test_blank"&gt;http://www.sappoint.com/abap/bapiexer.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://service.sap.com/ale" target="test_blank"&gt;http://service.sap.com/ale&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://service.sap.com/bapi" target="test_blank"&gt;http://service.sap.com/bapi&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf" target="test_blank"&gt;http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf" target="test_blank"&gt;http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf" target="test_blank"&gt;http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.planetsap.com/Bapi_main_page.htm" target="test_blank"&gt;http://www.planetsap.com/Bapi_main_page.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.topxml.com/sap/sap_idoc_xml.asp" target="test_blank"&gt;http://www.topxml.com/sap/sap_idoc_xml.asp&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdevelopment.co.uk/" target="test_blank"&gt;http://www.sapdevelopment.co.uk/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf" target="test_blank"&gt;http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also refer to the following links..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.sap.com/www.sap-img.com/bapi.htm" target="test_blank"&gt;www.sap-img.com/bapi.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.sap.com/www.sap-img.com/abap/bapi-conventions.htm" target="test_blank"&gt;www.sap-img.com/abap/bapi-conventions.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.sap.com/www.planetsap.com/Bapi_main_page.htm" target="test_blank"&gt;www.planetsap.com/Bapi_main_page.htm&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;A href="https://community.sap.com/www.sapgenie.com/abap/bapi/index.htm" target="test_blank"&gt;www.sapgenie.com/abap/bapi/index.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Checkout !!&lt;/P&gt;&lt;P&gt;&lt;A href="http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html" target="test_blank"&gt;http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://techrepublic.com.com/5100-6329-1051160.html#" target="test_blank"&gt;http://techrepublic.com.com/5100-6329-1051160.html#&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example Code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U need to give the step_nr, item_nr, cond_count and cond_type so the correct conditon will be updated. If no condition exists for the given parameters, a new condition will be created.&lt;/P&gt;&lt;P&gt;U can find these parameters for a particular condition type in table KONV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form saveTransactionJOCR&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;text &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--&amp;gt; p1 text &lt;/P&gt;&lt;P&gt;&amp;lt;-- p2 text &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;FORM saveTransactionJOCR .&lt;/P&gt;&lt;P&gt;data: salesdocument like BAPIVBELN-VBELN,&lt;/P&gt;&lt;P&gt;order_header_inx like bapisdh1x,&lt;/P&gt;&lt;P&gt;order_header_in like bapisdh1,&lt;/P&gt;&lt;P&gt;return type standard table of bapiret2 with header line,&lt;/P&gt;&lt;P&gt;conditions_in type standard table of bapicond with header line,&lt;/P&gt;&lt;P&gt;conditions_inx type standard table of bapicondx with header line,&lt;/P&gt;&lt;P&gt;logic_switch like BAPISDLS,&lt;/P&gt;&lt;P&gt;step_nr like conditions_in-cond_st_no,&lt;/P&gt;&lt;P&gt;item_nr like conditions_in-itm_number,&lt;/P&gt;&lt;P&gt;cond_count like conditions_in-cond_count,&lt;/P&gt;&lt;P&gt;cond_type like conditions_in-cond_type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;salesdocument = wa_order_information-VBELN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOGIC_SWITCH-COND_HANDL = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;order_header_inx-updateflag = 'U'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;conditions &lt;/P&gt;&lt;P&gt;clear conditions_in[].&lt;/P&gt;&lt;P&gt;clear conditions_inx[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: step_nr,&lt;/P&gt;&lt;P&gt;item_nr,&lt;/P&gt;&lt;P&gt;cond_count,&lt;/P&gt;&lt;P&gt;cond_type.&lt;/P&gt;&lt;P&gt;step_nr = '710'.&lt;/P&gt;&lt;P&gt;item_nr = '000000'.&lt;/P&gt;&lt;P&gt;cond_count = '01'.&lt;/P&gt;&lt;P&gt;cond_type = 'ZCP2'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONDITIONS_IN-ITM_NUMBER = item_nr.&lt;/P&gt;&lt;P&gt;conditions_in-cond_st_no = step_nr.&lt;/P&gt;&lt;P&gt;CONDITIONS_IN-COND_COUNT = cond_count.&lt;/P&gt;&lt;P&gt;CONDITIONS_IN-COND_TYPE = cond_type.&lt;/P&gt;&lt;P&gt;CONDITIONS_IN-COND_VALUE = 666.&lt;/P&gt;&lt;P&gt;CONDITIONS_IN-CURRENCY = 'EUR'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append conditions_in.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONDITIONS_INX-ITM_NUMBER = item_nr.&lt;/P&gt;&lt;P&gt;conditions_inx-cond_st_no = step_nr.&lt;/P&gt;&lt;P&gt;CONDITIONS_INX-COND_COUNT = cond_count.&lt;/P&gt;&lt;P&gt;CONDITIONS_INX-COND_TYPE = cond_type.&lt;/P&gt;&lt;P&gt;CONDITIONS_INX-UPDATEFLAG = 'U'.&lt;/P&gt;&lt;P&gt;CONDITIONS_INX-COND_VALUE = 'X'.&lt;/P&gt;&lt;P&gt;CONDITIONS_INX-CURRENCY = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append conditions_inx.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'BAPI_SALESORDER_CHANGE'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;SALESDOCUMENT = salesdocument&lt;/P&gt;&lt;P&gt;ORDER_HEADER_IN = order_header_in&lt;/P&gt;&lt;P&gt;ORDER_HEADER_INX = order_header_inx&lt;/P&gt;&lt;P&gt;LOGIC_SWITCH = logic_switch&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;RETURN = return&lt;/P&gt;&lt;P&gt;CONDITIONS_IN = conditions_in&lt;/P&gt;&lt;P&gt;CONDITIONS_INX = conditions_inx&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if return-type ne 'E'.&lt;/P&gt;&lt;P&gt;commit work and wait.&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;ENDFORM. " saveTransactionJOCR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bdc to Bapi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The steps to be followed are :&lt;/P&gt;&lt;P&gt;1. Find out the relevant BAPI (BAPI_SALESORDER_CHANGE for VA02).&lt;/P&gt;&lt;P&gt;for VA01 use BAPI_SALESORDER_CREATEFROMDAT2&lt;/P&gt;&lt;P&gt;2. Create a Z program and call the BAPi (same as a Funtion module call).&lt;/P&gt;&lt;P&gt;2. Now, if you see this BAPi, it has &lt;/P&gt;&lt;P&gt;-&amp;gt; Importing structures. &lt;/P&gt;&lt;P&gt;eg: SALESDOCUMENT: this will take the Sales order header data as input.&lt;/P&gt;&lt;P&gt;-&amp;gt; Tables parameters: &lt;/P&gt;&lt;P&gt;eg: ORDER_ITEM_IN: this will take the line item data as input. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note :&lt;/P&gt;&lt;P&gt;Only specify fields that should be changed&lt;/P&gt;&lt;P&gt;Select these fields by entering an X in the checkboxes&lt;/P&gt;&lt;P&gt;Enter a U in the UPDATEFLAG field&lt;/P&gt;&lt;P&gt;Always specify key fields when changing the data, including in the checkboxes&lt;/P&gt;&lt;P&gt;The configuration is an exception here. If this needs to be changed, you need to complete it again fully.&lt;/P&gt;&lt;P&gt;Maintain quantities and dates in the schedule line data&lt;/P&gt;&lt;P&gt;Possible UPDATEFLAGS:&lt;/P&gt;&lt;P&gt;U = change&lt;/P&gt;&lt;P&gt;D = delete&lt;/P&gt;&lt;P&gt;I = add&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;1. Delete the whole order&lt;/P&gt;&lt;P&gt;2. Delete order items&lt;/P&gt;&lt;P&gt;3. Change the order&lt;/P&gt;&lt;P&gt;4. Change the configuration&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes&lt;/P&gt;&lt;P&gt;1. Minimum entry:&lt;/P&gt;&lt;P&gt;You must enter the order number in the SALESDOCUMENT structure.&lt;/P&gt;&lt;P&gt;You must always enter key fields for changes.&lt;/P&gt;&lt;P&gt;You must always specify the update indicator in the ORDER_HEADER_INX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Commit control:&lt;/P&gt;&lt;P&gt;The BAPI does not run a database Commit, which means that the application must trigger the Commit so that the changes are read to the database. To do this, use the BAPI_TRANSACTION_COMMIT BAPI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For further details... refer to the Function Module documentation for the BAPi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bapi to VB(Visual Basic)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Long back I had used the following flow structure to acheive the same.&lt;/P&gt;&lt;P&gt;Report -&amp;gt; SM59 RFC destination -&amp;gt; COM4ABAP -&amp;gt; VB.exe&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my report uses the rfc destination to create a COM session with com4abap. com4abap calls the vb.exe and manages the flow of data between sap and vb exe.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to have com4abap.exe&lt;/P&gt;&lt;P&gt;If com4abap is installed you will find it in sapgui installatin directory , C:\Program Files\SAPpc\sapgui\RFCSDK\com4abap.&lt;/P&gt;&lt;P&gt;else refer OSS note 419822 for installation of com4abap&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;after making the settings in com4abap to point to the vb program and setting up rfc destination in sm59 to point to com4abap session , you can use the following function modules to call the vb code. &lt;/P&gt;&lt;P&gt;for setting up com4abap and rfc destination please refer to the documentation for com4abap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Invoke NEW DCOM session &lt;/P&gt;&lt;P&gt;call function 'BEGIN_COM_SESSION'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;service_dest = service_dest "(this will be a RFC destination created in SM59)&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;worker_dest = worker_dest&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;connect_to_dcom_service_failed = 1&lt;/P&gt;&lt;P&gt;connect_to_dcom_worker_failed = 2&lt;/P&gt;&lt;P&gt;others = 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'create_com_instance' destination worker_dest&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;clsid = g_c_clsid&lt;/P&gt;&lt;P&gt;typelib = g_c_typelib&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;instid = g_f_oid&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;communication_failure = 1 message g_f_msg&lt;/P&gt;&lt;P&gt;system_failure = 2 message g_f_msg&lt;/P&gt;&lt;P&gt;invalid_instance_id = 3&lt;/P&gt;&lt;P&gt;others = 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'com_invoke' destination worker_dest&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;%instid = g_f_oid&lt;/P&gt;&lt;P&gt;%method = 'UpdatePDF'&lt;/P&gt;&lt;P&gt;sntemp = g_v_const_filent&lt;/P&gt;&lt;P&gt;snsysid = sy-sysid&lt;/P&gt;&lt;P&gt;snflag = 'N'&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;rssaptable = g_t_pdfdetail1&lt;/P&gt;&lt;P&gt;%return = g_t_pdfdetail1 "t_test&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;communication_failure = 1 message g_f_msg&lt;/P&gt;&lt;P&gt;system_failure = 2 message g_f_msg&lt;/P&gt;&lt;P&gt;invalid_instance_id = 3&lt;/P&gt;&lt;P&gt;others = 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then close the com session , using&lt;/P&gt;&lt;P&gt;FM delete_com_instance&lt;/P&gt;&lt;P&gt;FM END_COM_SESSION &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2008 06:22:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1772633#M333503</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-19T06:22:43Z</dc:date>
    </item>
  </channel>
</rss>

