Deleting an order line item with B1WS?

Hi,
I am building an application which uses B1WS as it's interface to DISERVER.  There is a situation I am confused about and am hoping the folks here can shed light on.
I have an order object, and I would like to delete a line item from it.
How can I do that?
Thank you,
Mike

Ok, we figured it out.  I wasn't updating the LineNum property after resetting the line items.  The code below works for us, and  hopefully for you too.
Again, the idea is, to delete a line item, create a new line items collection and put into it every line item EXCEPT the one you want to delete.  Then update SAP.
private void DeleteLineFromOrder(string itemCode, string projectCode)
            // Load SAP order via B1WS
            string sessionID = B1WSLogin();
            GetSAPOrder(docEntry, sessionID, out _order, out _document);
            int oldLineItemCount = _document.DocumentLines.Count();
            // Create collection of the current lineitems, before the add.
            DocumentDocumentLine[] originalLineItems = _document.DocumentLines;
            // Update the line item count
            _document.DocumentLines = new DocumentDocumentLine[oldLineItemCount - 1];
            int lineItemCounter = 0;
            foreach (DocumentDocumentLine originalLineItem in originalLineItems)
                if ((originalLineItem.ItemCode != itemCode) || (originalLineItem.ProjectCode != projectCode))
                    originalLineItem.LineNum = lineItemCounter;
                    _document.DocumentLines.SetValue(originalLineItem, lineItemCounter);
                    lineItemCounter++;
            _order.Update(_document);
Cheers,
Mike
Cygnusoft, Inc.

Similar Messages

  • FM/Transaction/BAPI to delete sales order line item in APO

    Hi,
    Could you please share the details of FM / Transaction / BAPI to delete sales order line item in APO?
    Tcode - SDORDER_DEL / FM - BAPI_SLSRVAPS_SAVEMULTI2 delete the complete order with all its order items.
    Even the OM function modulesdelete the complete order. We could not locate a BAPI/FM for deleting only specific line items of a Sales order...
    Thanks,
    Arvind.S

    Hi Arvind,
    Can you try the below:-
    Function module : BAPI_SLSRVAPS_REMOVEITEMS
    Bapi object type: BUS10501
    Using this, one can delete One or More Sales Order Items / Schedule Lines.
    Please confirm
    Regards
    R. Senthil Mareeswaran.

  • I have a problem regarding sales order line item with confimed quanity

    Hi Experts,
    I have a problem regarding sales order line item with confimed quanity with '0'  with delivery block but confirming the sales order quantity once the order is released from credit check.
    The situation arises as per the below scenarios.
    Scenario - 1 -  When the sales order has two line item - one line item with confirmed qunaity in the schedule line and for the 2nd line item there is no available stock for the Material xxxxxx.
    Initially the sales order is created for the line item 2 with confirmed quantity = 0, and having the delivery block = 01 for the Material xxxxxx  and the order is set with credit check.  Once the order is relased from the credit check.  The quanity for the item 2 where the confirmed quantity will be = 0 ( Where it is not changing the confirmed quantity)
    Scenario -2-  Updating the order qunaity for the line item 2 as (9Pcs) it will goes to credit check and save the order.
    Maintain the stock for the line item 2 ( 5 Pcs).
    Once the order is released from the credit check.  Then  for the line item 2 the confirm quanity will be seting to 5 Pcs with Delivery blcok 01.
    This should not happen, When the credit check is released even though if it has stock based on the delivery blockl it should set the confirmed quanity to Zero.
    Can you please help me how to solve this issue.
    Looking forward for your reply.
    Thanks and Regards,

    Hi,
    I agree with your point.  In the sales order When the complete delivery check box is enabled where the confimed qty is set to zero, it is fine but when we save the orderr it goes to credit check.  Once we release the order using VKM3 where in the sales order the confimed quantity is setting to 5,  But it should set to Zero quantity.  Quatity should not be get confirmed it should be Zero Quantity. 
    Further in SPRO - customizing in the deliveries blocking reasons - It has a tick mark in the confirmation blcok.  But we dont want to remove the - Confirmation Block tick mark
    Please any one can help me if you have any solution to solve this problem.
    Thanks and Regards.

  • PO Release Strategy not changed after deletion of few line items with less

    Subject : PO Release Strategy not changed after deletion of few line items with less Total PO
    Dear Friends
    We have issue with PO Release strategy. We have created the PO. with release strategy  with multiple approvers.  After approval of first approval manager , one of the PO line item got deleted and Total PO value is reduced . The new PO value should have changed the PO release strategy. But it is not changed. Old release strategy only showing in the PO which is wrong. 
    Details of the PO
    PO no 4500000123 with 5 line items Total PO value : 100,000 USD Release strategy : AB
    PO line item 5 deleted. Now total PO value changed to 50,000 USD and the PO release strategy should have been changed to AA but not changed. Still showing PO release strategy AB only.
    Are there any OSS notes available to correct his bug.
    Please let me know if you need more details
    Thanks in Advance
    Thanks
    MVS

    Hi,
    release indicators  change it to 4.It may works. Please explore to all 6 indicators..........
    i.e,
    1-cannot be changed
    2-changable,no new determination of strategy
    3-changable,new release in case of strategy
    4-changable,new release in case of strategy or value change
    5-changable,new release if new strategy/outputted
    6-changable,new release if new strategy or value changed/ outputted......
    And check   Characteristic description and value in Classification  of Release strategies ........
    I hope this will help you. Thanking you.
    Regards,
    Venkat.

  • Information about the deleted sales order line item in idoc.

    Hi Experts,
    I am new to IDOC.We have the following idoc requirement,
    When a line item is deleted from the sales order(VA02) ,
    the outbound idoc getting triggered for the sales order has the information about the rest all line items other than the deleted line item.We now want the information about the deleted line item in the Idoc .
    Please help me in proceeding further.

    Hi,
    I am facing the same scenario of capturing the  deleted sales order line item in idoc.
    I am using ORDRSP message type , where in E1EDP01- ACTION contains value  "000" .
    And the Deletion line item is not been captured, is there any configuration setting required to
    capture the deleted line item in Idoc.
    Based on the posting in this thread i understand that there is an  indicator which has to be set .
    Please let me know what is that indicator and how to set it?
    Thanks
    Sathish

  • Cannot reject/delete sales order line item due to del.date in 2210

    Hi all,
    not sure if anyone else had this issue already....
    Situation :
    Sales order line item entered with delivery date in 2210.    We would like to correct this order but can't....
    every time SAP issues error :
    Error determining posting period (info
    S008, variant GL, RC 3)               
    I believe this is because we haven't maintained our calendars yet for 2210 :-D
    Question : without us having to load/define the calendar...is there a utility/oss program which we can use to delete the line item, or reject it...or even update the delivery date?
    Thanks for your help!

    If the system pop ups the error message M2012, then please refer note 10891 or 37532.  If the error message number is different, please update the forum.
    thanks
    G. Lakshmipathi

  • Deleting Purchase Order Line items

    Is it possible when you delete a purchase order line item using ME22n to have the corresponding purchase requisition line item marked as closed or deleted? 
    Currently when we delete the PO line item we get the message that the "Requisition quantity XXXX open again" .  We have purchase requisitions converting to purchase orders via ME59N on a schedule batch job,  so the req gets converted to a PO again if it is not deleted quick enough.

    Hi Gary,
    In MRP related PR to PO or without MRP also, whenever you convert a PR to PO and then delete an item from PO, the corresponding PR gets opened automatically - and its standard. This is logical also, because sometimes the person creating PR is different from the person creating PO. And If a PO item has been created synchronous to PR item, then its deletion must also be sysnchronous.
    I hope this answers your querry.
    Regards,
    HKV...

  • Line Items with B1WS

    Hello,
    I am probably missing something very simple but I have not come to grips with handling line items in B1WS at all. For example, a stock transfer in VB.net;
    Dim _Service As StockTransferService
    Dim _Params As StockTransferParams = Nothing
    Dim _Transfer As StockTransfer = New StockTransfer
    Dim _TransferLine As StockTransferStockTransferLine = New StockTransferStockTransferLine
    _TransferLine.ItemCode = "something"
    _TransferLine.WarehouseCode = "01"
    _Params = Service.Add(Transfer)
    Return _Params
    But at no point have I added _TransferLine to the lines collection of _Transfer nor can I see how to do it.
    Your help would be appreciated, thank you.

    Hi,
    StockTransferService works as any other service in B1WS with collections inside their properties. You can ahve a look to B1WS samples like for example Messages to see how it works.
    I have also tested StockTransfer for you and here you have some lines creating a StockTransfer with 1 line:
    Dim stService As StockTransferWebRef.StockTransferService = New StockTransferWebRef.StockTransferService
          Dim stParams As StockTransferWebRef.StockTransferParams
          Dim st As StockTransferWebRef.StockTransfer = New StockTransferWebRef.StockTransfer()
          st.CardCode = "TestC"
          st.StockTransferLines = New StockTransferWebRef.StockTransferStockTransferLine(1) {}
          st.StockTransferLines(0) = New StockTransferWebRef.StockTransferStockTransferLine
          st.StockTransferLines(0).ItemCode = "TEST"
          st.StockTransferLines(0).Quantity = 1
          st.StockTransferLines(0).QuantitySpecified = True
          stParams = stService.Add(st)
    Hope it helps
    Trinidad.

  • Deleting Sales order line item

    Hi,
    The sales order line item deletion should not be allowed after accouting of the advance payment is happened.
    How to achieve this.

    Hi Seema
    As far as I could guess you need to grey out VBAP-ABGRU field once you have posted payment for the sales order line item. Since this is a SD related process no validation or substitution would work in this. In this case when posting the incoming down payment through F-29 internally you need to call the user exit in the sales document to update the status of VBAP-ABGRU.
    Thanks
    Indranil

  • Due to deleted Sales order line items and Archived Sales order is still showing as Incomplete in BW as Open Order reports because of Incorrect SAP R/3 Rejection Status("A") in VBUP table.

    In a archived saler Order user had deleted Line Item and completed overall sales order. Now this sales order is archived, but it is stll appearing in BW report as open order because of deleted item  with rejection Status is maintained as “A” (Not yet Processed).
    We want to change this status from "A" (Not yet Processed) to "C" as completed.
    I have tried to reload Archive data but due to some limitation I was not able to do it. Also I feel this will like this s not the proper way to do it.
    Could you please help me to correct way to do it???
    Thanks in advance....

    Hi Vaibhav,
    If you can get the list of Sales orders which has deleted line items and force completion status. You can manage them in BI via lookup  or navigation attribute.
    Just my views I am sharing .
    Thanks,
    KDJ

  • Extended classic delete purchase order line items

    We have a problem with the backend purchase order updating with changes made to the local (SRM) PO.  A purchase order was cut with six line items and replicated to R/3 as expected.  The line items contained materials.  A couple of days later the requestor decided this order was not needed so the buyer went into the local PO and deleted the line items.  The local PO looks fine but the backend PO has not been updated.  I am recieving an alert message that states the following: "The material 0 does not exist or is not activated.  BP_PD_PO_TRANSFER_EXEC".  We do not have a material 0.
    I've done an OSS search and came across note 918450.  It mentions some issues with account assignment indexes for the extended classic scenerio.  I've implemented the note and ran the program BBP_EXT_PO_ACC_INDEX, however nothing has changed with the backend PO.  Also the note doesn't give much information on what should be done once the code changes are made.
    Can anyone give me some insight on how I might find out what the problem is?
    Best regards,
    Shawn O'Connor

    Hi Shawn,
    We had a similar problem before - we didn't get the alert message though. We implemented note 601073 in R/3 and the R/3 PO is updating fine now.
    Regards,
    Paula.

  • Copying text from CMIR (KNMT) to the Sales Order Line Item

    We need to copy text from the CMIR (KNMT) to the Sales Order Line Item with two steps in the access sequence. First to look up by the Ship to Partner Function.  If doesn't exist, then look up by Sold to Partner Function.  Have setup a new text id (ZPRN), a new access seq (9011).  The access seq has one seq =5 for KNMT, ZPRN, all languages and that saves fine.  When I set the Partner Function to be SH.  I get the following error msg:
    "The Language does not come from the partner function AG for MVKE".
    Any ideas?  This access seq does not reference MVKE. It only references KNMT.
    Thanks!

    Hi Lisa,
    Just stumbled on this post, as I am searching for something similar.
    What you are attempting to do isn't possible in config.
    This is because as standard Customer Material Info Records are not even considered for ship-to party in the sales order.
    They work for sold-to only.
    Therefore, this funny error message is SAP's way of saying, "Why are you trying to enter a partner here, because the data is determined for sold to only?"
    You can change this with development for other fields (ie, to determine delivery plant, tolerances etc at ship-to) by using
    the exit MV45AFZB with the USEREXIT_CUST_MATERIAL_READ form.
    However, even if you do this, Text Determination is still sold-to only and still doesn't behave.
    I am currently looking myself for a solution for this problem and I will let you know what I find.
    Cheers
    Chris

  • Undelete Purchase order line item

    Good day,
    Is it possible to undelete a deleted purchase order line item? If yes, how can I establish this?
    Thanks & regards,
    Christel Smolders

    hi
    u will see block / unblock symbol also dust bin symbol in Po line. U can delete line item here and when u want to undelete by pressing unblock u can achive same
    select the line item and then press unblock / undelete symbol ( Open lock symbol) line item will undelete
    Vishal...

  • Mass Deletion of Sales order line items

    Dear Gurus..
    There is a transaction VA02 for change and deletion of sales order line items. it takes time to delete line item of sales order one by one.. is there any abap program to do this process..
    if so please let me know
    regards
    Saad Nisar

    Hi,
    You can use trx MASS with object type BUS2032 to change sales order items. Please check this link:
    Re: Mass deletion of  sales orders
    Or try LSMW.
    Regards,
    Csaba
    Edited by: Csaba Szommer on Apr 10, 2009 8:18 AM
    Edited by: Csaba Szommer on Apr 10, 2009 8:21 AM

  • Unable to delete line item with 0 quantity in Invoice.

    Hi Experts,
    I came across a Invoice which reflects in VF04 as pending Billing due list. When i checked at the inter company Invoice i came across a line item with "0" quantity and price as zero, interestingly the replinishment cross company delivery document  for the same line item for "0" quantity had a Batch assigned to it.
    Now the issue is cusotmer has selected the line item with XX quantity and have selected the accounting document to be generated but the line item with "0 was left over and now still reflects in VF04.
    Customer does not want to reverse the full cycle to resolve the issue since the document was created a year back.My Question  is can we get the line item with "0" quantity to clear accounting so that it will not reflect in VF04.If so what will be process to do that.
    Thanks in Advance to advice.
    Regards,
    Sridhar.R

    Hi,
    It is  not possible to delete this line item, you can discuss with your client and delete it from the table.
    And now coming to the reasons why it has come into the invoice & Delivery
    1. The Batch Item category must have been configured as relevant for billing...check this and make it irrelevant if the client does not do batch specific billing. --- This will stop the batches from coming into the invoice.
    2.  Check for the batch item category in delivery if Zero quanity is allowed...if it is allowed make it not allowed and make it an Error message, whenever there is a zero quantity system will give a message.

Maybe you are looking for

  • Fact Sheet - Wrong Sold to visible

    Hi All, I have an issue for a particular user. Problem is wrong sold to party is visible in fact sheet. Just to brief the issue.. "A" is the sold to party for "B" (B is ship to). when a user opens B's fact sheet... the fact sheet displayong "C" as th

  • Print button moved when opening PDF in Firefox 26

    I use Firefox with a company made website that allows me to create FedEx shipping labels. When I create the label, it opens in a pop up window as a pdf file. In Firefox 25 and previous versions, there was a button at the top that I could click for "p

  • Photo Stream not syncing with Windows 7

    Photo stream seems to be having trouble syncing with certain Windows machines. Mine is having the same problem. I was having trouble getting photos from the stream to my Windows 7 machine so I tried to uninstall and reinstall the iCloud control panel

  • ICC profile for CMYK values

    Hello Everyone, I've tried to find info which ICC profile is used for HSV (or RGB) to CMYK conversion, but still without success. It is stated somewhere? I think it is quite important for specific use. Btw, it would be nice to have any possibility to

  • Nokia 5220 WHITE SCREEN PROBLEM *HELP*

    hello guys ... my phone's (5220) screen has gone White ... !! i have absolutely no idea what the problem is ! i took out the battery and put it back again .. but when i turn it on ..after the nokia logo the screen goes white again !! i cant do anythi