Change Purchase Requisition

I'm trying to change the Purchase Requisition data, so, as a first test, I'm trying to invoke the change method but actually not changing a thing.
I'm getting an error '80040e21' when I call the BapiChange.
Does anybody knows what might be the problem?
The code follows below:
<%
  Dim oBAPI
  Dim objRequisitionItemsOld
  Dim objRequisitionItemsNew
  Dim objRequisitionAccountOld
  Dim objRequisitionAccountNew
  Dim objRequisitionTextOld
  Dim objRequisitionTextNew
  Dim objReturnChange
  ' get detail objects
  Dim sNum
  Dim objsRequisitionAccountAs
  Dim objReturnGetDetail
  Set objRequisitionItemsOld = Nothing
  Set objRequisitionItemsNew = Nothing
  Set objRequisitionAccountOld = Nothing
  Set objRequisitionAccountNew = Nothing
  Set objRequisitionTextOld = Nothing
  Set objRequisitionTextNew = Nothing
  Set objReturnChange = Nothing
  Set objsRequisitionAccountAs = Nothing
  Set objReturnGetDetail = Nothing
  sNum = "0000000001"
  ' Connect to business object PurchaseRequisition
  Set oBAPI  = CreateObject("SAP.PurchaseRequisition.1")
  oBAPI.Destination = "DCOM-DESTINATION"
  oBAPI.InitKeys(sNum)
  oBAPI.BapiGetDetail objRequisitionItemsOld, ,"X", , objsRequisitionAccountAs, objRequisitionTextOld, , , , objReturnGetDetail
  Set objRequisitionItemsNew = objRequisitionItemsOld
  Set objRequisitionAccountNew = objRequisitionAccountOld
  Set objRequisitionTextNew = objRequisitionTextOld
  oBapi.BapiChange objRequisitionItemsOld, objRequisitionItemsNew, objRequisitionAccountOld, objRequisitionAccountNew, objRequisitionTextOld, objRequisitionTextNew, objReturnChange
%>

Hi Leonardo,
I never used <whatever language this is>, but I see a difference in parameter definition of function modules BAPI_REQUISITION_GETDETAIL and BAPI_REQUISITION_CHANGE.
In FM ...getdetail table REQUISITION_ITEMS is of structure  BAPIEBAN (120 fields), in FM ...change table REQUISITION_ITEMS_OLD is of structure BAPIEBANV (34 fields).
Maybe there is an automatic conversion - maybe you have to define two different sets of variables and convert result of FM ...getdetail yourself for input in FM ...change.
Regards,
Christian

Similar Messages

  • Change Purchase Requisition Document Type when item category is D

    Hi experts,
    i have problem, when i put servis number in to the servis line i havent change Purchase Requisition Document Type. Account
    Assignment Category is K and Item Category is D. It is standard of Purchase Requisition? When i set that i can change document type when item category is D.
    When i putting only material i can change Purchase Requisition Document.
    Thx for your answer.
    Laco

    Hi,
    One thing please note that once you select the document type and draft the PR and save the PR, you will  get the doc number.
    Once you get the document number you cannot change the PR document type .
    The reason is document type is linked with number range so it cannot be changed because different seriers of document number is assined to differentdocument type. 
    And moreover document type is linked with the screen settings also. So I would request you to check the settings for each doc. type

  • BADI in ME52N Change Purchase Requisition

    Dear All,
      I am working on ME52N (Change Purchase Requisition). I got the ME_PROCESS_REQ_CUST  BADIu2019s  in ME52N. I need to initialize the Purchase Requisition Number in ME52N Screen before ME52N screen is displayed.
    Can any suggest where shoul I clear the Parameter id(BAN).
    Regard,
    V.S.Naidu.

    Hi,
    Refer:
    * BAPI to change the PR details
        CALL FUNCTION 'BAPI_REQUISITION_CHANGE'
          EXPORTING
            number                = v_banfn            "<--PR Number
          TABLES
            requisition_items_old = it_old_detail      "<--pass in old PR details
            requisition_items_new = it_new_detail      "<--pass in new PR details
            return                = it_return_change.  "<--return table
    *   "read for error message while changing details for PR
        READ TABLE it_return_change INTO wa_return_change WITH KEY type = 'E'.
        IF sy-subrc = 0.
          "check for ERROR
        ENDIF.
    Hope this helps you.
    Regards,
    Tarun

  • Change Purchase Requisition Price after assigned to Quotation

    Hello.
    I created purchase requisition and assigned to Quotation.
    It if possible change purchase requisition price when is already assigned to Quotation?
    The item price is display and don't let me apply changes.
    Regards,
    Hector.

    Hello.
    I did not converted the Purchase Requsition in Purchase Order.
    I just running a Test Script, and after assigned a Quotation, the vendor sent me some price changes.
    When I call the requisition, the system don't let me change any price.
    I believe there is a good reason for that, but I need to read it.
    If anyone knows any documentation available, please let me know.

  • Error in Bapi : Change Purchase Requisition

    Dear All,
    We have requirement where we need to update the Purchase Requisition Quanity.
    For this purpose, I am using Bapi  '/AFS/CHANGE_AFS_PR_DATA'.
    In this I want to change Sheduled Qty. (AFS Grid Qty.), but I m getting error like
    "Line item 0010 : different quantities in item  and schedule line". (Sy-subrc = 3)
    Can any one help me out with this.
    Thanks in advance.
    Regards ,
    Vishal.

    Hi,
    Refer:
    * BAPI to change the PR details
        CALL FUNCTION 'BAPI_REQUISITION_CHANGE'
          EXPORTING
            number                = v_banfn            "<--PR Number
          TABLES
            requisition_items_old = it_old_detail      "<--pass in old PR details
            requisition_items_new = it_new_detail      "<--pass in new PR details
            return                = it_return_change.  "<--return table
    *   "read for error message while changing details for PR
        READ TABLE it_return_change INTO wa_return_change WITH KEY type = 'E'.
        IF sy-subrc = 0.
          "check for ERROR
        ENDIF.
    Hope this helps you.
    Regards,
    Tarun

  • Changing purchase requisition with processing status B

    How can I restrict purchase requisition changes with processing status B regardless release indicator. Rel 4.7

    Hi Mitra,
    You will find your answer here.
    MRP controller for PR document type
    Do let me know if it helped, as I might have to explore this option for an upcoming requirement.
    Thanks
    Shailesh

  • Problems with event when changing Purchase Requisition. (BO:BUS2009)

    Hi experts,
    I have a doubt with this. When i erase a position in the Purchase Requisition (ME52N), the event SIGNIFICANTLYCHANGED of BUS2009 is raised.
    When I try to modify the  Purchase Requisition not erasign the position but changing the Material group the event is not raised. Can i customize the system to define that changing the Material group is a significantly change for my system? If not, can i raise another event when this happens?
    Thanks!!
    Artur.

    Hi,
    Simply create a custom event called CHANGED in the BO.
    Create a entry for this event in SWEC tcode. Select the radio button on change.
    This should do the job.
    Note : This event will be raised for any kind of changes in this purchase requisition.
    Regards,
    Raj

  • FM to change Purchase Requisition processing status

    Dear experts,
    Any idea what is the function module that is being called to change the PR processing status?
    ie. When a PC is created from the PR, the PR processing status will be changed to "PC created".
    Thanks.
    Regards
    Earl

    Use BAPI_REQUISITION_CHANGE

  • Change purchase requisition item number

    Hi,
    I want to copy an existing line item in the PR but, also I want to assign it the item number. Right now this field is display only for existing line items.
    Example:
    I have one line item with item number 10. Item number can not be changed (display only). Then I select the line item and click on "copy item" button.
    The new line item is created but, the item number can not be changed (default is 20).
    I looked for some fields in field status group but this field is not available for PR's.
    How can I change the item number for new copied items?
    CD.

    hello
    No u can not change the item serial no while coping or any time, as its standred functionality of sap
    reward if usefull

  • BAPI to change Purchase requisition

    Hi
    I want to change pruchase requsition EBAN- AFNAM ( requested by feild in PR line item ) . Is there any BAP to do so .
    I beleive we annot do so by using BAPI_REQUISITION_CHANGE ?

    Hi,
    Are you referring to BAPI_PR_CHANGE?, Please refer SAP Note 325947.
    Why don't you try MASS?
    Regards
    Shailesh

  • User exit to change Purchase requisition created from VA01

    Hi,
    I am using item categories ZRUI and ZRUD for which PR is created in VA01 while saving the sales order.
    I need to change address data in such PR. Can anyone suggest user exit to be used??

    Hi,
    You may use USEREXIT_MOVE_FIELD_TO_ME_REQ.
    You can find this in include MV45AFZB.
    <REMOVED BY MODERATOR>
    Regards,
    Sharad
    Edited by: Alvaro Tejada Galindo on Jul 21, 2008 12:37 PM

  • User Exit/BADI to change the Purchase Requisition date,creating threw MD02

    Hi,
    I've a requirement to change the Purchase Requisition creation date.
    I'm using MD02 to create Purchase Requisition.
    Based on the requirement if the available qty is less than the required quantity,we can change Purchase requisition date.
    Please let me know if any BADI's/User Exits we can use for this purpose.
    I've checked EXIT_SAPLMEREQ_010. I've kept debugging point nad i run MD02, but it is not stopping in the exit.
    we are using SAP 4.6c.
    Thanks,
    Adi.

    Hi Experts,
    Could you please give me a suggestion for the above problem???
    Thanks,
    Adi.

  • Purchase requisition document type change after Enhancement pack 4

    HI,
    we have recently upgraded to enhancement pack 4, after which i am not able to change purchase requisition document type.
    In change mode ME52N, the system is allowing to make change but when i goback and display the same PR again the change is not visible in change history also.
    I am able to make other changes. facing the problem with change in document type only.
    Regards,
    Raghu

    Hi,
    One thing please note that once you select the document type and draft the PR and save the PR, you will  get the doc number.
    Once you get the document number you cannot change the PR document type .
    The reason is document type is linked with number range so it cannot be changed because different seriers of document number is assined to differentdocument type. 
    And moreover document type is linked with the screen settings also. So I would request you to check the settings for each doc. type

  • BADI/User exit for Purchase Requisition from MRP

    I am looking for a BADI or any enhancement when a purchase requisition is created or modified from MRP .ie. MD50 transaction. Can anyone help ?
    THanks in advance.

    Hello Shareen
    Have you had a look at package <b>MD03 </b>(contains transaction MD50). It contains lots of BAdIs. Perhaps the following ones may be useful:
    MD_PLDORD_CHANGE (BAdI for Changing Planned Orders)
    MD_PURREQ_CHANGE (BADI for changing purchase requisitions)
    However, I should mention that I have not found anything when I checked the <i>Where-Used-List</i> for these BAdIs (on ECC 5.0).
    Regards
      Uwe

  • Convert Purchase Requisition to Purchase Order

    Hi All
    I want to setup Release for Purchase Requisition (Purchase Requisition can not convert to Purchase Order).
    I see in tab Status of Purchase Requisition, if Block ID is "Blocked by Requester", Purchase Requisition can not convert to Purchase Order. But I want when I convert Plan Order system set Block ID is "Blocked by Requester" is default
    Could you please tell me how to setup?
    Thank and best regards,

    hi
    If a requisition item is not to be converted into a new purchasing document item, the requester can block this requisition item in Change Purchase Requisition. To do so, he or she sets the Blocking Indicator on the Status tab page in the detail data for the requisition item to blocked by requester.
    This requester block can only be processed by an employee having the authorizations for Change Purchase Requisition.
    If a requisition item is blocked, it can be released and a source can be assigned to it, but you cannot create any purchasing documents referencing it.
    so what u have to do is change the status in me52n
    regards
    kunal
    Edited by: kunal ingale on Aug 1, 2008 6:16 AM

Maybe you are looking for