FM to create a new item in Purchase Order

Hi Experts,
I am using BAPI_PO_CREATE to create PO's from frontend. Now I want to create a new item in same PO which i have created earlier, the way we can do in me21n. I think i cant do this through BAPI_PO_CREATE FM. Can anybody pls help me regarding this.
Waiting for ur valuable guidance..
Regards,
Rajesh

Hi,
USE BAPI_PO_CHANGE.
Ex code:
CALL FUNCTION 'BAPI_PO_CHANGE'
    EXPORTING
      purchaseorder = ws_podetls-ebeln
      poheader      = ws_poheader
      poheaderx     = ws_poheaderx
    TABLES
      return        = ws_return
      poitem        = ws_poitem[]
      poitemx       = ws_poitemx[]
      potextitem    = ws_potextitem[].
  IF sy-subrc NE 0.
No sy-subrc check is required
  ENDIF.                               " IF SY-SUBRC NE 0
  IF ws_return-type EQ wc_message_s OR
     ws_return-type EQ wc_message_w OR
     ws_return-type EQ wc_message_i.
To commit the transation for succesfull records
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait = wc_x.
    PERFORM 0002_populate_istatus.
    IF sy-subrc NE 0.
No sy-subrc check is required
    ENDIF.                             " IF SY-SUBRC NE 0
  ELSE.
    LOOP AT ws_return.
      IF ws_return-type EQ wc_message_e.
        MOVE:
           wc_color_red TO o_status-lights,
           ws_return-message TO o_status-message,
           ws_poheader-po_number TO o_status-ebeln.
    Reading the ws_poitem table for error messages.
        READ TABLE ws_poitem1 INDEX ws_return-row.
        IF sy-subrc EQ 0.
          MOVE:
            ws_poitem1-po_item TO o_status-ebelp.
        ENDIF.                         " IF SY-SUBRC = 0
        APPEND o_status.
        CLEAR o_status.
      ENDIF.                           " IF ws_return-type..
    ENDLOOP.                           " LOOP AT WS_RETURN
To rollback the transation for error records
    CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
    IF sy-subrc NE 0.
No sy-subrc check is required
    ENDIF.                             " IF SY-SUBRC NE 0
  ENDIF.                               " IF ws_return-type EQ 'S'
Amresh.

Similar Messages

  • Creating Commitment Items In Purchase Order Level

    Hi Friend,
                    I need some information on How to create commitment items  at Purchase Order item level. Any  BADI's,  please suggest me.
    Thanks in Advanced
    Shiv'.

    Hi dude ,
    Here i am not suppose to  create any new tab at item level , could you  little bit clear............,
    Thanks .
    Shiv'.

  • How can i create a new item in the app "health"?

    how can i create a new item in the app "health"? I need a field for documentation of "Waist-to-height ratio", exactly for "circumference".
    It's a matter of common knowledge, that the Waist-to-height ratio (WHtR) has more significance then the Body-Mass-Index (BMI).

    If you mean you want to change a color of a calendar category or create a new one, you cannot do that, what is pre-loaded is what you get and cannot be edited.

  • Creating a new item in application Personalize Page

    Hi all,
    I've created a new item from the application's personalize page. There are a few questions I want to ask about this new item I've created.
    1. I know that the page has different regions as there is more than one controller class for that page(visually). If I use oapagecontext.getParameter("Item ID"), will that give me the item's value even if it is in a different controller?
    2. When I create a new item using the application's personalize page, does it automatically update the relevant xml in $FND_TOP/mds repository? Or does it only update it during run time?
    Cheers

    Hi there,
    it still seems unable to do what i want. The code I'm using right now is this
    I've created a new MessageTextInput item from the application and gave it the ID of xxActiveTo. I also made the view attribute of "ActiveTo" and attribute set of /oracle/apps/jtf/resource/attributesets/JtfRsResourceExtns/EndDateActive.
    **code **
    String temp = oapagecontext.getParameter("xxActiveTo");
    if (temp != "22-Aug-2006")
    setforwardurl (xxxxxx);
    When i see the field I enter 22-Aug-2006 and then press the button. However, it always forwards to the url as in setforwardurl.
    I know I'm getting the wrong value but I don't exactly know why
    Please help

  • Error message: Warning 20225. Adobe Acrobat 7.0 Setup was unable to create a new item: Adobe PDF Por

    Error message: Warning 20225. Adobe Acrobat 7.0 Setup was unable to create a new item: Adobe PDF Port-Printer. The Adobe PDF Printer may be unavailable. I'm using the original CD to set up

    And on what system? Acrobat 7 is not compatible with Windows 7, if that's what you are using. You need to upgrade then.
    Mylenium

  • Creating inbound delivery for the purchase order line items

    Hi Experts,
    Please let me know how can I create inbound delivery for the purchase order line items?  Say, I have a purchase order with 5 line items in it.  I wanted to create an inbound delivery for only 2 line items at this point of time.  Which SAP Standard transaction I have to use and what all  data I need to populate?  I would appreciate any help on this and will reward the right answer.  Please let me know.
    Thank you in advance.
    with regards,
    Muthu Ganapathy.

    Hi,
    While creating the inbound delivery (VL31N), intially all the items will be shown, see the advance shipping notfication - from the vendor for which he has send confirmation & rest items you can delete simply & save. & next time when the vendor sends rest advance shipping notifcation (confirmation), you can receive them.
    Hope this answers your query.
    Regards
    Irfan.

  • Formatted Search to imput TaxGroup Automatically when create a new item

    I create a FMS to imput the taxgroup when create a new item. But when execute the FMS this show a list  of values. Whats a problem?
    declare @iva5 VARCHAR(10)
    declare @iva12 VARCHAR(10)
    declare @iva21 VARCHAR(10)
    set @iva5='D1'
    set @iva12='D2'
    set @iva21='D3'
    SELECT CASE
    WHEN T0.ITMSGRPCOD IN ('107','108','109','110','111','116') THEN @iva21
    WHEN T0.ITMSGRPCOD IN ('112','113','114','115') THEN @iva12
    WHEN T0.ITMSGRPCOD IN ('105','106') THEN @iva12
    ELSE @iva12 END
    FROM OITM T0

    You should refer to the actual item's item group value:
    declare @iva5 VARCHAR(10)
    declare @iva12 VARCHAR(10)
    declare @iva21 VARCHAR(10)
    set @iva5='D1'
    set @iva12='D2'
    set @iva21='D3'
    SELECT CASE
    WHEN $[OITM.ITMSGRPCOD] IN ('107','108','109','110','111','116') THEN @iva21
    WHEN $[OITM.ITMSGRPCOD] IN ('112','113','114','115') THEN @iva12
    WHEN $[OITM.ITMSGRPCOD] IN ('105','106') THEN @iva12
    ELSE @iva12 END

  • Does Anyone know how to add a new partner to purchase order created on VI01/VI02?

    Does Anyone know how to add a new partner to purchase order created on VI01/VI02?
    Please, anyone knows that?
    Regards.
    Rafael.

    Anyone?

  • New items to purchase requisitions

    Hi all,
    I want to add new items to purchase requisitions, which bapi or function can I use?
    I tried BAPI_PR_CHANGE and BAPI_REQUISITION_CHANGE, but these functions didn't work for new items..
    Thanks..

    Hi,
    You can use FM ME_UPDATE_REQUISITION for updating the purchase requisitions.
    You have to pass XPREXT-KZ = 'U' as import paramter along PR number as import paramter.
    Rest data can be passed to corresponding tables.
    Hope this solves your query.
    Regards,
    Brajvir

  • Alternative items on Purchase Order

    Hi Experts:
        I have a question regarding the alternative items on Purchase order. If alternative item A2 is setup for item A1 from Vendor XYZ, and if we place a PO with XYZ for item A1 but they ship item A2: can we receive A2 in stock on the initial PO for A1? Dose SAP have these kind of solutions?
    Thanks and best regards
    Xincheng JIN

    Hi,
    there is one good solution for this sort of requirement...However, the limitations are there; may be suitable for example, we order for envelopes from vendor.  You may order for one type of envelope and vendor may send other type...size may be the same, one envelope with window for address and other type may not have a window....similar such situations can be easily address using the standard SAP's below example: (I implemented this already in 2 projects previously)
    http://help.sap.com/saphelp_47x200/helpdata/en/9f/fb79385feddf6ae10000009b38f8cf/frameset.htm
    Example: Configurable Materials in Purchasing
    You are responsible for procuring office supplies for your company, including envelopes. A printing firm supplies you with envelopes featuring your company logo in various sizes, with or without an address window.
    In order not to have to create separate material master records for every possible combination (e.g. C5 with window, C6 without window), you wish to use a configurable material.
    You must carry out the following activities for a configurable material:
    Create characteristics
    Create class
    Create material
    Create configuration profile
    Create Characteristics
    You define the criteria you use to differentiate between the variants of a material (in this case, the size of the envelope and the address window) by means of characteristics. You must create a characteristic for each criterion under Logistics ® Central Functions ® Classification System ® Master Data ® Characteristics Management.
    Characteristic: Size of envelope
    Enter size_of_envelope in the field Characteristic.
    Choose Create.
    Enter the following data on the tab page Basic Data:
    · Description: Size of envelopes
    · Data type: Character format
    · Number of characters: 20
    This indicates how many characters a characteristic value may comprise.
    · Select the Single value indicator in the area Value assignment.
    If you set the Single value indicator, one value only may be assigned to the characteristic. For example, only one size may be chosen when you specify the dimensions of the envelopes that are to be ordered in a PO.
    Enter the following data on the tab page Values:
    · Enter possible values for the characteristic:
    Characteristic value
    Description
    DIN C4
    229 mm x 324 mm
    DIN C5
    229 mm x 162 mm
    DIN "Langhülle"
    218 mm x 114 mm
    DIN C6
    162 mm x 114 mm
    · Select the Additional values indicator.
    If this indicator is selected, you may also specify values that you have not yet defined here when assigning values to the characteristic.
    Choose the class type 300 (variants) on the tab page Restrictions.
    Choose Save.
    Characteristic: Address window in envelope
    Enter window_in_envelope in the field Characteristic.
    Choose Create.
    Enter the following data on the tab page Basic Data:
    · Description: Address window in envelopes
    · Data type: Character format
    · Number of characters: 4
    · Select the Single value indicator in the area Value assignment.
    Enter the following data on the tab page Values:
    · Values of characteristic: yes , no
    · Do not select the Additional values indicator.
    Choose the class type 300 (variants) on the tab page Restrictions.
    Choose Save.
    Create Class
    You group several characteristics to form a class. The class is then assigned to a material.
    Choose Logistics ® Central functions ® Classification system ® Master data ® Class management.
    Enter the following data on the initial screen:
    · Class : Envelope
    · Class type: 300 (variants)
    Choose Create.
    Enter a short description of the class in the Description field on the tab page Basic data: Envelopes with company logo.
    On the tab page Characteristics, enter the characteristics you created previously: size_of_envelope, window_in_envelope .
    Choose Save.
    Create Material
    Choose Logistics ® Materials management ® Material master ® Create material ® Create (general) ® Immediately.
    Enter the following data:
    · Material: Envelope
    · Industry sector: Office supplies
    · Material type: Configurable material
    Choose Enter.
    Choose the views Basic Data 1, Basic Data 2, Purchasing, and Accounting 1.
    Enter plant 0001.
    Enter the following data on the tab page Basic Data 1:
    · Short description of the material: Envelopes with company logo
    · Base unit of measure: KI (box)
    · Material group: Office supplies
    On the tab page Basic Data 2, check whether the Material is configurable is selected.
    On the tab page Purchasing, select the Subject to batch management indicator.
    On the tab page Accounting 1, enter the following data:
    · Valuation class:
    · Price control: V
    · Moving average price: 99.95
    Choose Save.
    Create Configuration Profile
    In the configuration profile, you assign characteristics to the material via a class.
    Choose Logistics ® Central functions ® Variant configuration ® Configuration profile ® Create.
    Select Material and choose Enter .
    Enter envelope in the field Material.
    Choose Goto ® Profile overview.
    Enter the following data:
    · Priority: 01
    · Profile name: Envelopes
    · Class type: 300 (variants)
    Choose Goto ® Class assignment and enter envelope in the Class field.
    Choose Save.
    Use in Purchasing
    You can now create, change and display this configurable material in all purchasing documents.
    Display
    If a configuration already exists for the material, you can display it in the purchasing document.
    Change
    If the configuration of the material was adopted from a sales order or from the material master record, you can change it in the purchasing document. This may be necessary if a material with the selected characteristic value cannot be supplied (is not available) and has to be changed to the material in the quotation.
    If you change the configuration of a material in the purchasing document:
    A new price determination process is carried out
    You do not change the original configuration in the sales order or in the material master record as a result
    Subsequent changes to the sales order or the material master record do not affect the configuration in the purchasing document
    Create
    If no configuration yet exists for a configurable material, you can create one in the purchasing document. This may be necessary, for example, if a configurable material is to be ordered without reference to a sales order.
    Subcontracting items and the archiving of the characteristic values are not supported.
    For more information on configurable materials, refer to the section  LO Variant Configuration.

  • Create a new field in sales order

    HI folks i want to create a new field in sales order item level how can i create

    Hi,
    Hope this will help you,
    User exits in the screens
    Additional header data is on screen SAPMV45A 0309, additional item data on screen SAPMV45A 0459. These screens contain the Include screens SAPMV45A 8309 or SAPMV45A 8459 as user exits.
    Fields which are also to be included in the sales document for a specific installation should be included on the Include screens for maintaining. If an application-specific check module is needed for the fields, this can be included in the Include MV45AIZZ. The module is called up in the processing logic of the Include screens.
    For field transports, you do not have to make changes or adjustments.
    Example
    A new field, VBAK-ZZKUN, should be included in table VBAK.
    If the check is defined via the Dictionary (fixed values or check table) the field must be included with the fullscreen editor in the Include screen SAPMV45A 8309. In this case, no change has to be made to the processing logic.

  • "All items from purchase order cannot be invoiced"

    Hello,<br />
    <br />
    I'm on a SRM 7.0 SP 5 system (ext-classic scenario). Here i try to create an invoice with reference to a Purchase Order, but none of my Purchase Orders can be used for reference. I get the following warning message 'All items from purchase order cannot be invoiced'.<br />
    <br />
    - Created via POWL (create with reference -&gt; invoice/credit memo) i always get the warning message 'All items from purchase order cannot be invoiced'. And no items are converted / can be used for invoicing. Additionally when i use the search option 'find purchase order' within the create invoice transaction i can not find any purchase order to use, it shows 'There is no search result' while there are plenty purchase orders marked with 'invoice expected'.<br />
    <br />
    I am able to create invoices without reference.<br />
    <br />
    I tried vendors set up only for 'invoice expected' and 'GR', 'invoice expected' / 'GR' / 'GR-based-IV' and 'invoice expected' only none of them works, indicators set on vendor master are correctly used on the created purchase order. Outputting PO doesn't make any difference neither.<br />
    <p />
    I have not set up the following (do i need to?):<br />
    - Deactivated the 'CRME' transaction type, no Credit Memo transaction type has been configured/is active.<br />
    - I have not defined the 'INV' transaction type as a follow-on document for my ECPO transaction type within the define transaction type transaction.<br />
    - Tollerances<br />
    <br />
    <b>edit</b> -&gt; i've already searched thorougly for SAP notes but no note seems to cover this particular problem.<br />
    <br />
    Help is very much appreciated

    Solved! Added SYS attribute for back-end system in organisational scheme.

  • How to restrict the user to enter the item in purchase order?

    I want to restrict user to enter the item in purchase order.
    How can i do this?
    Please help
    Abhishek

    Hi,
       You may create a transaction variant for ME21N in SHD0 transaction. Make the item field as output only as shown below:
    Result:
       You may check the doc: Learning SHD0 with Example
    Regards,
    AKPT

  • Delete item from Purchase Order

    Dear All,
    I want to cancel line item from Purchase Order.
    But  i am unable to do it as i have already made advance payment against PO/Item.
    Actually advance payment was against another Item of PO but by mistake selected wrong item while f-47.
    Now i want to delete item for which made avance payment and transfer advance payment with another PO item.
    How to do it.
    Regards
    Swati

    Hi,
    Your Issue
    Lets say, you have created two items in a PO, and made adv payment against item 10 instead of 20.
    Now you want to delete the item 10---
    Solution
    I hope you have not done any GRN to both items (10 & 20) of your PO.
    Then make your item 10 as same as your item 20. (Do change the material code, order qty, price etc)
    Then delete the item 20.
    So with this, you have made your errorised PO item as actual item, and deleting yout actual PO item as errorised item.
    This is as good as swaping the items from one item to another item in the same PO.
    This will resolve your issue.
    Thanks,
    Srinu

  • Call BAPI_GOODSMVT_CREATE to create a goods receipt for purchase order

    Hi,
    I'm calling the bapi BAPI_GOODSMVT_CREATE to create a goods receipt for purchase order, but the following code doesn't work. It doesn't give me any kind of error message but it does nothing as well...
    Can anyone help me please?
    Thank You
    Hugo
    Code
    DATA: wa_goodsmvt_header  LIKE bapi2017_gm_head_01,
                            wa_goodsmvt_code    LIKE bapi2017_gm_code,
                            wa_bapi2017_gm_head TYPE bapi2017_gm_head_ret-mat_doc.
                      DATA: it_goodsmvt_item LIKE bapi2017_gm_item_create OCCURS  0 WITH HEADER LINE,
                            it_return        LIKE bapiret2 OCCURS  0 WITH HEADER LINE.
                      wa_goodsmvt_header-pstng_date = SY-DATUM.
                      wa_goodsmvt_header-doc_date   = SY-DATUM.
                      wa_goodsmvt_header-ref_doc_no = '4500000020'.
                      wa_goodsmvt_code-gm_code = '01'.          "Goods receipt for purchase Order
                      it_goodsmvt_item-stge_loc  = 'BPF2'.
                      it_goodsmvt_item-move_type = '101' .
                      it_goodsmvt_item-entry_qnt = 17.
                      it_goodsmvt_item-entry_uom = 'KG'.
                      it_goodsmvt_item-mvt_ind   = 'B'.
                      it_goodsmvt_item-po_number = '4500000020'.
                      it_goodsmvt_item-po_item   = '00010'.
                      it_goodsmvt_item-material  = '50'.
                      APPEND it_goodsmvt_item.
                      CALL FUNCTION  'BAPI_GOODSMVT_CREATE'
                        EXPORTING
                          goodsmvt_header  = wa_goodsmvt_header
                          goodsmvt_code    = wa_goodsmvt_code
                        IMPORTING
                          materialdocument = wa_bapi2017_gm_head
                        TABLES
                          goodsmvt_item    = it_goodsmvt_item
                          return            = it_return.
                        data: begin of errmsg occurs 10.
                                include structure bapiret2.
                        data: end of errmsg.
                        data: wmenge like iseg-menge,
                              errflag.
                        clear errflag.
                        loop at errmsg.
                          if errmsg-type eq 'E'.
                            write:/'Error in function', errmsg-message.
                            errflag = 'X'.
                          else.
                            write:/ errmsg-message.
                          endif.
                        endloop.
                        if errflag is initial.
                          commit work and wait.
                          if sy-subrc ne 0.
                            write:/ 'Error in updating'.
                            exit.
                          else.
                            write:/ 'Ok'.
                          endif.
                        endif.
                        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
                        EXPORTING
                        wait = ' '.

    Hi,
    Thank you for the asnwer! I'm a rookie at ABAP so please forgive my stupid questions
    I've changed the code to:
    DATA: wa_goodsmvt_header  LIKE bapi2017_gm_head_01,
                            wa_goodsmvt_code    LIKE bapi2017_gm_code,
                            wa_bapi2017_gm_head TYPE bapi2017_gm_head_ret-mat_doc.
                      DATA: it_goodsmvt_item LIKE bapi2017_gm_item_create OCCURS  0 WITH HEADER LINE,
                            it_return        LIKE bapiret2 OCCURS  0 WITH HEADER LINE.
                      wa_goodsmvt_header-pstng_date = SY-DATUM.
                      wa_goodsmvt_header-doc_date   = SY-DATUM.
                      wa_goodsmvt_header-ref_doc_no = '4500000020'.
                      wa_goodsmvt_code-gm_code = '01'.          "Goods receipt for purchase Order
                      it_goodsmvt_item-plant     = 'BP01'.
                      it_goodsmvt_item-stge_loc  = 'BPF2'.
                      it_goodsmvt_item-move_type = '101' .
                      it_goodsmvt_item-entry_qnt = 10.
                      it_goodsmvt_item-entry_uom = 'KG'.
                      it_goodsmvt_item-mvt_ind   = 'B'.
                      it_goodsmvt_item-po_number = '4500000020'.
                      it_goodsmvt_item-po_item   = '10'.
                      it_goodsmvt_item-material  = '50'.
                      APPEND it_goodsmvt_item.
                      CALL FUNCTION  'BAPI_GOODSMVT_CREATE'
                        EXPORTING
                          goodsmvt_header  = wa_goodsmvt_header
                          goodsmvt_code    = wa_goodsmvt_code
                        IMPORTING
                          materialdocument = wa_bapi2017_gm_head
                        TABLES
                          goodsmvt_item    = it_goodsmvt_item
                          return            = it_return.
                          write:/ it_return-message.
    And the return message is : Material document data and PO data do not match (Material)
    Any idea of what might be the problem?
    Thanks

Maybe you are looking for