Delete Schedule Lines in Userexit / BadI

Hi Guys,
we plan to delete and / or change schedule in a Userexit.
If the delivery block - with "no production" is set in the schedule line we want to delete the confirmed quantity of the schedule line or to delete the associated schedule line with a confirmed quantity.
We do also delete the requirement using the BEDARFE_TRENNEN in MV45AF0B_BELEG_SICHERN.
But we have problems when we just delete the lines in XVBEP.
What do we have to consider ?
Is there perhaps an other option with the help of a BadI ?
Thanks for your help
Manuel

Hi
Thank u Darma. But if user creates schedule lines manually , system is not deleting the schedule lines.
Is there any way to delete  , manually created schedule lines ?
If so pl help me out  the procedure.
thanks & regards
ssp

Similar Messages

  • In which tables deleted schedule lines are stored

    Hi All,
    I want to know in which tables deleted schedule lines in VA02 VA32 are stored.
    How to get the deleted Schedule line item quantity.Please give me reply as early as possible.
    Thanks,
    Saritha

    Hi Saritha,
    As my understanding there is no table to store the deleted schedule line data.
    You have to identify badi or user-exit before deleting the schedule lines data in the VA02 program and in that exit you have to write the code to populate the deleted schedule line data in to your own custom tables(you have to create custom tables).I have used the same method for deleted deliveries.
    In sap CDHDR /CDPOS contains only changed data but not deleted data.
    Thanks,
    shyla

  • How to delete schedule line item

    Hi All,
    I want to delete schedule line entry for an item in R/3.
    How can i do this?
    Thanks,
    Nabha

    Hi,
    For some of the business documents schedule line item deletion would be partially which means mark for deletion-specially when the case of POs and so on
    other in general you need to goto the change document t-code and select the line item and you find the delete row mark in the same screen and select..
    Hope this helps..
    assign points if useful.
    cheers
    Pattan.

  • How to Change Schedule line Quantity in BADI 'ORDER_SAVE'

    Hi,
    I need to change the Schedule line quantity While Order saving. I am writing the code in ORDER_SAVE BADI. Using the Header guid i am reading the details and changing the quantity in Schedule line structure. How can i pass those values in to Memory so that order quantity will change. I try to Use CRM_ORDER_MAINTAIN but not able to change the quantity. Can an

    Hi,
    You need the One Order Function Module - CRM_ORDER_MAINTAIN to update the Schedule line value. So, you need to have a look at all the fields that are necessary to fill using the Tables and Structures. If you have the header guid, then you can probably pass the guid to CRM_ORDER_READ to read the values and then fill in the entries necessary to make the changes.
    You can also debug the order code to get a feel of the necessary changes.
    Hope this helps.
    Thanks,
    Samantak.

  • Delete schedule line with BAPI_PO_CHANGE

    Hi. Has anyone ever been able to delete a schedule line from a PO using this BAPI?
    There are several threads about this but none have an answer in that has been marked as solving the problem.
    I have tried every combination I can think of to delete the schedule line but it never works. I often get a message back stating "Purchase Order Changed" but it is not actually changed. I am commiting work, other fields change fine at the same time.
    There is even an example in the function module documentation for this that I have copied, but it still does not work.
    Has anyone actually had this working? I am wondering if it is a bug?
    Regards,
    Dave.

    Hi. I finally got it working last week.
    You do need to set the deletion indicator to L.
    The data I finally got working was:
    POITEM-PO_ITEM = PO item number (eg 00010)
    POITEMX-PO_ITEM = PO item number
    POITEMX-PO_ITEMX = 'X'
    POSCHEDULE-PO_ITEM = PO item number
    POSCHEDULE-SCHED_LINE = schedule line number (eg 0001)
    POSCHEDULE-DELETE_IND = 'L'
    POSCHEDULEX-PO_ITEM = PO item number
    POSCHEDULEX-SCHED_LINE = schedule line number
    POSCHEDULEX-PO_ITEMX = 'X'
    POSCHEDULEX-SCHED_LINEX = 'X'
    POSCHEDULEX-DELETE_IND = 'X'
    Regards,
    Dave.

  • How to delete confirmed schedule lines, without executing the ATP check?

    Sales and Distribution: Concerning ATP (product allocation)
    Situation:
    Step 1: An order is created with priority low. Quantities are confirmed for line items.
    Step 2: A second order is created with a higher priority. No confirmed quantities.
    Rescheduling program (SDV03V02) is then executed. This selects and sorts the orders in the correct order.
    The confirmed quantities for the first (low priority) order should now be freed up, to be able to allocate those quantities to the second (high priority) order.
    The problem I am facing is that the confirmed quantities are NOT released.
    We cannot use BAPI_SALESORDER_CHANGE or SD_SALESDOCUMENT_CHANGE to delete or modify the schedule lines, because these function modules execute the ATP check again. And when that happens, quantities are again confirmed and assigned.
    How can we get rid of the confirmed schedule lines, without executing the ATP check?
    Thanks,
    Edwin.

    Found a solution to the problem:
    In the Rescheduling program we export a parameter to the memory, to make it possible to delete schedule lines without executing the ATP check.
    Deleting of the schedule lines is done with a BAPI, which will call the ATP check automatically for ATP relevant materials. This we want to stop from happening (only when calling the BAPI).
    After the BAPI has been called we FREE the MEMORY ID.
    The parameter is imported again in Customer-Exit EXIT_SAPLATPC_001.
    Transaction.. SMOD
    Enhancement.. ATP00001
    Component.... EXIT_SAPLATPC_001,
    Include...... ZXATPU01.
    The customer exit is used in function AVAILABILITY_CHECK_CONTROLLER, just before calling function 'AVAILABILITY_CHECK'.
    Simply refreshing the ATP tables in the customer-exit, will prevent the ATP check from being executed (because we removed the list containing the materials for which the ATP check needs to be done). As a result, the function 'AVAILABILITY_CHECK' will not be processed.

  • Mass Delete of Schedule Lines generated through changes in prod Schedule

    Hi friends,
    Kindly provide me the process of mass deleting schedule lines which are created through changes in Production Schedule in the month end.
    Regards,
    Ask

    Hi,
    Try T.code Me17
    thanks
    Rakesh

  • Deletion and creation of Schedule line for Line Item

    Hi BW Experts,
    In P.S.A. when i have checked for first schedule line 001 reqdelqty is 50 , after deleting 001 and after creation of second schedule line in R/3 there are two records transferred from R/3 for schedule line 002 first with reversal indicator 'X' and delivery quantity -50 and next record with Reversal Indicator blank with value 50. which in turn results Reqdelqty zero.
    Reason of wrong data in BW: -
    Schedule line category for an item is being deleted forcefully. R3 doesn’t allow deletion of a schedule line category if delivery is already created. Here user is creating one same schedule line and then he deletes the order quantity from earlier one. This forces system to pick up schedule line 2 in the document flow
    · User shouldn’t delete schedule line.

    Hello Ganesh,
    Schedule line number sequence will not be in control of the user.
    once delivery for a schedule line is completed, no way you can delete the schedule line (except renumbering case). This is general SAP logic relates to schedule lines.
    Let me know how they are deleting the schedule lines even though delivery is completed.
    Now coming to Data load problem in BI.
    When you delete schedule line 001, the generated record should be with schedule line 001 with Reversal Indicator as R and delivery quantity -50.
    And for new schedule line 002, reversal indicator as blank and delivery quantity 50
    Regards,
    Nandakumar.A

  • Can't Delete/Change Schedule Line in Sceduling Agreement

    Hi
       I can't delete schedule line in scheduling agreement.
       Actually The PO History has diff data & Scheline screen have diff data.
       In Po History the Delivered Qty is 1520 GI Qty is 1520 GR Qty is 1520 but when I checked in Delivery Schedule screen in ME33L the data is diff.
       The Scheduled Qty 1520  Delivered Qty is 1520 GI Qty 360 & GR Qty 360.Even when I am trying to reduce the Scheduled Qty to GR Qty that is 360I am getting message Quantity 360 less than delivered qty 1520.
        Kindly help me to resolve this problem.

    Hi..
    The Scheduling agreement is one which is created runing MRP not VA31.
    I know that is two transaction data in SAP.
    One is Sales Data other one is Purchasing Data.
    This is second one.
    Thank you your response.

  • Delete SO Schedule lines only if corresponding PO items are deleted

    Hi,
    I am using BAPI_SALESORDER_CHANGE to delete schedule lines from sales order..
    According to Standard SAP if PO is created for the sales Order we cann't delete Schedule lines until we delete PO line items...
    But using this BAPI_SALESORDER_CHANGE it is possible to delete schedule lines even if PO items are not deleted...
    Any idea y it is happening like this..?
    <<text removed>>
    Thanks in Advance...
    Swathi
    Edited by: Matt on Dec 10, 2008 9:14 AM

    Thank u Neha..
    I am posting this again...
    Hi,
    I am using BAPI_SALESORDER_CHANGE to delete schedule lines from sales order..
    According to Standard SAP if PO is created for the sales Order we cann't delete Schedule lines until we delete PO line items...
    But using this BAPI_SALESORDER_CHANGE it is possible to delete schedule lines even if PO items are not deleted...
    Any idea y it is happening like this..?
    Thanks in Advance...
    Swathi

  • Schedule lines with null quantity deleted from EKET

    Hi All, I would understand if there is a logic that deletes schedule lines with null quantity from EKET.
    Sometimes it happens and sometimes not and I can't find the reason. I thought that it could depend from the transaction used (ME38 or MD43) but it's not so.
    thanks
    L

    Hi,
    This functionality was implemented after OSS Note was applied with release 4.0B.
    191898 - ME38: Delivery schedules w/ scheduled quantity zero

  • Bdc schedule line

    dear gurus,
    i want to create bdc to delete schedule line using VA32.this is my recording , but it not selecting item line.please help me.
    loop at itab.
    perform bdc_dynpro      using 'SAPMV45A' '0125'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'VBAK-VBELN'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'VBAK-VBELN'
                                   itab-vbeln.                "'400003569'.
    perform bdc_dynpro      using 'SAPMV45A' '4001'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=PEIN'.
    CONCATENATE 'RV45A-MABNR(' itab-posnr ')' INTO FNAM.
    perform bdc_field       using 'BDC_CURSOR'
                                  FNAM.                             "'RV45A-MABNR(01)'.
    perform bdc_dynpro      using 'SAPMV45A' '4003'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=EILO'.
    CONCATENATE 'RV45A-PRGBZ(' itab-ETENR ')' INTO FNAM.
      perform bdc_field       using 'BDC_CURSOR'
                                    FNAM .                            "'RV45A-PRGBZ(03)'.
    CONCATENATE 'RV45A-VBEP_SELKZ(' itab-ETENR ')' INTO FNAM.
      perform bdc_field       using  FNAM                             "'RV45A-VBEP_SELKZ(03)'
                                    'X'.
      perform bdc_dynpro      using 'SAPMV45A' '4003'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=SICH'.
      perform bdc_field       using 'BDC_CURSOR'
                                  'RV45A-ETDAT(01)'.
        call transaction 'VA32' using bdcdata options from OPTIONS
                messages into it_bdcmsg.
    endloop.
    regards,
    Rahul

    HI Rahul,
                         Better use VA02 instead of VA32 for deleting schedule lines.Just see here coding.i think this coding will be helpful for u.
        LOOP AT IT_VBEP ."WHERE VBELN = IT_FINAL-MAT_KDAUF AND POSNR = IT_FINAL-MAT_KDPOS.
        LV_QTY4 = LV_QTY4 + IT_VBEP-WMENG.
        CONDENSE LV_QTY4.
        ENDLOOP.
       CLEAR : LV_QTY4.
      PERFORM BDC_DYNPRO      USING 'SAPMV45A' '0102'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'VBAK-VBELN'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM BDC_FIELD       USING 'VBAK-VBELN'
                                    IT_FINAL-MAT_KDAUF.    "'9990000161'.
      PERFORM BDC_DYNPRO      USING 'SAPMV45A' '4001'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '=POPO'.
      PERFORM BDC_DYNPRO      USING 'SAPMV45A' '0251'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'RV45A-POSNR'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '=POSI'.
      PERFORM BDC_FIELD       USING 'RV45A-POSNR'
                                    IT_FINAL-MAT_KDPOS.         "'10'.
      PERFORM BDC_DYNPRO      USING 'SAPMV45A' '4001'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '=PEIN'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'VBAP-POSNR(01)'.
      PERFORM BDC_FIELD       USING 'RV45A-VBAP_SELKZ(01)'
                                    'X'.
      PERFORM BDC_DYNPRO      USING 'SAPMV45A' '4003'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '/00'.
      SORT IT_VBEP BY EDATU.
      CLEAR : IT_VBEP.
    *IF  LV_QTY LE LV_QTY4.
      V_QTY1 = LV_QTY.
      V_QTY2 = LV_QTY4.
    IF  V_QTY1 LE V_QTY2.
      LOOP AT IT_VBEP ."WHERE VBELN = IT_FINAL-MAT_KDAUF AND POSNR = IT_FINAL-MAT_KDPOS.
        CLEAR : LV_ITEM1.
        ADD '01' TO LV_ITEM1.
        CLEAR : LV_QTY1,LV_QTY2.
      GV_QTY1 = IT_VBEP-WMENG.
      CONDENSE GV_QTY1.
        IF IT_VBEP-WMENG GE LV_QTY AND IT_VBEP-WMENG GT 0." AND LV_QTY GT 0.
          LV_QTY1  = IT_VBEP-WMENG - LV_QTY .
          CONDENSE LV_QTY1.
          IF LV_QTY1 GT 0.
            CONCATENATE 'VBEP-WMENG(' LV_ITEM1 ')' INTO FVAL.
            PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                         FVAL.
            CONCATENATE 'VBEP-WMENG(' LV_ITEM1 ')' INTO FNAM.
            PERFORM BDC_FIELD    USING FNAM
                                    LV_QTY1.
         LV_QTY = LV_QTY1.
          ELSE.
            CONCATENATE 'VBEP-WMENG(' LV_ITEM1 ')' INTO FVAL.
            PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                         FVAL.
            CONCATENATE 'RV45A-PRGBZ(' LV_ITEM1 ')' INTO FVAL.
            PERFORM BDC_FIELD    USING 'BDC_CURSOR'
                                       FVAL.
            PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                          '=EILO'.
            CONCATENATE 'RV45A-VBEP_SELKZ(' LV_ITEM1 ')' INTO FNAM.
            PERFORM BDC_FIELD       USING FNAM
                                          'X'.
            PERFORM BDC_DYNPRO      USING 'SAPMV45A' '4003'.
           ADD '01' TO LV_ITEM2.
            CONCATENATE 'VBEP-WMENG(' LV_ITEM1 ')' INTO FNAM.
            PERFORM BDC_FIELD    USING FNAM
                                  LV_QTY1.
         exit.
            CLEAR : LV_QTY.
            LV_QTY = LV_QTY1.
            CONTINUE.
          ENDIF.
         LV_QTY = LV_QTY1.
          CLEAR : LV_QTY1,LV_ITEM1.
          EXIT.
        ELSEIF IT_VBEP-WMENG LE LV_QTY AND IT_VBEP-WMENG GT 0 AND LV_QTY GT 0.
          LV_QTY1  = LV_QTY  - IT_VBEP-WMENG.
          CONDENSE LV_QTY1.
          LV_QTY2 = IT_VBEP-WMENG - IT_VBEP-WMENG.              "'0.000'
          CONDENSE LV_QTY2.
          CONCATENATE 'VBEP-WMENG(' LV_ITEM1 ')' INTO FVAL.
          PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                       FVAL.
          CONCATENATE 'RV45A-PRGBZ(' LV_ITEM1 ')' INTO FVAL.
          PERFORM BDC_FIELD    USING 'BDC_CURSOR'
                                     FVAL.
          PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                        '=EILO'.
          CONCATENATE 'RV45A-VBEP_SELKZ(' LV_ITEM1 ')' INTO FNAM.
          PERFORM BDC_FIELD       USING FNAM
                                        'X'.
          PERFORM BDC_DYNPRO      USING 'SAPMV45A' '4003'.
          ADD '01' TO LV_ITEM2.
          CONCATENATE 'VBEP-WMENG(' LV_ITEM2 ')' INTO FNAM.
          PERFORM BDC_FIELD    USING FNAM
                                LV_QTY1.
          LV_QTY = LV_QTY1.
        ENDIF.
        CLEAR : LV_ITEM1,LV_ITEM2.
      ENDLOOP.
    ELSE.
        LOOP AT IT_VBEP .
        CLEAR : LV_ITEM1.
        ADD '01' TO LV_ITEM1.
        IF IT_VBEP-WMENG > 0.
    LV_QTY1 = '0'.
    PERFORM BDC_DYNPRO      USING 'SAPMV45A' '4003'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                   '/00'.
            CONCATENATE 'VBEP-WMENG(' LV_ITEM1 ')' INTO FVAL.
            PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                         FVAL.
            CONCATENATE 'RV45A-PRGBZ(' LV_ITEM1 ')' INTO FVAL.
            PERFORM BDC_FIELD    USING 'BDC_CURSOR'
                                       FVAL.
           PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                         '/00'.
            PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                          '=EILO'.
            CONCATENATE 'RV45A-VBEP_SELKZ(' LV_ITEM1 ')' INTO FNAM.
            PERFORM BDC_FIELD       USING FNAM
                                          'X'.
            PERFORM BDC_DYNPRO      USING 'SAPMV45A' '4003'.
           ADD '01' TO LV_ITEM2.
            CONCATENATE 'VBEP-WMENG(' LV_ITEM1 ')' INTO FNAM.
            PERFORM BDC_FIELD    USING FNAM
                                  LV_QTY1.
         exit.
           CLEAR : LV_QTY.
            endif.
      ENDLOOP.
             PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                         '=EILO'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '/00'.
    ENDIF.
    CLEAR: LV_QTY4,V_QTY1,V_QTY2.
      CLEAR : LV_QTY,LV_QTY1.
      CLEAR : IT_VBEP.
      LOOP AT IT_VBEP ."WHERE VBELN = IT_FINAL-MAT_KDAUF AND POSNR = IT_FINAL-MAT_KDPOS.
        LV_QTY3 = LV_QTY3 + IT_VBEP-WMENG.
        CONDENSE LV_QTY3.
      ENDLOOP.
      LV_QTY1 = LV_QTY3 - G_ERFMG1.
      CONDENSE LV_QTY1.
      V_QTY1 = LV_QTY1.
      V_QTY2 = GRSTD_ATWRT.
    IF LV_QTY1 < GRSTD_ATWRT.
      IF V_QTY1 LT V_QTY2.
        CONCATENATE 'Min Ord QTY is greater than item qty' VAR2
         INTO  VAR2 SEPARATED BY SPACE.
        MESSAGE I002(SY) WITH  VAR2.
      ENDIF.
      CLEAR : V_QTY1 ,V_QTY2,LV_QTY1.
      PERFORM BDC_DYNPRO      USING 'SAPMV45A' '4003'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '=SICH'.
      CALL TRANSACTION 'VA02' USING BDCDATA
                        MODE   'N'   "E'
                        UPDATE 'S'
                        MESSAGES INTO MESSTAB.
    *COMMIT WORK.
      IF SY-SUBRC NE 0.
        LOOP AT MESSTAB WHERE MSGTYP EQ 'E' .
          CALL FUNCTION 'FORMAT_MESSAGE'
            EXPORTING
              ID   = MESSTAB-MSGID
              LANG = SY-LANGU
              NO   = MESSTAB-MSGNR
              V1   = MESSTAB-MSGV1
              V2   = MESSTAB-MSGV2
              V3   = MESSTAB-MSGV3
              V4   = MESSTAB-MSGV4
            IMPORTING
              MSG  = G_BDC_ERROR_MSG.
                 EXCEPTIONS
                   NOT_FOUND = 1
                   OTHERS    = 2.
          EXIT.
        ENDLOOP.
        MESSAGE W002(SY) WITH  G_BDC_ERROR_MSG.
      ENDIF.
      CLEAR : G_BDC_ERROR_MSG.
      REFRESH : MESSTAB,BDCDATA.
      CLEAR   : MESSTAB,BDCDATA.",lv_item,lv_item1,lv_qty.
      CLEAR :I_MSEG,WA_VBAP.
      CLEAR : IT_FINAL,GRSTD_ATWRT,G_ERFMG1.
    *ELSE.
    *MESSAGE E002(SY) WITH  'Dettach Qty is greater than Schedule line Qty'.
    *ENDIF.
    *CLEAR: LV_QTY4.
    ENDFORM.                                                    " VA02
    REgards,
    LOkesh.

  • Unable to delete delivery schedule lines in MD04

    Hello All,
    In an intercompany process, plant A (receiving plant) placed an order
    through Schedule Agreement on plant B (sending plant). Accordingly
    schedule lines are released. Plant A received material but schedule
    lines are still reflecting in plant B of same qty's.. but not in plant
    A. Now we are unable to delete / remove schedule lines in plant B of
    stock / requirement list (tcode MD04).
    We would like to know why we are unable to delete these schedule lines
    in plant B. Pls. let us know how we can delete?
    Thanks

    But again system is not allowing to receive, stating qty is exceed over SA / PO.
    I have not seen that you mentioned this earlier. Instead you wrote earlier:
    In SA history we see only goods receipt happened through movement type 101 followed by invoice receipt. From supplying plant there was NO out bound or goods issue happened. .
    CAn you start again explaining your situation as it is totally unclear if you have problems with receipt or with goods issue?
    Of course you should only receive after it was issued.
    You should double click the message to get the long text along with the message number. the message number would help us to find a solution for you.

  • Deletion of schedule line in PO using BAPI_PO_CHANGE

    Hi ,
    Can anyone give me the code to delete a schedule line in a po using the bapi bapi_po_change.
    Useful answers will be rewarded.
    Regards,
    Sowmya.

    Hi,
    Refer below code
    *&      Form  sub_populate_data
          text
    FORM sub_populate_data .
    *--Local Variables
      DATA : l_ipdate      TYPE rc65a-datefrom,
             l_fdate       TYPE sy-datum.
      IF NOT it_succ_file[] IS INITIAL.
        LOOP AT it_succ_file INTO st_succ_file.
          st_ipfile = st_succ_file.
    *--Sales Document
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = st_ipfile-vbeln
            IMPORTING
              output = st_salesdoc.
          st_ord_headx-updateflag = c_u.
    *--Sales Document Item
          st_schedule_line-itm_number = st_ipfile-posnr.
          st_schedule_linex-itm_number = st_ipfile-posnr.
          st_schedule_linex-updateflag = c_i.
    *--Schedule line date
          l_ipdate = st_ipfile-edatu.
    *--Call function module to convert the date format into current user format
          CALL FUNCTION 'CY_CONVERT_DATE'
            EXPORTING
              date_string_imp = l_ipdate
            IMPORTING
              date_exp        = l_fdate.
          st_schedule_line-dlv_date = l_fdate.
          st_schedule_linex-dlv_date = c_chk.
          st_schedule_line-req_date = l_fdate.
          st_schedule_linex-req_date = c_chk.
    *--Order quantity in sales units
          st_schedule_line-req_qty = st_ipfile-wmeng.
          st_schedule_linex-req_qty = c_chk.
          APPEND st_schedule_line TO it_schedule_line.
          APPEND st_schedule_linex TO it_schedule_linex.
    *--Clear
          CLEAR : st_schedule_line,
                  st_schedule_linex.
          AT END OF posnr.
    *--Perform to delete the existing schedule line
            PERFORM sub_delete_schedule_line.
          ENDAT.
          AT END OF vbeln.
    *--Clear
            CLEAR : st_erfile.
            READ TABLE it_erfile INTO st_erfile WITH KEY vbeln = st_ipfile-vbeln
                                                         posnr = st_ipfile-posnr
                                                         BINARY SEARCH.
            IF sy-subrc EQ 0.
              g_error_records = g_error_records + 1.
              g_total_records = g_total_records + 1.
            ELSE.
    *--Call the bapi to update sales order schedule line
              PERFORM sub_call_bapi.
            ENDIF.
          ENDAT.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " sub_populate_data
    *&      Form  sub_call_bapi
          text
    FORM sub_call_bapi.
      g_total_records = g_total_records + 1.
    *--Call BAPI to update sales order schedule line for simulation mode
      CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          salesdocument    = st_salesdoc
          order_header_inx = st_ord_headx
          simulation       = c_chk
        TABLES
          return           = it_return
          schedule_lines   = it_schedule_line
          schedule_linesx  = it_schedule_linex.
      IF NOT it_return[] IS INITIAL.
        READ TABLE it_return INTO st_return WITH KEY type = c_e.
        IF sy-subrc EQ 0.
          g_error_records = g_error_records + 1.
        ELSE.
          REFRESH : it_return.
    *--Call BAPI to update sales order schedule line
          CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
            EXPORTING
              salesdocument    = st_salesdoc
              order_header_inx = st_ord_headx
            TABLES
              return           = it_return
              schedule_lines   = it_schedule_line
              schedule_linesx  = it_schedule_linex.
        ENDIF.
        LOOP AT it_return INTO st_return
                          WHERE type EQ c_e.
          st_erfile = st_ipfile.
          st_erfile-message = st_return-message.
          APPEND st_erfile TO it_erfile.
          APPEND st_erfile TO it_file.
          CLEAR : st_return.
        ENDLOOP.
      ENDIF.
      IF it_file[] IS INITIAL.
    *--Call BAPI transaction commit to change the schedule line
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait = c_chk.
      ELSE.
        ROLLBACK WORK.
    *--Call BAPI transaction rollback to rollback the schedule line
        CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
      ENDIF.
    *--Clear
      CLEAR : st_salesdoc,
              st_ord_headx.
    *--Refresh
      REFRESH : it_return,
                it_schedule_line,
                it_schedule_linex.
    ENDFORM.                    " sub_call_bapi
    Regards,
    Prashant

  • Delivery deleted but schedule line status shows as fully delivered - Urgent

    Hi,
    I deleted the delivery related to the order but teh schedule line status says its fully delivered....
    Is thr a way to refresh the schedule line so it shows the correct status? Urgent PLs.,
    Thanks
    Keshi

    Thanks fro the reply.. But i tried this but the inconsistency is still there? any other report i cn try
    Thanks
    Keshi

Maybe you are looking for