<?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: BAPI in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410777#M197859</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;BAPI_GOODSMVT_CREATE to post Goods Movement &lt;/P&gt;&lt;P&gt;The following is an abap program making used of the BAPI function BAPI_GOODSMVT_CREATE to do Goods Receipts for Purchase Order after importing the data from an external system. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;BAPI TO Upload Inventory Data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;GMCODE Table T158G - 01 - MB01 - Goods Receipts for Purchase Order&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                     02 - MB31 - Goods Receipts for Prod Order&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                     03 - MB1A - Goods Issue&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                     04 - MB1B - Transfer Posting&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                     05 - MB1C - Enter Other Goods Receipt&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                     06 - MB11&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Domain: KZBEW - Movement Indicator&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     Goods movement w/o reference&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; B - Goods movement for purchase order&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; F - Goods movement for production order&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; L - Goods movement for delivery note&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; K - Goods movement for kanban requirement (WM - internal only)&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; O - Subsequent adjustment of "material-provided" consumption&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; W - Subsequent adjustment of proportion/product unit material&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;report zbapi_goodsmovement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters: p-file like rlgrap-filename default&lt;/P&gt;&lt;P&gt;                                 'c:\sapdata\TEST.txt'.&lt;/P&gt;&lt;P&gt;parameters: e-file like rlgrap-filename default&lt;/P&gt;&lt;P&gt;                                 'c:\sapdata\gdsmvterror.txt'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters: xpost like sy-datum default sy-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of gmhead.&lt;/P&gt;&lt;P&gt;        include structure bapi2017_gm_head_01.&lt;/P&gt;&lt;P&gt;data: end of gmhead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of gmcode.&lt;/P&gt;&lt;P&gt;        include structure bapi2017_gm_code.&lt;/P&gt;&lt;P&gt;data: end of gmcode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of mthead.&lt;/P&gt;&lt;P&gt;        include structure bapi2017_gm_head_ret.&lt;/P&gt;&lt;P&gt;data: end of mthead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of itab occurs 100.&lt;/P&gt;&lt;P&gt;        include structure bapi2017_gm_item_create.&lt;/P&gt;&lt;P&gt;data: end of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of errmsg occurs 10.&lt;/P&gt;&lt;P&gt;        include structure bapiret2.&lt;/P&gt;&lt;P&gt;data: end of errmsg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: wmenge like iseg-menge,&lt;/P&gt;&lt;P&gt;      errflag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of pcitab occurs 100,&lt;/P&gt;&lt;P&gt;        ext_doc(10),           "External Document Number&lt;/P&gt;&lt;P&gt;        mvt_type(3),           "Movement Type&lt;/P&gt;&lt;P&gt;        doc_date(8),           "Document Date&lt;/P&gt;&lt;P&gt;        post_date(8),          "Posting Date&lt;/P&gt;&lt;P&gt;        plant(4),              "Plant&lt;/P&gt;&lt;P&gt;        material(18),          "Material Number&lt;/P&gt;&lt;P&gt;        qty(13),               "Quantity&lt;/P&gt;&lt;P&gt;        recv_loc(4),           "Receiving Location&lt;/P&gt;&lt;P&gt;        issue_loc(4),          "Issuing Location&lt;/P&gt;&lt;P&gt;        pur_doc(10),           "Purchase Document No&lt;/P&gt;&lt;P&gt;        po_item(3),            "Purchase Document Item No&lt;/P&gt;&lt;P&gt;        del_no(10),            "Delivery Purchase Order Number&lt;/P&gt;&lt;P&gt;        del_item(3),           "Delivery Item&lt;/P&gt;&lt;P&gt;        prod_doc(10),          "Production Document No&lt;/P&gt;&lt;P&gt;        scrap_reason(10),      "Scrap Reason&lt;/P&gt;&lt;P&gt;        upd_sta(1),            "Update Status&lt;/P&gt;&lt;P&gt;      end of pcitab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'WS_UPLOAD'&lt;/P&gt;&lt;P&gt;  exporting&lt;/P&gt;&lt;P&gt;    filename                      = p-file&lt;/P&gt;&lt;P&gt;    filetype                      = 'DAT'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FILELENGTH                    =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  tables&lt;/P&gt;&lt;P&gt;    data_tab                      = pcitab&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FILE_OPEN_ERROR               = 1&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FILE_READ_ERROR               = 2&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  NO_BATCH                      = 3&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  GUI_REFUSE_FILETRANSFER       = 4&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  INVALID_TYPE                  = 5&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  OTHERS                        = 6&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          .&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;  message id sy-msgid type sy-msgty number sy-msgno&lt;/P&gt;&lt;P&gt;          with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;  exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gmhead-pstng_date = sy-datum.&lt;/P&gt;&lt;P&gt;gmhead-doc_date = sy-datum.&lt;/P&gt;&lt;P&gt;gmhead-pr_uname = sy-uname.&lt;/P&gt;&lt;P&gt;gmcode-gm_code = '01'.   "01 - MB01 - Goods Receipts for Purchase Order&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at pcitab.&lt;/P&gt;&lt;P&gt;  itab-move_type  = pcitab-mvt_type.&lt;/P&gt;&lt;P&gt;  itab-mvt_ind    = 'B'.&lt;/P&gt;&lt;P&gt;  itab-plant      = pcitab-plant.&lt;/P&gt;&lt;P&gt;  itab-material   = pcitab-material.&lt;/P&gt;&lt;P&gt;  itab-entry_qnt  = pcitab-qty.&lt;/P&gt;&lt;P&gt;  itab-move_stloc = pcitab-recv_loc.&lt;/P&gt;&lt;P&gt;  itab-stge_loc   = pcitab-issue_loc.&lt;/P&gt;&lt;P&gt;  itab-po_number  = pcitab-pur_doc.&lt;/P&gt;&lt;P&gt;  itab-po_item    = pcitab-po_item.&lt;/P&gt;&lt;P&gt;  concatenate pcitab-del_no pcitab-del_item into itab-item_text.&lt;/P&gt;&lt;P&gt;  itab-move_reas  = pcitab-scrap_reason.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  append itab.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;  write:/ itab-material, itab-plant, itab-stge_loc,&lt;/P&gt;&lt;P&gt;          itab-move_type, itab-entry_qnt, itab-entry_uom,&lt;/P&gt;&lt;P&gt;          itab-entry_uom_iso, itab-po_number, itab-po_item,&lt;/P&gt;&lt;P&gt;                                              pcitab-ext_doc.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'BAPI_GOODSMVT_CREATE'&lt;/P&gt;&lt;P&gt;  exporting&lt;/P&gt;&lt;P&gt;    goodsmvt_header             = gmhead&lt;/P&gt;&lt;P&gt;    goodsmvt_code               = gmcode&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  TESTRUN                     = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    goodsmvt_headret            = mthead&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  MATERIALDOCUMENT            =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  MATDOCUMENTYEAR             =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  tables&lt;/P&gt;&lt;P&gt;    goodsmvt_item               = itab&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  GOODSMVT_SERIALNUMBER       =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    return                      = errmsg&lt;/P&gt;&lt;P&gt;          .&lt;/P&gt;&lt;P&gt;clear errflag.&lt;/P&gt;&lt;P&gt;loop at errmsg.&lt;/P&gt;&lt;P&gt;  if errmsg-type eq 'E'.&lt;/P&gt;&lt;P&gt;    write:/'Error in function', errmsg-message.&lt;/P&gt;&lt;P&gt;    errflag = 'X'.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    write:/ errmsg-message.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if errflag is initial.&lt;/P&gt;&lt;P&gt;  commit work and wait.&lt;/P&gt;&lt;P&gt;  if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;    write:/ 'Error in updating'.&lt;/P&gt;&lt;P&gt;    exit.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    write:/ mthead-mat_doc, mthead-doc_year.&lt;/P&gt;&lt;P&gt;    perform upd_sta.&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;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      FORM UPD_STA                                                  *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      ........                                                      *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form upd_sta.&lt;/P&gt;&lt;P&gt;  loop at pcitab.&lt;/P&gt;&lt;P&gt;    pcitab-upd_sta = 'X'.&lt;/P&gt;&lt;P&gt;    modify pcitab.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call function 'WS_DOWNLOAD'&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      filename                      = p-file&lt;/P&gt;&lt;P&gt;      filetype                      = 'DAT'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FILELENGTH                    =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    tables&lt;/P&gt;&lt;P&gt;      data_tab                      = pcitab&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FILE_OPEN_ERROR               = 1&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FILE_READ_ERROR               = 2&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  NO_BATCH                      = 3&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  GUI_REFUSE_FILETRANSFER       = 4&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  INVALID_TYPE                  = 5&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  OTHERS                        = 6&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- End of Program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Subhasish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Jun 2006 07:02:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-06-30T07:02:01Z</dc:date>
    <item>
      <title>BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410771#M197853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;    Iam working on BAPI. i dont know how to use that. can any body send any sample reports or sample programs on BAPI.&lt;/P&gt;&lt;P&gt;                               chandu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jun 2006 06:52:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410771#M197853</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-30T06:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410772#M197854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai Chandra Babu&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go through the following Document for BAPI&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bapi to create customer master  &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------------" /&gt;&lt;P&gt;BAPI_CUSTOMER_CREATEFROMDATA&lt;/P&gt;&lt;P&gt;BAPI_CUSTOMER_CREATEFROMDATA1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you can use FM SD_CUSTOMER_MAINTAIN_ALL&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;I have answered this question before..&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;Check these Links out&lt;/P&gt;&lt;P&gt;&lt;A href="http://searchsap.techtarget.com/ateQuestionNResponse/0,289625,sid21_cid558752_tax293481,00.html" target="test_blank"&gt;http://searchsap.techtarget.com/ateQuestionNResponse/0,289625,sid21_cid558752_tax293481,00.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/interview-question-on-bapi-rfc-abap-objects-tables.htm" target="test_blank"&gt;http://www.sap-img.com/abap/interview-question-on-bapi-rfc-abap-objects-tables.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/fu033.htm" target="test_blank"&gt;http://www.sap-img.com/fu033.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/ale-bapi.htm" target="test_blank"&gt;http://www.sap-img.com/abap/ale-bapi.htm&lt;/A&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;Please check out this thread..&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="1573674"&gt;&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;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;/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;A href="http://www.sap-img.com/bapi.htm" target="test_blank"&gt;http://www.sap-img.com/bapi.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/bapi-conventions.htm" target="test_blank"&gt;http://www.sap-img.com/abap/bapi-conventions.htm&lt;/A&gt;&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;/P&gt;&lt;P&gt;Java Connector(JCO) can call not only BAPI's but also the function modules which are remotely enabled..&lt;/P&gt;&lt;P&gt;BAPI's as i said earlier are remotely enabled function modules..&lt;/P&gt;&lt;P&gt;Hence, JCO can call also BAPI's(n not only BAPI's as u mentioned).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the following 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;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form saveTransactionJOCR&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;--&amp;gt; p1 text&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;&amp;lt;-- p2 text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;conditions&lt;/P&gt;&lt;/LI&gt;&lt;/UL&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;&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;Thanks &amp;amp; regards&lt;/P&gt;&lt;P&gt;Sreenivasulu P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jun 2006 06:56:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410772#M197854</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-30T06:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410773#M197855</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;For Programming with BAPIS...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer..&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/7e/5e114a4a1611d1894c0000e829fbbd/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/7e/5e114a4a1611d1894c0000e829fbbd/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Jothi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jun 2006 06:56:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410773#M197855</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-30T06:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410774#M197856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Take a look here&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm" target="test_blank"&gt;http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm&lt;/A&gt;&lt;/P&gt;&lt;P&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 close the thread if the question is answered&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jun 2006 06:56:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410774#M197856</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-30T06:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410775#M197857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Check the code...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT Z_MAT_UPLOAD .

*TO CREATE MATERIAL USING BAPI.

**********************************************************************
*                STRUCTURE  DECLARATIONS                             *
**********************************************************************

TABLES: BAPIMATHEAD,  "Headerdata
        BAPI_MARA,    "Clientdata
        BAPI_MARAX,   "Clientdatax
        BAPI_MARC,    "Plantdata
        BAPI_MARCX,   "Plantdatax
        BAPI_MAKT,    "Material description
        BAPI_MBEW,    "VALUATION DATA
        BAPI_MBEWX,
        BAPI_MARM,
        BAPI_MARMX,
        bapi_mean,
        BAPIRET2.     "Return messages

DATA:V_FILE TYPE STRING.   "input data file



DATA:
  BEGIN OF LSMW_MATERIAL_MASTER,
    MATNR(018) TYPE C,  "Material number
    MTART(004) TYPE C,  "Material type
    MBRSH(001) TYPE C,  "Industry sector
    WERKS(004) TYPE C,  "Plant
    MAKTX(040) TYPE C,  "Material description
    DISMM(002) TYPE C,  "Extra Field Added In the Program as itsrequired
    MEINS(003) TYPE C,  "Base unit of measure
    MATKL(009) TYPE C,  "Material group
    SPART(002) TYPE C,  "Division
    LABOR(003) TYPE C,  "Lab/office
    PRDHA(018) TYPE C,  "Product hierarchy
    MSTAE(002) TYPE C,  "X-plant matl status
    MTPOS_MARA(004) TYPE C,  "Gen item cat group
    BRGEW(017) TYPE C,  "Gross weight
    GEWEI(003) TYPE C,  "Weight unit
    NTGEW(017) TYPE C,  "Net weight
    GROES(032) TYPE C,  "Size/Dimensions
    MAGRV(004) TYPE C,  "Matl grp pack matls
    BISMT(018) TYPE C,  "Old material number
    WRKST(048) TYPE C,  "Basic material
    PROFL(003) TYPE C,  "DG indicator profile
    KZUMW(001) TYPE C,  "Environmentally rlvt
    BSTME(003) TYPE C,  "Order unit
    VABME(001) TYPE C,
    EKGRP(003) TYPE C,  "Purchasing group
    XCHPF(001) TYPE C,  "Batch management
    EKWSL(004) TYPE C,  "Purchasing key value
    WEBAZ(003) TYPE C,  "GR processing time
    MFRPN(040) TYPE C,  "Manufacturer part number
    MFRNR(010) TYPE C,  "Manufacturer number
    VPRSV(001) TYPE C,  "Price control indicator
    STPRS(015) TYPE C,  "Standard price
    BWPRH(014) TYPE C,  "Commercial price1
    BKLAS(004) TYPE C,  "Valuation class
    bwkey(004) type c,

  END OF LSMW_MATERIAL_MASTER.


**********************************************************************
*                INTERNAL TABLE DECLARATIONS                         *
**********************************************************************

*to store the input data
DATA:
  BEGIN OF it_matmaster OCCURS 0.
        INCLUDE STRUCTURE LSMW_MATERIAL_MASTER.

DATA:
  END OF it_matmaster.

*for material description
DATA:BEGIN OF IT_MATERIALDESC OCCURS 0.
     INCLUDE STRUCTURE BAPI_MAKT .
DATA:END OF IT_MATERIALDESC.

*FOR gross wt
data: begin of it_uom occurs 0.
      include structure BAPI_MARM.
data:end of it_uom.

DATA: BEGIN OF IT_UOMX OCCURS 0.
      INCLUDE STRUCTURE BAPI_MARMX.
DATA:END OF IT_UOMX.

data:begin of it_mean occurs 0.
     include structure bapi_mean.
data:end of it_mean.

DATA:BEGIN OF IT_MLTX OCCURS 0.
     INCLUDE STRUCTURE BAPI_MLTX.
DATA:END OF IT_MLTX.
*to return messages
DATA:BEGIN OF IT_RETURN OCCURS 0.
     INCLUDE STRUCTURE BAPIRET2.
DATA:END OF IT_RETURN.

************************************************************************
*  SELECTION SCREEN                                                    *
************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-002.

PARAMETERS:P_FILE LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1 .

************************************************************************
* AT SELECTION SCREEN                                                  *
************************************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      PROGRAM_NAME  = SYST-CPROG
      DYNPRO_NUMBER = SYST-DYNNR
      FIELD_NAME    = 'P_FILE'
    IMPORTING
      FILE_NAME     = P_FILE.



**********************************************************************
*                TO UPLOAD THE DATA                                  *
**********************************************************************

START-OF-SELECTION.
V_FILE = P_FILE.
CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    filename                      = V_FILE
   FILETYPE                      = 'ASC'
   HAS_FIELD_SEPARATOR           = 'X'
*   HEADER_LENGTH                 = 0
*   READ_BY_LINE                  = 'X'
*   DAT_MODE                      = ' '
* IMPORTING
*   FILELENGTH                    =
*   HEADER                        =
  tables
    data_tab                      =  IT_MATMASTER
 EXCEPTIONS
   FILE_OPEN_ERROR               = 1
   FILE_READ_ERROR               = 2
   NO_BATCH                      = 3
   GUI_REFUSE_FILETRANSFER       = 4
   INVALID_TYPE                  = 5
   NO_AUTHORITY                  = 6
   UNKNOWN_ERROR                 = 7
   BAD_DATA_FORMAT               = 8
   HEADER_NOT_ALLOWED            = 9
   SEPARATOR_NOT_ALLOWED         = 10
   HEADER_TOO_LONG               = 11
   UNKNOWN_DP_ERROR              = 12
   ACCESS_DENIED                 = 13
   DP_OUT_OF_MEMORY              = 14
   DISK_FULL                     = 15
   DP_TIMEOUT                    = 16
   OTHERS                        = 17
          .
IF sy-subrc &amp;lt;&amp;gt; 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

*ELSE.
*DELETE IT_MATMASTER INDEX 1.
ENDIF.

**********************************************************************
*                DATA POPULATIONS                                    *
**********************************************************************


LOOP AT  IT_MATMASTER.
*HEADER DATA
  BAPIMATHEAD-MATERIAL = IT_MATMASTER-MATNR.
  BAPIMATHEAD-IND_SECTOR = IT_MATMASTER-Mbrsh.
  BAPIMATHEAD-MATL_TYPE = IT_MATMASTER-Mtart.
  BAPIMATHEAD-BASIC_VIEW = 'X'.
  BAPIMATHEAD-PURCHASE_VIEW = 'X'.
  BAPIMATHEAD-ACCOUNT_VIEW = 'X'.
*CLIENTDATA
  BAPI_MARA-MATL_GROUP = IT_MATMASTER-MATKL.
  BAPI_MARA-DIVISION = IT_MATMASTER-SPART.
  BAPI_MARA-DSN_OFFICE = IT_MATMASTER-LABOR.
  BAPI_MARA-PROD_HIER = IT_MATMASTER-PRDHA.
  BAPI_MARA-PUR_STATUS = IT_MATMASTER-MSTAE.
  BAPI_MARA-ITEM_CAT = IT_MATMASTER-MTPOS_MARA.
  BAPI_MARA-NET_WEIGHT = IT_MATMASTER-NTGEW.
*  BAPI_MARA-PO_UNIT = 'KG'.
*  BAPI_MARA-UNIT_OF_WT_ISO = 'KG'.
  BAPI_MARA-UNIT_OF_WT = 'KG'.
*  BAPI_MARA-PACK_VO_UN = 'KG'.
*  BAPI_MARA-BASE_UOM_ISO = 'KG'.
  bapi_mara-size_dim = it_matmaster-groes.
  BAPI_MARA-MAT_GRP_SM = IT_MATMASTER-MAGRV.
  BAPI_MARA-OLD_MAT_NO = IT_MATMASTER-BISMT.
  BAPI_MARA-BASE_UOM = IT_MATMASTER-MEINS.
  BAPI_MARA-BASIC_MATL = IT_MATMASTER-WRKST.
  BAPI_MARA-HAZMATPROF = IT_MATMASTER-PROFL.
  BAPI_MARA-ENVT_RLVT = IT_MATMASTER-KZUMW.
  BAPI_MARA-PO_UNIT = IT_MATMASTER-BSTME.
  BAPI_MARA-VAR_ORD_UN = IT_MATMASTER-VABME.
  BAPI_MARA-PUR_VALKEY = IT_MATMASTER-EKWSL.
  BAPI_MARA-MANU_MAT = IT_MATMASTER-MFRPN.
  BAPI_MARA-MFR_NO = IT_MATMASTER-MFRNR.
  BAPI_MARAX-MATL_GROUP = 'X'.
  BAPI_MARAX-DIVISION = 'X'.
  BAPI_MARAX-DSN_OFFICE = 'X'.
  BAPI_MARAX-PROD_HIER = 'X'.
  BAPI_MARAX-PUR_STATUS = 'X'.
  BAPI_MARAX-ITEM_CAT = 'X'.
  BAPI_MARAX-NET_WEIGHT = 'X'.
  BAPI_MARAX-UNIT_OF_WT = 'X'.
*  BAPI_MARAX-UNIT_OF_WT_ISO = 'X'.
  bapi_maraX-size_dim = 'X'.
  BAPI_MARAX-MAT_GRP_SM = 'X'.
  BAPI_MARAX-OLD_MAT_NO = 'X'.
  BAPI_MARAX-BASE_UOM = 'X'.
  BAPI_MARAX-BASE_UOM_ISO = 'X'.
  BAPI_MARAX-BASIC_MATL = 'X'.
  BAPI_MARAX-MFR_NO = 'X'.
  BAPI_MARAX-HAZMATPROF = 'X'.
  BAPI_MARAX-ENVT_RLVT = 'X'.
  BAPI_MARAX-PO_UNIT = 'X'.
*  BAPI_MARAX-PACK_VO_UN = 'X'.
  BAPI_MARAX-VAR_ORD_UN = 'X'.
  BAPI_MARAX-PUR_VALKEY = 'X'.
  BAPI_MARAX-MANU_MAT = 'X'.
  BAPI_MARAX-MFR_NO = 'X'.

*PLANT DATA

  BAPI_MARC-PLANT = IT_MATMASTER-WERKS.
  BAPI_MARC-PUR_GROUP = IT_MATMASTER-EKGRP.
  BAPI_MARC-BATCH_MGMT = IT_MATMASTER-XCHPF.
  BAPI_MARC-GR_PR_TIME = IT_MATMASTER-WEBAZ.
  BAPI_MARCX-PLANT = IT_MATMASTER-WERKS.
  BAPI_MARCX-PUR_GROUP = 'X'.
  BAPI_MARCX-BATCH_MGMT = 'X'.
  BAPI_MARCX-GR_PR_TIME = 'X'.

*VALUATION DATA
  BAPI_MBEW-PRICE_CTRL = IT_MATMASTER-VPRSV.
  BAPI_MBEW-STD_PRICE = IT_MATMASTER-STPRS.
  BAPI_MBEW-COMMPRICE1 = IT_MATMASTER-BWPRH.
  BAPI_MBEW-VAL_AREA = IT_MATMASTER-BWKEY.
  BAPI_MBEW-VAL_CLASS = IT_MATMASTER-BKLAS.
  BAPI_MBEWX-PRICE_CTRL = 'X'.
  BAPI_MBEWX-STD_PRICE = 'X'.
  BAPI_MBEWX-COMMPRICE1 = 'X'.
  BAPI_MBEWX-VAL_AREA = IT_MATMASTER-BWKEY.
  BAPI_MBEWX-VAL_CLASS = 'X'.
  IT_MATERIALDESC-LANGU = 'EN'.
  IT_MATERIALDESC-MATL_DESC = IT_MATMASTER-MAKTX.
  append IT_materialdesc.
  IT_UOM-GROSS_WT = IT_MATMASTER-BRGEW.
  IT_UOM-ALT_UNIT = 'KG'.
  IT_UOM-ALT_UNIT_ISO = 'KG'.
    IT_UOM-UNIT_OF_WT = IT_MATMASTER-GEWEI.
    APPEND IT_UOM.
  IT_UOMX-GROSS_WT = 'X'.
  IT_UOMX-ALT_UNIT = 'KG'.
  IT_UOMX-ALT_UNIT_ISO = 'KG'.
  IT_UOMX-UNIT_OF_WT = 'X'.


  APPEND IT_UOMX.

  it_mean-unit = 'KD3'.
  append it_mean.

  it_mltx-langu = 'E'.
  it_mltx-text_name = it_matmaster-matnr.
  APPEND IT_MLTX.
  CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
    EXPORTING
      headdata                   = BAPIMATHEAD
      CLIENTDATA                 = BAPI_MARA
      CLIENTDATAX                = BAPI_MARAx
     PLANTDATA                  =  BAPI_MARc
     PLANTDATAX                 =  BAPI_MARcx
*     FORECASTPARAMETERS         =
*     FORECASTPARAMETERSX        =
*     PLANNINGDATA               =
*     PLANNINGDATAX              =
*     STORAGELOCATIONDATA        =
*     STORAGELOCATIONDATAX       =
     VALUATIONDATA              = BAPI_MBEW
     VALUATIONDATAX             = BAPI_MBEWX
*     WAREHOUSENUMBERDATA        =
*     WAREHOUSENUMBERDATAX       =
*     SALESDATA                  =
*     SALESDATAX                 =
*     STORAGETYPEDATA            =
*     STORAGETYPEDATAX           =
*     FLAG_ONLINE                = ' '
*     FLAG_CAD_CALL              = ' '
   IMPORTING
     RETURN                     = IT_RETURN
   TABLES
     MATERIALDESCRIPTION        = IT_MATERIALDESC
     UNITSOFMEASURE             = IT_UOM
     UNITSOFMEASUREX            = IT_UOMX
     INTERNATIONALARTNOS        = it_mean
*     MATERIALLONGTEXT           = IT_MLTX
*     TAXCLASSIFICATIONS         =
*     RETURNMESSAGES             =
*     PRTDATA                    =
*     PRTDATAX                   =
*     EXTENSIONIN                =
*     EXTENSIONINX               =
            .

read table it_return with key TYPE = 'S'.
if sy-subrc = 0.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*   EXPORTING
*     WAIT          =
*   IMPORTING
*     RETURN        =
            .
*else.
*
*CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
** IMPORTING
**   RETURN        =
*          .
*
endif.

 WRITE:/    IT_RETURN-TYPE,
        2   IT_RETURN-ID,
        22  IT_RETURN-NUMBER,
        25  IT_RETURN-MESSAGE.
*            IT_RETURN-LOG_NO,
*            IT_RETURN-LOG_MSG_NO,
*            IT_RETURN-MESSAGE_V1,
*            IT_RETURN-MESSAGE_V2,
*            IT_RETURN-MESSAGE_V3,
*            IT_RETURN-MESSAGE_V4,
*            IT_RETURN-PARAMETER,
*            IT_RETURN-ROW,
*            IT_RETURN-FIELD,
*            IT_RETURN-SYSTEM.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jun 2006 06:58:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410775#M197857</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-30T06:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410776#M197858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;   Have a look at these good links-&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;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/e0/9eb2370f9cbe68e10000009b38f8cf/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/e0/9eb2370f9cbe68e10000009b38f8cf/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/3e/ecf226942511d2ad4b080009b0fb56/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/3e/ecf226942511d2ad4b080009b0fb56/frameset.htm&lt;/A&gt;&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;A href="http://www.sap-img.com/bapi.htm" target="test_blank"&gt;http://www.sap-img.com/bapi.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/bapi-conventions.htm" target="test_blank"&gt;http://www.sap-img.com/abap/bapi-conventions.htm&lt;/A&gt;&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.allsaplinks.com/bapi.html" target="test_blank"&gt;http://www.allsaplinks.com/bapi.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&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="http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm" target="test_blank"&gt;http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm&lt;/A&gt;&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://www.allsaplinks.com/bapi.html" target="test_blank"&gt;http://www.allsaplinks.com/bapi.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="1581757"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="1687142"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.geocities.com/SiliconValley/Campus/6345/abapindx.htm" target="test_blank"&gt;http://www.geocities.com/SiliconValley/Campus/6345/abapindx.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&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://help.sap.com/saphelp_46c/helpdata/en/dd/5009660aa411d2ad1b080009b0fb56/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_46c/helpdata/en/dd/5009660aa411d2ad1b080009b0fb56/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/bapi-conventions.htm" target="test_blank"&gt;http://www.sap-img.com/abap/bapi-conventions.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark useful answers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tanuja.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Tanuja Sarraju&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Tanuja Sarraju&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jun 2006 06:58:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410776#M197858</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-30T06:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410777#M197859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;BAPI_GOODSMVT_CREATE to post Goods Movement &lt;/P&gt;&lt;P&gt;The following is an abap program making used of the BAPI function BAPI_GOODSMVT_CREATE to do Goods Receipts for Purchase Order after importing the data from an external system. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;BAPI TO Upload Inventory Data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;GMCODE Table T158G - 01 - MB01 - Goods Receipts for Purchase Order&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                     02 - MB31 - Goods Receipts for Prod Order&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                     03 - MB1A - Goods Issue&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                     04 - MB1B - Transfer Posting&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                     05 - MB1C - Enter Other Goods Receipt&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                     06 - MB11&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Domain: KZBEW - Movement Indicator&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     Goods movement w/o reference&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; B - Goods movement for purchase order&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; F - Goods movement for production order&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; L - Goods movement for delivery note&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; K - Goods movement for kanban requirement (WM - internal only)&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; O - Subsequent adjustment of "material-provided" consumption&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; W - Subsequent adjustment of proportion/product unit material&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;report zbapi_goodsmovement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters: p-file like rlgrap-filename default&lt;/P&gt;&lt;P&gt;                                 'c:\sapdata\TEST.txt'.&lt;/P&gt;&lt;P&gt;parameters: e-file like rlgrap-filename default&lt;/P&gt;&lt;P&gt;                                 'c:\sapdata\gdsmvterror.txt'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters: xpost like sy-datum default sy-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of gmhead.&lt;/P&gt;&lt;P&gt;        include structure bapi2017_gm_head_01.&lt;/P&gt;&lt;P&gt;data: end of gmhead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of gmcode.&lt;/P&gt;&lt;P&gt;        include structure bapi2017_gm_code.&lt;/P&gt;&lt;P&gt;data: end of gmcode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of mthead.&lt;/P&gt;&lt;P&gt;        include structure bapi2017_gm_head_ret.&lt;/P&gt;&lt;P&gt;data: end of mthead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of itab occurs 100.&lt;/P&gt;&lt;P&gt;        include structure bapi2017_gm_item_create.&lt;/P&gt;&lt;P&gt;data: end of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of errmsg occurs 10.&lt;/P&gt;&lt;P&gt;        include structure bapiret2.&lt;/P&gt;&lt;P&gt;data: end of errmsg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: wmenge like iseg-menge,&lt;/P&gt;&lt;P&gt;      errflag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of pcitab occurs 100,&lt;/P&gt;&lt;P&gt;        ext_doc(10),           "External Document Number&lt;/P&gt;&lt;P&gt;        mvt_type(3),           "Movement Type&lt;/P&gt;&lt;P&gt;        doc_date(8),           "Document Date&lt;/P&gt;&lt;P&gt;        post_date(8),          "Posting Date&lt;/P&gt;&lt;P&gt;        plant(4),              "Plant&lt;/P&gt;&lt;P&gt;        material(18),          "Material Number&lt;/P&gt;&lt;P&gt;        qty(13),               "Quantity&lt;/P&gt;&lt;P&gt;        recv_loc(4),           "Receiving Location&lt;/P&gt;&lt;P&gt;        issue_loc(4),          "Issuing Location&lt;/P&gt;&lt;P&gt;        pur_doc(10),           "Purchase Document No&lt;/P&gt;&lt;P&gt;        po_item(3),            "Purchase Document Item No&lt;/P&gt;&lt;P&gt;        del_no(10),            "Delivery Purchase Order Number&lt;/P&gt;&lt;P&gt;        del_item(3),           "Delivery Item&lt;/P&gt;&lt;P&gt;        prod_doc(10),          "Production Document No&lt;/P&gt;&lt;P&gt;        scrap_reason(10),      "Scrap Reason&lt;/P&gt;&lt;P&gt;        upd_sta(1),            "Update Status&lt;/P&gt;&lt;P&gt;      end of pcitab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'WS_UPLOAD'&lt;/P&gt;&lt;P&gt;  exporting&lt;/P&gt;&lt;P&gt;    filename                      = p-file&lt;/P&gt;&lt;P&gt;    filetype                      = 'DAT'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FILELENGTH                    =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  tables&lt;/P&gt;&lt;P&gt;    data_tab                      = pcitab&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FILE_OPEN_ERROR               = 1&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FILE_READ_ERROR               = 2&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  NO_BATCH                      = 3&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  GUI_REFUSE_FILETRANSFER       = 4&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  INVALID_TYPE                  = 5&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  OTHERS                        = 6&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          .&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;  message id sy-msgid type sy-msgty number sy-msgno&lt;/P&gt;&lt;P&gt;          with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;  exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gmhead-pstng_date = sy-datum.&lt;/P&gt;&lt;P&gt;gmhead-doc_date = sy-datum.&lt;/P&gt;&lt;P&gt;gmhead-pr_uname = sy-uname.&lt;/P&gt;&lt;P&gt;gmcode-gm_code = '01'.   "01 - MB01 - Goods Receipts for Purchase Order&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at pcitab.&lt;/P&gt;&lt;P&gt;  itab-move_type  = pcitab-mvt_type.&lt;/P&gt;&lt;P&gt;  itab-mvt_ind    = 'B'.&lt;/P&gt;&lt;P&gt;  itab-plant      = pcitab-plant.&lt;/P&gt;&lt;P&gt;  itab-material   = pcitab-material.&lt;/P&gt;&lt;P&gt;  itab-entry_qnt  = pcitab-qty.&lt;/P&gt;&lt;P&gt;  itab-move_stloc = pcitab-recv_loc.&lt;/P&gt;&lt;P&gt;  itab-stge_loc   = pcitab-issue_loc.&lt;/P&gt;&lt;P&gt;  itab-po_number  = pcitab-pur_doc.&lt;/P&gt;&lt;P&gt;  itab-po_item    = pcitab-po_item.&lt;/P&gt;&lt;P&gt;  concatenate pcitab-del_no pcitab-del_item into itab-item_text.&lt;/P&gt;&lt;P&gt;  itab-move_reas  = pcitab-scrap_reason.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  append itab.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;  write:/ itab-material, itab-plant, itab-stge_loc,&lt;/P&gt;&lt;P&gt;          itab-move_type, itab-entry_qnt, itab-entry_uom,&lt;/P&gt;&lt;P&gt;          itab-entry_uom_iso, itab-po_number, itab-po_item,&lt;/P&gt;&lt;P&gt;                                              pcitab-ext_doc.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'BAPI_GOODSMVT_CREATE'&lt;/P&gt;&lt;P&gt;  exporting&lt;/P&gt;&lt;P&gt;    goodsmvt_header             = gmhead&lt;/P&gt;&lt;P&gt;    goodsmvt_code               = gmcode&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  TESTRUN                     = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    goodsmvt_headret            = mthead&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  MATERIALDOCUMENT            =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  MATDOCUMENTYEAR             =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  tables&lt;/P&gt;&lt;P&gt;    goodsmvt_item               = itab&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  GOODSMVT_SERIALNUMBER       =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    return                      = errmsg&lt;/P&gt;&lt;P&gt;          .&lt;/P&gt;&lt;P&gt;clear errflag.&lt;/P&gt;&lt;P&gt;loop at errmsg.&lt;/P&gt;&lt;P&gt;  if errmsg-type eq 'E'.&lt;/P&gt;&lt;P&gt;    write:/'Error in function', errmsg-message.&lt;/P&gt;&lt;P&gt;    errflag = 'X'.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    write:/ errmsg-message.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if errflag is initial.&lt;/P&gt;&lt;P&gt;  commit work and wait.&lt;/P&gt;&lt;P&gt;  if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;    write:/ 'Error in updating'.&lt;/P&gt;&lt;P&gt;    exit.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    write:/ mthead-mat_doc, mthead-doc_year.&lt;/P&gt;&lt;P&gt;    perform upd_sta.&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;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      FORM UPD_STA                                                  *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      ........                                                      *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form upd_sta.&lt;/P&gt;&lt;P&gt;  loop at pcitab.&lt;/P&gt;&lt;P&gt;    pcitab-upd_sta = 'X'.&lt;/P&gt;&lt;P&gt;    modify pcitab.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call function 'WS_DOWNLOAD'&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      filename                      = p-file&lt;/P&gt;&lt;P&gt;      filetype                      = 'DAT'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FILELENGTH                    =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    tables&lt;/P&gt;&lt;P&gt;      data_tab                      = pcitab&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FILE_OPEN_ERROR               = 1&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  FILE_READ_ERROR               = 2&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  NO_BATCH                      = 3&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  GUI_REFUSE_FILETRANSFER       = 4&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  INVALID_TYPE                  = 5&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  OTHERS                        = 6&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- End of Program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Subhasish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jun 2006 07:02:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410777#M197859</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-30T07:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410778#M197860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Check this code for creating a business partner..&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Creating Business Partner&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL FUNCTION 'BAPI_BUPA_CREATE_FROM_DATA'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      partnercategory         = lc_2            "Organization&lt;/P&gt;&lt;P&gt;      partnergroup            = lc_par_grp      "Internal no. assignment&lt;/P&gt;&lt;P&gt;      centraldata             = wa_centraldata&lt;/P&gt;&lt;P&gt;      centraldataorganization = wa_centraldataorg&lt;/P&gt;&lt;P&gt;      addressdata             = wa_addressdata&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      businesspartner         = lv_customer&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      return                  = lit_return1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Binary search not used as no. of records are less than 15&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  READ TABLE lit_return1 INTO wa_return1 WITH KEY type = gc_error.&lt;/P&gt;&lt;P&gt;  IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    CLEAR lv_customer.&lt;/P&gt;&lt;P&gt;    CONCATENATE text-008 wa_return1-message INTO lv_err_desc&lt;/P&gt;&lt;P&gt;                                             SEPARATED BY space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tanveer.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Please mark helpful answers&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jun 2006 07:09:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410778#M197860</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-30T07:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410779#M197861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi friends,&lt;/P&gt;&lt;P&gt;           thanks to everyone. now i got  it. if i have doubts i get back to all.&lt;/P&gt;&lt;P&gt;                           chandu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jun 2006 07:10:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410779#M197861</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-30T07:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410780#M197862</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 appreciate the time spent by each of the people who have answered your question. Please mark the helpful answers and close the thread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jun 2006 07:13:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410780#M197862</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-30T07:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410781#M197863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi friends,&lt;/P&gt;&lt;P&gt;           thanks to everyone. now i got  it. if i have doubts i get back to all.&lt;/P&gt;&lt;P&gt;                           chandu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jun 2006 07:20:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi/m-p/1410781#M197863</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-30T07:20:00Z</dc:date>
    </item>
  </channel>
</rss>

