Writing a LSMW for rejecting lines on sales order

HI Guys
I need your help in writing a LSMW
1) to reject sales oreder line items
2)then also to write a LSMW to create PO which we already have
3) write LSMW to create a sales order for line items that we rejected.
I have no clue how to do it and would really appreciate if you can provide me some pointers.
Thanks
If someone is lokking for a similar answer, I created recording for rejecting the line items in the sales order and simulatneously recreated the line items within the same sales order.
Edited by: Comes Naturally on Jul 15, 2008 10:58 PM

thanks anyways

Similar Messages

  • LSMW for open notifications,open sales order & open service order

    Hi Gurus,
    Can anyone please tell me how to go about writing LSMW's for open notifications,open sales order & open service order.
    This is for service processing in CS ,where has the scenario is 
    Create Notification (IW51) --> create Sales Order(Multiple Line Items) ( VA02) --> Create Service Order ( IW32)
    Service order is automatically (Item Proposal) generated w.r.t Sales Order (multiple line items)
    How to I do the recording for transactions in such a scenario.
    Please suggest!
    Thanks!
    Vinod

    you can use the below LSMW IDOC method
    SALESORDER_CREATEFROMDAT2       Sales order: Create Sales Order
    SERVICENOTIFICATION_CREATEFROM  Create service notification
      SERVICE_CREATE                  Creation of a Service Master Record
    CARNOT                          Delivery: Shipping notification
    DESADT                          Shipping notification
    DESADV                          Delivery: Shipping notification
    INOTIF                          Notifications
    INTUPD                          Notification Status Update
    ISU_ADVICE                      IS-U Deregulation: Notification
    ISU_CHANGE_REQUEST              IS-U: Notification of Change to
    ISU_MAINT_SO                    IS-U Dereg.: Notification of Dev
    ISU_REMITTANCE_ADVICE           Transfer Notification

  • GRN number for rejected items in sales order

    hi sapgurus,
    i want to know the grn number for rejected goods in the sales order 
    consider if i put a sales order for a material named X for 10 quantities and if 5 quantities are rejected i will put GRN for those rejected items and add it to my stock.
    I have taken GRN no linking VBAK with VBRP .VBRP with LIPS .LIPS with MKPF thro VBELN_LA (ie.delivery note).
    the delivery note will be updated only Post goods issue happens with complete status.
    Is there any other way to get GRN no without delivery note while PGI in process Status.
    thanks in advance!
    Edited by: rakesh on Oct 3, 2008 11:29 AM
    Edited by: rakesh on Oct 6, 2008 12:31 AM

    i solved ths issue

  • Planned cost in S_ALR_87013105 for rejected item in sales order

    Hello Experts
    I have a sales order item having reason for rejection (as error).  However, the planned cost of this sales order item is shown in S_ALR_87013105 report. 
    The sales order was created in the month of Feb2011.  If I run the report for limited period from 03 to 07 the planned cost is NIL but If I run the same report from Feb 11 till date, it shows the planned cost of material +overheads.
    can some body throw light on why the report behaves in this way?
    Thanks and best regards,

    Use T Code KO12 and see if you've got any annual/overall values planned against the IO.
    Regards
    Sreenivas

  • System allowing order related Billing for rejected item in sales order

    Hi all,
    I have created a new reason for rejection: "Billed before Go live"
    I have then asigned it to sales item 10 in sales order thus rejecting it.
    I expected that when I do the billing for this sales order, the system will not allow to bill the rejected item, but the rejected item is still getting billed by VF01
    Can anybody please tell me why this is happening.
    Regards,
    Avinash Gyale

    Hi,
    mere reason for rejection is not enough for blocking from billing, at item level  you need to put billing block also apart from reason for rejection, then only you can reject the item and block from billing.
    thanks ,
    gln

  • Production order %00000000001 for schedule line in Sales order

    Hello Experts,
    We have an issue with the production order whih is created from SO
    There is a sales order and have production order for CTO parts. But the Production order is deleted before confirming. Now when we check in the sales order in schedule lins we are getting as "Production order %00000000001 for schedule line" 00010/0001 can no longer be changed.
    Could any one provided the valuable imputs for what resasons this weeor appears
    Thanks in advance...
    Regards
    Madan

    Hello Vivke,
    Please find teh delatis of the issue
    We have an SO created for the CTO parts and to corrsponding to that generally a production order will be created, But in one of the case for SO the production order is showing as %000000001 in the schedule lines in the SO apart normal number ranges for Production orders.
    Now we need to know in what case the production order appears as %000000001 in the schdule lines, are we missing any thing in order to create production orders?
    Note: Initially there was production order is created correctly when scheduled lines are confirmed, but it is deleted for some reasons and again when the schedule lines are confirming we are facing this issue
    Could you please provide any suggestion on this
    Thanks
    Madan

  • REMOVE REASON FOR REJECTION FROM THE SALES ORDER

    Hi,
    When i am trying to change status of items 130+140 from net cancellation to "open"  (remove reason for rejection), saving is not possible because of this error message!
    Item 000130 :Target qty of reference: 1 PC (total referenced: 2 PC).
    Also an information message: Subsequent documents already exist for item 000140.

    Thanks for your help. =)
    I also realized that I forgot to add the SO Item # into the T_ORDER_ITEM_INX-ITM_NUMBER fields.
    But now it works.

  • LSMW program to upload the sales order with multiple line items.

    Dear SD and PP Gurus,
    I am new to creating LSMW Program.
    I want to create a LSMW program to upload the sales order with multiple line items. I have read on SDN that it can be done on two phases. First Create Header Data than line items. IS IT TRUE??, Or
    Is there any procedure by which we can load the sales orders with multiple line items in a single run (part).
    I want to use Batch process, not a BAPI or IDOC procedure.
    I have created a program with
    object 0090
    Method 0000
    Program Name RVINVB10
    Program Type D
    Source Structure 1 - For Header and Source Structure 2  for Line Items.
    Mapped Field INDET (With Fix Value 1), ORDERTYPE, SALESORG, DISTCHANNEL, DIVISION, CUSTOMER, PONUMBER , DELVDATE, PRCGDATE, PMTTERM
    INCOT1 INCOT2 with Source Structure - 1 and
    Field INDENT (With Fix Value 2),  ITEMNO, MATCODE, MATQTY, SUOM, PLANT, BATCH, AMOUNT with Structure-2
    than maintained Structure relation ship, field Mapping, Specified Files, Assigned files, Read Data and other process,
    At final stage (Start Direct Input program RVINVB10) it is giving a message - Table name not allowed.
    Please tell me where I am wrong.
    Thanks in advance.
    DSC

    Dear SD Gurus n Experts,
    I have solved the above problem. But there is another problem appearing regarding the date format. Now system generating a message: Date . . is not valid.
    While I am using Date: YYYYMMDD format in flat file, which is SAP's Standard Format.
    In SDN Link: LSMW upload Sales Order using VA01/VA02     I have found that there are some date fields which are mandatory to filled. Here I have mapped
    VDATU - Requested delivery date,  BSTDK - Customer purchase order date,  PRSDT - Date for pricing and exchange rate,  BSTDK_E - Ship-to party's PO date, FKDAT - Billing Date, KORDT - Delivery Date,
    and PRGRS - Date type is Constant = D
    Can any one tell me, where is the priblem.
    With thanks,
    DSC

  • How to delete header condtion line of sales order by BAPI

    Hi,
    I want to delete the condtion line of sales order header using BAPI "BAPI_SALESORDER_CHANGE",
    it is work well in item level condition type, but it is not work for header condition type. show error message "missing item number" since of pass item number "000000" for header condition line.
    Below is reference source code, thanks in advance.
    *& Report  ZTEST_BAPI_SO_DELETECONDLINE
    *& Sample program to call BAPI_SALESODRER_CHANGE to
    *& delete condition line of so line item
    REPORT  ZTEST_BAPI_SO_DELETECONDLINE.
    ***--- Structures for create BAPI
    DATA: SALESDOCUMENT LIKE BAPIVBELN-VBELN.
    DATA: ORDER_HEADER_INX LIKE BAPISDH1X,
          BEHAVE_WHEN_ERROR LIKE BAPIFLAG-BAPIFLAG,
          SIMULATION LIKE BAPIFLAG-BAPIFLAG.
    DATA: BEGIN OF ORDER_ITEM_IN OCCURS 2.
            INCLUDE STRUCTURE BAPISDITM.
    DATA: END OF ORDER_ITEM_IN.
    DATA: BEGIN OF ORDER_ITEM_INX OCCURS 2.
            INCLUDE STRUCTURE BAPISDITMX.
    DATA: END OF ORDER_ITEM_INX.
    DATA: BEGIN OF SCHEDULE_LINES OCCURS 2.
            INCLUDE STRUCTURE BAPISCHDL.
    DATA: END OF SCHEDULE_LINES.
    DATA: BEGIN OF SCHEDULE_LINESX OCCURS 2.
            INCLUDE STRUCTURE BAPISCHDLX.
    DATA: END OF SCHEDULE_LINESX.
    DATA: BEGIN OF ORDER_CFGS_REF OCCURS 2.
            INCLUDE STRUCTURE BAPICUCFG.
    DATA: END OF ORDER_CFGS_REF.
    DATA: BEGIN OF ORDER_CFGS_INST OCCURS 2.
            INCLUDE STRUCTURE BAPICUINS.
    DATA: END OF ORDER_CFGS_INST.
    DATA: BEGIN OF ORDER_CFGS_VALUE OCCURS 2.
            INCLUDE STRUCTURE BAPICUVAL.
    DATA: END OF ORDER_CFGS_VALUE.
    DATA: BEGIN OF CONDITIONS_IN OCCURS 2.
            INCLUDE STRUCTURE BAPICOND.
    DATA: END OF CONDITIONS_IN.
    DATA: BEGIN OF CONDITIONS_INX OCCURS 2.
            INCLUDE STRUCTURE BAPICONDX.
    DATA: END OF CONDITIONS_INX.
    DATA: BEGIN OF EXTENSIONIN OCCURS 2.
            INCLUDE STRUCTURE BAPIPAREX.
    DATA: END OF EXTENSIONIN.
    DATA: BEGIN OF RETURN OCCURS 2.
            INCLUDE STRUCTURE BAPIRET2.
    DATA: END OF RETURN.
    DATA: TMP_POSNR  LIKE VBAP-POSNR,
          L_KNUMV    LIKE VBAK-KNUMV,
          L_KSCHL    LIKE KONV-KSCHL,
          L_STUNR    LIKE KONV-STUNR,
          L_ZAEHK    LIKE KONV-ZAEHK.
    ***--- Selection
    PARAMETERS: P_VBELN LIKE VBAK-VBELN OBLIGATORY MEMORY ID AUN DEFAULT '7000510', "'0001007443', " SO
                P_POSNR LIKE VBAP-POSNR OBLIGATORY DEFAULT '000000' , " so item
                P_CONDN LIKE  KONV-KSCHL  DEFAULT 'ZOSP',    " condition type
                P_CONDI LIKE  KONV-ZAEHK  DEFAULT '01',      " Condition item number
                P_TEST  AS CHECKBOX DEFAULT 'X'.             " test mode
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          INPUT         = P_VBELN
        IMPORTING
          OUTPUT        = P_VBELN.
      CLEAR: L_KNUMV.
      SELECT SINGLE KNUMV INTO L_KNUMV
      FROM VBAK
      WHERE VBELN  = P_VBELN.
      IF SY-SUBRC = 0.
        CLEAR: L_KSCHL,L_ZAEHK,L_STUNR.
        SELECT SINGLE KSCHL ZAEHK STUNR INTO (L_KSCHL, L_ZAEHK, L_STUNR)
        FROM KONV
        WHERE KNUMV = L_KNUMV
          AND KPOSN = P_POSNR
          AND ZAEHK = P_CONDI
          AND KSCHL = P_CONDN.
        IF SY-SUBRC <> 0.
          WRITE:/ 'Condition type or condition item is not exist.'.
          EXIT.
        ENDIF.
      ELSE.
        WRITE:/ 'Sales order number is not exist'.
        EXIT.
      ENDIF.
    IF L_ZAEHK IS INITIAL.
          WRITE:/ 'Condition type or condition item is not exist.'.
          EXIT.
    ENDIF.
    SALESDOCUMENT = P_VBELN.     " Sales order number
    ORDER_HEADER_INX-UPDATEFLAG = 'U'.   "U = change sales order
    ***Item Data
    ORDER_ITEM_IN-ITM_NUMBER = P_POSNR.
    APPEND ORDER_ITEM_IN.
    ORDER_ITEM_INX-UPDATEFLAG = 'U'.   "I = add, U= update, D=delete
    ORDER_ITEM_INX-ITM_NUMBER = P_POSNR.
    APPEND ORDER_ITEM_INX.
    ***--- Begin delete a condition line
    ***--- Make sure to use update flag 'D'. Here I = add, U= update, D=delete
    CLEAR: CONDITIONS_IN,CONDITIONS_INX.
    REFRESH: CONDITIONS_IN,CONDITIONS_INX.
    CONDITIONS_IN-ITM_NUMBER = P_POSNR.
    CONDITIONS_IN-COND_ST_NO = L_STUNR.
    CONDITIONS_IN-COND_COUNT = L_ZAEHK.
    CONDITIONS_IN-COND_TYPE  = L_KSCHL.
    APPEND CONDITIONS_IN.
    CONDITIONS_INX-UPDATEFLAG = 'D'.
    CONDITIONS_INX-ITM_NUMBER  = P_POSNR.
    CONDITIONS_INX-COND_ST_NO  = L_STUNR.
    CONDITIONS_INX-COND_COUNT  = L_ZAEHK.
    CONDITIONS_INX-COND_TYPE   = L_KSCHL.
    APPEND CONDITIONS_INX.
    ***--- End delete a condition line
    BEHAVE_WHEN_ERROR = 'P'.
    SIMULATION = P_TEST.   " Test mode or not
    "=== call BAPI
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        SALESDOCUMENT               = SALESDOCUMENT
        ORDER_HEADER_INX            = ORDER_HEADER_INX
        LOGIC_SWITCH                = '    U'
      TABLES
        RETURN                      = RETURN
        ORDER_ITEM_IN               = ORDER_ITEM_IN
        ORDER_ITEM_INX              = ORDER_ITEM_INX
        CONDITIONS_IN               = CONDITIONS_IN
        CONDITIONS_INX              = CONDITIONS_INX .
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    WRITE: / 'Return code =', SY-SUBRC.
    SKIP 1.
    LOOP AT RETURN.
      WRITE: / RETURN-MESSAGE.
    ENDLOOP.
    Edited by: hank jiang on May 21, 2010 5:07 AM
    Edited by: hank jiang on May 21, 2010 5:25 AM
    Edited by: hank jiang on May 21, 2010 5:27 AM

    SALESDOCUMENT = P_VBELN.     "Sales order number
    ORDER_HEADER_INX-UPDATEFLAG = 'U'.   "U = change sales order
    ORDER_ITEM_IN-ITM_NUMBER = P_POSNR.
    APPEND ORDER_ITEM_IN.
    ORDER_ITEM_INX-UPDATEFLAG = 'U'.   "I = add, U= update, D=delete
    ORDER_ITEM_INX-ITM_NUMBER = P_POSNR.
    APPEND ORDER_ITEM_INX.
    "Begin delete a condition line
    "Make sure to use update flag 'D'. Here I = add, U= update, D=delete
    CLEAR: CONDITIONS_IN,CONDITIONS_INX.
    REFRESH: CONDITIONS_IN,CONDITIONS_INX.
    CONDITIONS_IN-ITM_NUMBER = P_POSNR.
    CONDITIONS_IN-COND_ST_NO = L_STUNR.
    CONDITIONS_IN-COND_COUNT = L_ZAEHK.
    CONDITIONS_IN-COND_TYPE  = L_KSCHL.
    APPEND CONDITIONS_IN.
    CONDITIONS_INX-UPDATEFLAG = 'D'.
    CONDITIONS_INX-ITM_NUMBER  = P_POSNR.
    CONDITIONS_INX-COND_ST_NO  = L_STUNR.
    CONDITIONS_INX-COND_COUNT  = L_ZAEHK.
    CONDITIONS_INX-COND_TYPE   = L_KSCHL.
    APPEND CONDITIONS_INX.
    "End delete a condition line
    BEHAVE_WHEN_ERROR = 'P'.
    SIMULATION = P_TEST.   " Test mode or not
    "=== call BAPI
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        SALESDOCUMENT               = SALESDOCUMENT
        ORDER_HEADER_INX            = ORDER_HEADER_INX
        LOGIC_SWITCH                = '    U'
      TABLES
        RETURN                      = RETURN
        ORDER_ITEM_IN               = ORDER_ITEM_IN
        ORDER_ITEM_INX              = ORDER_ITEM_INX
        CONDITIONS_IN               = CONDITIONS_IN
        CONDITIONS_INX              = CONDITIONS_INX .
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    WRITE: / 'Return code =', SY-SUBRC.
    SKIP 1.
    LOOP AT RETURN.
      WRITE: / RETURN-MESSAGE.
    ENDLOOP.

  • Ignore the number of schedule lines in sale order item when run MRP

    Dear All,
    I have a problem when I create production order (discrete manufacturing)
    When I create a sale order with one sale order item and 3 schedule lines for this sale order item.
    After that, I run MRP for this sale order, what I get is 3 planned orders for 3 schedule lines. It means that I will have 3 production orders for 1 sale order item.
    I want  create one production order for one sale order item whatever the number of schedule lines in sale order item.
    I think I have to config in MRP. Please help me.
    Thanks in advance

    Dear
    Check in OPPQ then look in Master data Availability Check & strategy for material also check whether u have maintained strategy for same material and see did u extended sales views for other material
    As u said 3 schedule lines for this sale order item check whether u have extended sales views for next material
    With Regards
    Pushpalas

  • DI to Cancel Lines on Sales Order

    Hi,
    We're running SBO 2007A PL37 and I was wondering if there's a way to use the DI to cancel lines off sales orders if we have the order numbers and item codes?  We would want to do it in bulk... so feed in a whole lot of orders and items and have it cancel them all off rather than us having to go in and do them all individually.
    Thanks,
    Michael
    Edited by: Michael Boucher on Oct 30, 2008 1:41 AM

    Yes, it is possible. The code for closing one row is:
                           Dim obj As SAPbobsCOM.Documents
                            obj = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseOrders)
                            obj.GetByKey(docentry)
                            obj.Lines.SetCurrentLine(linenum)
                            obj.Lines.LineStatus = SAPbobsCOM.BoStatus.bost_Close
                            err_code = obj.Update()
    In your case go in cycle through all lines in order and compare the itemcode in line and itemcode you have and if its same, close the row.

  • Screen /user exit for additional screen on sales order header

    Hello sir's,
    can anybody help me for this query---
    Screen /user exit for additional screen on sales order header.
    exit name.
    Thanks in advance,
    Vikram

    Hi,
    SAP has provided screen modification. This you can do on "Additional data B" screen at both <b>header</b> and line iteam level.
    Additional <b>header data is on screen SAPMV45A 0309</b>, additional item data on screen SAPMV45A 0459. These screens contain the <b>Include screens SAPMV45A 8309 ( this is the screen exit at header  )</b> or SAPMV45A 8459 ( this is the screen exit at item ) as user exits. There few more exits you will have to code to get this screen works. The are,
    MV45AOZZ - PBO module of screen
    MV45AIZZ - PAI module of screen
    MV45ATZZ - Global data definition for user-exit.
    Check this link for more info regarding user-exit in sales docs.
    http://help.sap.com/saphelp_46c/helpdata/en/1c/f62c7dd435d1118b3f0060b03ca329/frameset.htm
    We have alredy implemented this solution at line item level. Let me know if you have any question.
    Regards,
    RS

  • Invoice for a Patially incomplete sales order

    HI all,
    I have a sales order with say 3 line items. 1 line item has pricing incompletion and the rest 2 items are complete. i save the sales order with the incompletion. Then i create delivery for the 2 line items that are complete and post the PGI. The system allows me to do so and it is fine.
    The problem comes when i try to invoice this delivery that has the completed items. It says that Sales Order number ##### has pricing incompletion. This makes me wonder why? I am invoicing the delivery which does not have that incomplete item. Why will the system look for incompletion from the sales order?
    After looking into the Delivery to Invoice copy ctrl routine 004 at the item level, i found that it also checks for the pricing status of the reference sales order.
    Has anyone faced this problem? Is there any other way out that modifying the routine?
    Thanks
    AriBis

    Hi,
    I understand but why the Sales order should be incomplete with regards to pricing? Normally pricing is finalised before the Order is received.
    If it is due to some other reason e.g. availability of material, system will not stop you to create the Invoice.
    ALSO I feel that since pricing from Sales order flows only into the Invoice and not in the Delivery document, so pricing at the Sales order has to be complete for creation of Invoice. 
    Another solution to this problem can be: change your Incompletion procedure so that pricing is not checked. But again this is not the best practice.
    Regards,
    Peeyoosh.
    Edited by: Peeyoosh Jain on Sep 28, 2009 11:02 AM

  • Function module for deleting the perticular sales order

    Hi Experts
    I wanted a function module name for deleting the perticular sales order document ,when i enter the import parameter as sales order no  and some value as export parameters so that i can use that for the program (message :successfully deleted ).

    Hi Satya,
    Use BAPI BAPI_SALESORDER_CHANGE as follows:
    DATA: T_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
    DATA: BAPISDH1X LIKE BAPISDH1X.
    PARAMETERS: P_VBELN LIKE VBAK-VBELN.
    *SET THE DELETION FLAG
    BAPISDH1X-UPDATEFLAG = 'D'.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    salesdocument = P_VBELN
    order_header_inx = BAPISDH1X
    tables
    return = T_RETURN
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    Hope this will help.
    Regards,
    Nitin.
    Edited by: Nitin Karamchandani on Dec 8, 2008 8:36 AM

  • Free finish goods for certain level of sales order amount.

    Hi Gurus,
    I want to add some free finish goods if the sales order amount is greather than a certain amount for OR sales order type
    For example : if the sales order net amount is greather than 1000 - I want to automaticaly add a FG - 347234FG .
    Is it possible without having SAP retail module ?

    Khaled is right for details refer to sap help page:
    http://help.sap.com/saphelp_46c/helpdata/en/dd/55fa68545a11d1a7020000e829fd11/frameset.htm
    Good luck!

Maybe you are looking for

  • How to connect Macbook to HDTV

    Hello Mac community, When i first bought my macbook back in late 2011 it came with OSX Lion already installed. I bought an hdmi cord and a thunderbolt attachment cord (idk what its actually called but the hdmi cord goes into the smaller one which in

  • Why cant i drag and drop mp3 files into my itunes library in itunes 11.1.1?

    I recently lost a hard drive with most of my music on it. i removed and reinstalled itunes and set it to work on my other hard drive. i was able to drag and drop mp3 files that i had and put them into my library. After the latest updates, now it only

  • Can I create a Dataform in EPMA interface

    Hi all, I am new to hyprion epma app.I want to create a dataform in epma. Is it possible to create a dataform in epma interface or i need to create it in workspace? Thanks

  • Who's Melissa Barletta,

    Some random billing address appeared on my account and buying skype numbers with a mastercard, I don't know this person, I don't own a mastercard registered in the US.. (I've never been to the US) Tried to tell skype but we get the usual "please veri

  • How Create New Folder in KM with Name having Special Character

    Hi, How to create new Folder in KM with name having special character in it. Right now its not allowing me to create folder when i have Colon( as one of the character in name of the folder. Is there a way to change this validate? Any help is appricia