Problem in adding "Reason for Rejection" using BAPI_SALESORDER_CHANGE

Hi all,
       I have a requirement to stop further processing of sales order by changing the reason for rejection at line item. I have done the code and passed the reason code in the item table to BAPI. The return message says the sales order ammended successsfully, but when i go and see the sales order I dont see it getting updated. when i go to check the order its throwing an error message "Update was terminated"  Could some one please help in getting this solved.
The code is shown below
Populate the headerX details
it_bapisdh1x-updateflag  = 'U'.
it_bapisdh1x-sales_org   = 'X'.
it_bapisdh1x-distr_chan  = 'X'.
it_bapisdh1x-division    = 'X'.
it_bapisdh1x-purch_no_c  = 'X'.
it_bapisdh1x-cust_group  = 'X'.
Populate the header details
it_bapisdh1-sales_org    = '1298'.
it_bapisdh1-distr_chan   = '95'.
it_bapisdh1-division     = '00'.
it_bapisdh1-purch_no_c   = 'Test1'.
Partner Roles
it_bapiparnr-partn_role = 'AG'.
it_bapiparnr-partn_numb = '9820000049'.
it_bapiparnr-itm_number = '00000'.
APPEND it_bapiparnr.
it_bapiparnr-partn_role = 'WE'.
it_bapiparnr-partn_numb = '9820000049'.
it_bapiparnr-itm_number = '000000'.
APPEND it_bapiparnr.
it_bapisditmx-itm_number = '00010'.
it_bapisditmx-updateflag = 'U'.
it_bapisditmx-material   = 'X'.
it_bapisditmx-cust_group = 'X'.
it_bapisditmx-reason_rej = 'X'.
APPEND it_bapisditmx.
it_bapisditm-itm_number = '00010'.
it_bapisditm-material   = 'YAG'.
it_bapisditm-reason_rej = '01'.
APPEND it_bapisditm.
BREAK-POINT.
salesd = '4000004045'.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
  salesdocument = salesd
  order_header_in = it_bapisdh1
  order_header_inx = it_bapisdh1x
  behave_when_error = ' '
  int_number_assignment = ' '
TABLES
  order_item_in = it_bapisditm
  order_item_inx = it_bapisditmx
  partners = it_bapiparnr
  return = it_bapiret2.
IF sy-subrc = 0.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
endif.

When using BAPI_SALESORDER_CHANGE, you set the fields your are updating to 'X'.  In the example you gave, you are trying to change the header data, material number, etc.
Try slimming it down to:
Populate the headerX details
it_bapisdh1x-updateflag = 'U'.
it_bapisditmx-itm_number = '00010'.
it_bapisditmx-updateflag = 'U'.
it_bapisditmx-reason_rej = 'X'.
APPEND it_bapisditmx.
it_bapisditm-itm_number = '00010'.
it_bapisditm-reason_rej = '01'.
APPEND it_bapisditm.
BREAK-POINT.
salesd = '4000004045'.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = salesd
order_header_in = it_bapisdh1
order_header_inx = it_bapisdh1x
behave_when_error = ' '
int_number_assignment = ' '
TABLES
order_item_in = it_bapisditm
order_item_inx = it_bapisditmx
return = it_bapiret2.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
endif.
I hope this helps,
Mark

Similar Messages

  • How can I pass value in status and reason for rejection using BAPI_LEAD_CREATEMULTI when creating multiple lead

    Hello,
    I want pass value in STATUS and Reason for rejection according to requirement when i am creating multiple lead using BAPI_LEAD_CREATEMULTI. Please help me how can i pass value. Please give some sample code that in which table i have to pass values and please also tell me INPUT_FIELDS values. Please help me
    Regards,
    Kshitij Rathore

    Hello,
    Please help me for solve this problem. I am trying to solve problem from last 4 days but i didn't get any solution.
    Regards,
    Kshitij Rathore

  • User Exists In Sales Order Creation Program for adding "Reason For Reject"

    Hi gurus
    I have following requriement
    As New Sales Order created (VA01) by default or at the time of saving the sale order, perticular "Reason for Rejection" should be set to each line item.
    This is then can be removed in change (VA02) with Mass change.
    We need this to review the sales order / block sales order from MRP run.
    Please let me know how to manage this or is there any user exist for the same.
    Thanks
    Sunil K

    Hi,
    As per my knowledge the automatic creation of rejection order is not possible, still will check out and know.
    but for urgent use you will have to follow the manual way of changing the line items from OK to blocked for apporoval so you can achieve their not passing on to MRP.
    manual way is what is described below:
    You can either reject the whole sales document or individual items.
    Reject all items:
    If you want to reject all the items, choose Reject document in the change modus for the sales document.
    The system automatically selects all the items and you can enter a reason for rejection in the following dialog box.
    Enter the appropriate reason for rejection and choose Copy.
    The system assigns the same reason for rejection to all the selected items.
    Reject individual items:
    If you only want to reject some of the items, select those items in the item overview screen and choose Edit - Fast change of... - Reason for rejection.
    A dialog box appears in which you can enter the appropriate reason for rejection.
    Enter the appropriate reason for rejection and choose Copy.
    The system assigns the same reason for rejection to all the selected items.
    Reject individual items with different reasons of rejection:
    If you want to enter different reasons for rejection for the items, choose the Reason for rejection tab page from the overview screen when changing the sales document.
    You can enter a different reason for rejection for each item in the Reason for rejection field.
    regards,
    Siddharth.
    Edited by: SD on Mar 15, 2008 10:22 AM

  • Mass change with Reason for Rejection.

    Dear Gurus,
    Pl tell me the process to close all the open orders at one go. I have tried with the t.code MASS, but I was unable to do that.
    Pl give the step by step process.
    Regds,
    Sreehari

    Hari,
    MASS transaction is useful, If you know what fields to change  and in what documents/customers/vendors/.
    In your case what fields is pretty clear (VBAP-ABGRU  or MASSVBAP-ABGRU )
    But what documents is not clear.
    Points to consider.
         You can the documents that are open by just writing some query or even you can get it from SE16 using VBAP table
            and you can use these document numbers and enter in the MASS T.Code.
    It looks simple but the main hurdle is not all of the items in these orders are open, right...so you can't enter the reason for rejection in an item which was already delivered, or scheduled to deliver.
    So  Unless you know that all the items of an order are open, its not feasible to use MASS T.code.
             So my suggestion is to write an ABAP program that check whether the item in an order is open or not and then change the reason for rejection using BDC code.
                    Thats my suggestion. I hope you understood the reason for going to an ABAP program.
    Regards,
    Ajai.
    Reward points if helpful.

  • Sales Order Creation - Block - Reason For Rejection

    Hi Guru
    I want following fictionality
    1. User Creates Sales Order (VA01)
    2. Sales Order Items entered
    3. At Item Level, System should insert a required "Reason For Rejection" to item entered like a enitial value.
    4. Saving the Sales Order, all Item in that sales order will have a "Reason For Rejection"
    5. System should insert a desire value for "Reason for rejection" automatically so even if user forgot to enter, order will not be release for MRP.
    6. Then another user will remove this Reason for rejection using VA02.
    How to do this. Please suggest all possible ways.
    Rewards for solution.
    Thk.
    Edited by: Sunil Kolambkar on Dec 19, 2007 9:04 AM

    Hi
    1. Create a cust doc type
    2. For this go for field selection and have default value for Reason for rejection ( as there are multiple choices)
    Hope this will answer
    With regards
    Bhargava
    Reward if useful

  • Problem when setting Reason of Rejection for a sales order using IDOC

    Hi All,
          I am working on a requirement where i need to put a reason for rejection as 'Item Cancelled' for a sales order via IDOC 'IDOC_INPUT_ORDCHG' in a third party scenerio where the PR is created automatically from the sales order . When the IDOC is run in the foreground I get the information message Subsequent function  " 'Purchase requisition from sales document' not possible Item & was rejected "(Message V1579) and the IDOC results in a error when run  in the background mode because of the same information message. The message should not appear when a sales order is being processed in the background but still the message is being displayed . Is there any way the message can be suppressed ? Thanks in Advance.
    Regards,
    Sowmya.

    can you send the program how you create a so or po using IDOC, as i've a assignment creating PO using IDOC & then creating a sales order of the PO. and i dont know how to create a IDOC. SO IF you have sample program it would be help full
    Thanxs

  • BAPI_SALESORDER_CHANGE to update reason for rejection of sales order item

    Hi,
    The FM BAPI_SALESORDER_CHANGE is not working properly as I am getting below error when try to update the reason for rejection at sales order item level.
    The delivery is done for this salesorder. Is it because the reason for rejection field is not as an input field when delivery done?
    error in return table is " Field 'ABGRU' cannot be changed, VBAPKOM 000010  ready for input"
    Request your suggestions to avoid this error.
    Thanks

    >
    anikaushi wrote:
    > Hi,
    > The delivery is done for this salesorder. Is it because the reason for rejection field is not as an input field when delivery done?
    >
    >  error in return table is " Field 'ABGRU' cannot be changed, VBAPKOM 000010  ready for input"
    >
    >
    > Thanks
    Yes, Most likely.. You can confirm this by trying to change a order without delivery and see if it goes thru (to ensure that you have passed correct parameters)...
    you may have to delete the delivery (and if billing document exist, cancel it), before you can reject the line item... it would be safer to raise an error message and let the users manually delete delivery document as long as you don't have large volumes of this scenario..
    Please see the SDN thread for how you can avoid this error...
    Re: Cancel Sale Order after Issued Billing

  • How to add new tab after reason for rejection tab using tcode va01

    Hello,
    how to add new tab after reason for rejection tab using tcode va01.

    Hi,
    You can check this link...
    Hope it will be helpful to you.
    [https://forums.sdn.sap.com/click.jspa?searchID=23016273&messageID=6825861]
    [http://www.sapdevelopment.co.uk/enhance/fexits.htm]
    -Maharshi
    Edited by: Maharshi Vyas on Mar 3, 2009 12:45 PM

  • How add new tab after reason for rejection tab using tcode va01

    Hello,
           How to add new tab after Reason for Rejection tab using tranzaction code VA01.
    pls suggest solution.

    I don't think you can add a tab after reason for rejection tab. There are custom tab, which you can use for your convenient, given by SAP. You can look into the below details:
    Program : SAPMV45A
    Screen: 8459(Item) and 8309(Header).
    Kuntal.

  • Popup for entering Reason for Rejection

    Hi Experts,
    I have a workflow which has a user deciision step for approval and rejection.
    On rejecting i want a popup to appears where in user can select the reason for rejection and then exceute the workitem.
    I have tried using POPUP_GET_VALUES . I created a method in my BO and it works fine over there, but when i call it in the workflow i dont c any popup and the wokritem disappears.
    When i check the log, this step is still in READY state and thw rokflwo is hanging.
    Any other approach that any1 can suggest.
    Thanks.

    Hi Aarvi,
    I have similar requirement. Could you please provide some more info on the solution. I am using FM 'CATSXT_SIMPLE_TEXT_EDITOR' to get the popup. I have added this FM in a method and this method is attached to "Method AFTER Work Item Execution" section in Method tab in User decision task.
    Problem I have is, even if I approve or reject, popup still appears. But I need only the popup during rejection.

  • How does the field ABGRU-Reason for Rejection get populated in routines

    Hi All,
    How does the field ABGRU-Reason for Rejection get populated in routines(VOFM)?
    BELNR,KPOSN,etc...fields are populated through KOMK and KOMP structures, similar way what structure is used for ABGRU?
    by the time the control from VA01 comes to routine the values of VBAK and VBAP are cleared, so these structures like KOMP and KOMK are used.
    Thanks in advance.

    You need to add rejection reason field ABGRU as a new field to pricing field catalog (KOMG structure) through APPEND structure KOMPAZ. KOMG inherits new fields from KOMKAZ (for header level fields) or KOMPAZ (for item level fields) structures and it is not directly modified but through KOMKAZ and KOMPAZ structures
    Since VBAP-ABGRU can vary from item to item, add it to item pricing communication structure KOMPAZ in SE11. Once KOMPAZ is added with new ABGRU field and activated it will automatically appear in pricing field catalog (KOMG)
    Afterwards the ABGRU field will then start to appear in the field catalog where you can create condition table (V/03) including the ABGRU as a field. Once done the rest is assigning the condition table to access sequence which is in turn assigned to the relevant condition type that you want to price based on partner function (all under IMG -> SD -> Basic functions -> Pricing -> Pricing control)
    In the pricing user exit userexit_pricing_prepare_tkomp in include MV45AFZZ, you will need a few lines of coding to fetch VBAP-ABGRU for the item and pass it to tkomp-abrug field. This will then be used by system to read the new condition table that you created.
    tkomp-abgru= xvbap-abgru
    So if you populate special pricing based on ABGRU (with possibly other conditions) in the condition table then that condition record will be read for the corresponding condition type.
    You would of course need a developer to modify KOMPAZ structure and code the user exit for moving the rejection reason to tkomp
    That is in short how you can achieve this

  • Change the  sales order reason for rejection for line item

    Hi,
    i want to change the  sales order reason for rejection for line item.
    iam using bapi_salesorder_change.but i unable to change the sales order.
    if possible please provide me what are the fields necessary  for changing
    sales order reason for rejection for line item.
    Regards,
    Suresh

    This is the standard config to supress printing on the rejected item. Are you using standard programs or customised ?

  • Send 'Reason for Rejection' from Task Process back to User

    I have a SharePoint 2013 workflow that uses "Start a task process" to get approval for documents in a library. On the task list, I have a field named 'reason for rejection' that the approvers would complete if they're going to reject the document.
    When the document is rejected the workflow sends an email back to the person who created the document. Is it possible to somehow include the reason for rejection in the email? If not, is there some other solution for getting this information back to
    them (other than just saying to contact the approvers)?

    Hi Andrea_2,
    According to your description, my understanding is that you want the email which is sent by workflow after the document is rejected to contain the field "reason for rejection".
    Instead of adding the field into the email which is sent after the document is rejected, I suggest you add an "Send email" action when a single task is rejected, and make the mail is sent to the creator of the document.
    You can do as the followings:
    Open the workflow with SharePoint Designer 2013.
    Open and edit the workflow, then click "Approval(**)".
    Click "Change the behavior of a single task"
    In the "When a task completes" scetion, add a "Send email" action in the ELSE IF branch, like the screenshot below:
    Best Regards,
    Wendy
    Wendy Li
    TechNet Community Support

  • Reason for rejection for sale order stock existing line item

    Hi,
        I am giving reason for rejection for a line item where there is already sale order stock. Then I am getting a warning message like " there is sale order stock assigned". I want this message to be as error message. Any customisation (SPRO) is there for this?
    Kindly update.
    Ratna

    Dear Rama Rao
    I think, there is no problem you can ignore the warning message and go ahead give reason of rejection and close the order
    There wont be any problem absolutely
    The reason  of warning message is, (it is sales order created with item category with special stock indicator as E )  that means the system tells you that it is extra special stock which you have created and now you are trying to reject hence it alerts you by giving a warning  message
    The item category of the items which you are trying to reject  is marked  or should have been marked with special stock indicator (you can check that in VOV7)
    By double clicking warning message if it is of V4 message class in t code OVAH you can make that as no message
    But i doubt that this is available in OVAH
    Regards
    Raja

  • Sales report based on Reason for Rejection

    Hi Guru's,
    I have a requirment to get the list of sales orders( Open/ Close) report based on Reason for Rejection.
    Please makesure it should be standard not customization and using tables.
    Thanks & Regards,
    Subbu.

    Hi subburamaiah
    If you want the report you can create a separate SIS report . In that take the input field  as a Reason for rejection.. and ask for the output the list of sales orders .Now when you check this user defined report you will give the reason for rejection and check what all orders got rejected on that reason for rejection.
    Regards
    Srinath

Maybe you are looking for

  • Add to Favorites Email Font Mystery

    I deleted a bunch of font 'favorites' -- by dragging them off the list in the email fonts screen -- but although their names are gone there is a Blank Space where they use to be; if I click on that blank space the font (the font I thought I deleted)

  • Flash button play over sound in both over and down states?

    I have created a button and set a sound on it for the over state. The sound plays correctly when the button enters the over state, but it plays again when the button enters the down state. Here's what I did as a test: In an empty Flash9/ActionScript3

  • Installation wizard prompts for the installation disk--though the disk is already in the drive

    I cannot get past the install wizard, which prompts me to install the disk, even though the disk is already in the drive.  The install wizard gets to the point of calculation installation time, them prompts me to install the disk, which is already in

  • Error when validating css

    5 Value Error : padding only 0 can be a length. You must put a unit after your number : 10 10 Here is line 5: padding: 10; Does anyone know what i have to do to validate this line? Thanks

  • JMF on Linux

    Hi, I found many topics here about JMF installation on Linux but my problem persists... When I run jmfregistry and click on "Detect Capture Devices" button I get: JavaSound Capture Supported = false java.lang.Error: Can't open video card 0 java.lang.