Quantity updates in return order from referenced Invoice

Dear Gurus,
I have set  the return sales order creation with the reference of a Invoice document. Therefore when i make the return order i enter the invoice number into the reference and then make the changes with quantity as per the requirement. suppose in invoice I have 5 quantity and in the return order I make it 2 so return of 2 will take place, then i will do PGR for quantity 2 with the reference of return order and then the credit for return upto  this its working fine. But now if I want make the second return order with reference of same Invoice system will give me pop up saying that the return anf credit of quantity 2 has already done for so and so item. Then if I enter in the return sales order in the order quantity I should see 3 quantity only as the return and credit of 2 quantity already took place but here the quantity in sales order is not getting change and it is appearing 5.
I dont know where the mistake? I check the copy control also for ZTAN (invoice) to ZREN (Return) it is as follows.
Copying Reqt - 303
DataT - 153
DataT - 104
DataT - 004
Pricing type - D
Update Doc Flow - X
and remaining all fields are blank
Copy Control at header level ZIF2 to ZIRE
Copying Reqt - 021
DataT - 052
DataT - 103
DataT - 003
Copy Item Number - Checked
Complete reference  - Unchecked
Please help me how this quantity update will happen automatically?
Regards,
Sanjay

Hello Dear Sanjay;
I completely understand your requirement, but this is how the SAP system works. I had already this needs and actually the system doesn't have control like this. Is this a bug ? Maybe....
We were forced to development a Z program or new routine to treat this control.
The system send a simple message including quantities, but internally the function module allow to do a return orders, for instance, how many times as you want.....
I hope you can understand the limitation.
Regards
Ruy Castro

Similar Messages

  • Quantity updation of return material from Qty Contracts

    I have a contact, for which i created a release order,
    delivery, goods issue and invoice.
    Now if I do a return transaction how the quantity
    contract will be up dated  and my requirement is again to replace the
    original quantity in quantity contract.
    Regards
    Gautam

    Hi Gautham,
    I am not getting why u want to update contract as u can create delivery against return order .
    No need to update contract as u have already did PGI and Invoice .
    Correct me if i am wrong.
    Thanks

  • Serial number copy functionality when creating return orders from standards

    Hi all,
    Serial number is not copying when i create return order from the standard orders in below scenario.
    I implemented one BADI for copying Serial number to Sales order when doing Post goods receipt.
    So after doing inbound delivery and PGR, serial number is copied to the sales order but when i create return order with reference to the Standard order Serial number is not copying.
    When i go VA02 for standard order and selecting the technical objects then if i create the return order serial number is copying.
    Please help me in the above issue.
    I used the following logic to copy serial number from inbound delivery PGR.
    UPDATING THE SERIAL NUMBER TO THE RESPECTINVE SALES ORDER LINE ITEMS
                CALL FUNCTION 'SERNR_ADD_TO_AU'
                  EXPORTING
                    sernr                 = lwa_sernr-sernr
                    profile               = 'NEOP'
                    material              = lwa_mseg-matnr
                    quantity              = 1
                    document              = lwa_mseg-kdauf
                    item                  = lwa_mseg-kdpos
                    debitor               = lwa_mseg-kunnr
                    vbtyp                 = 'C'
                    sd_auart              = lv_auart
                    sd_postyp             = lv_pstyv
                  EXCEPTIONS
                    konfigurations_error  = 1
                    serialnumber_errors   = 2
                    serialnumber_warnings = 3
                    OTHERS                = 4.
                IF sy-subrc = 0.
                  CALL FUNCTION 'SERIAL_LISTE_POST_AU'.
                IF sy-subrc EQ 0.
                  COMMIT WORK.
                  WAIT UP TO 2 SECONDS.
                ENDIF.
    Edited by: Rajesh Sanapala on Feb 16, 2009 12:48 PM

    hi.
    I have the same problem.
    Can you please share how you solved it?
    thank you
    Bill

  • How to create a Return Order from a Quality Notification?

    Hi everyone at SDN.
    Really need some help on this issue we are having. We want to create a Return Order from a Quality Notification, ie. the document flow should be:
    :: Serv. notif 000200000482
       :: Return Order 0060299453
    In the SAPGUI we are able to do this by going into transaction QN02, enter the notification number and in the menu: "Notification" --> "Functions" --> "Sales Order" --> "Create Selection of Order Type". Now we select the Return Order type and the result is as wanted.
    However, we want to do all this in ABAP instead. The BAPI I have tried with is BAPI_CUSTOMERRETURN_CREATE.
    And the following code is used:
        ls_order_h_in-refobjtype = 'BUS2078'. "Quality Notification
        ls_order_h_in-refdoctype = 'Z5'. "Quality Notification type
        ls_order_h_in-refobjkey = '000200000482'. "Ref. Quality Notification
        ls_order_h_in-doc_type = 'ZREN'. "Return Order type
        ls_order_h_in-sales_org = 'S001'.
        ls_order_h_in-distr_chan = '01'.
        ls_order_h_in-division = '01'.
    Then I add a material as well as the mandatory partner functions. When I execute the Return Order is created but when I check the document flow for the Return Order there is no link to the Quality Notification.
    Any suggestions on how to do this? I have tried using FM RV_DOCUMENT_FLOW_UPDATE_U for updating the document flow but it doesn't seem to like it when I enter a Notification in there. And when I run FM RV_ORDER_FLOW_INFORMATION for the above (working) Return Order there is no Quality Notification available. So this leads me to believe that I have to update something else then VBFA (Sales Document Flow)...
    I would really appreciate all the help I can get on this.
    Best Regards
    Niklas

    anyone?

  • Reg : NO UPDATE OF SALES ORDER FROM PO erroer I0 114

    hi experts,
    while creation of PO with reference to PR,user gets error " NO UPDATE OF SALES ORDER FROM PO erroer I0 114 ".
    What could be the reason for this error?any idea...
    rgrds...

    Hello Jurgen,
    here the error message is " NO UPDATE OF SALES ORDER FROM PURCHASE ORDER  error I0 114 " .
    is there any solution for this issue.user looks frustrated because its working for one PO and the next PO its showing error.
    Rgrds.....

  • Recalculation of quantity in free goods for return order wrf to invoice

    Hello everyone,
    I want to recalculate quantity of free goods category in a return order created with reference to an invoice, if the quantity in the High Level Item Category has changed.
    For example, a customer bought 100 boxes of product "A " and received 10 of these for free. Then he wants to return 60 boxes. When I create a return order with reference to the invoice and change these quantity from 100 to 60, free goods item category still shows 10 boxes instead of 6.
    Recalculation must be take place acording to the pricing date determination in order to apply free goods in a valid date.
    Customized features reviewing:
    1. There's not Item Category Proposal for Target Sales Doc type of the Return order, but item category of source bill type has one an is set to Pricing Type "D".
    2. High Level Item category of free goods category is relevant for billing and is set to M "Delivery - related invoices-no zero qtys (in main bath items)"
    3. Free goods category assigment has NORM as item Category Group, FREE ussage, High Level Item category is determinated for return order document type and Item category by default is the free goods category.
    I will appreciate your support to solve this issue.
    Best Regards,
    Andrea Figueroa

    Hello,
    Thank you for your response.
    My Discount Type of Free Goods determination is set to:
    Calculation Rule: "2 - Unit reference"
    Free Goods Category: "1 - Inclusive rebate (with item generation)"
    Free Goods delivery control: "C - Delivery of main item is part. delivered, only with main item"
    However, whatever the calculation rule is, if I change the quantity in the main item, subitem does not work. 
    I read about SAP Note 573598 that describes perfectly my problem, but is valid in 4.6 to 4.7 version and I have ERP version.
    Thank for your help,
    Andrea Figueroa

  • While copy into return sales order from sales invoice.

    I am creating one sales document assign one pricing procedure for that(eg. zpos)
    same way I am creating another return sales order which have I assign return sales order pricing procedure(zposr).
    Every time client want to create return sales order with reference to sales invoice (which having procedure zpos).
    but when copy from sales invoice into the return sales order pricing procedure is not change(in return sales order it's show pricing procedure zpos instead of zposr. )
    please provide me help
    so that after copy from invoice into the return sales order s/m should pick correct pricing procedure (zposr)
    thank you.

    hi,
    check in t code ovkk what is the pricing procedure for the return sales cocument type
    the pricing procedure for sales area+custpric proc +doc pric proc =zposr(it should be there)
    and the document pricing procedure should be different as that of determing the pricing procedure for(zpos)
    check in t code vov8 what is the doc pric proc assigned to the the return sales document type,
    this same shall be allocated in ovkk infront of your pricing procedure(zposr),
    if not then maintain it and then test and revert
    revert  if helpful
    Mohit Singh

  • No update of sales order from purchase order

    Hi,
    When I am trying to change the delivery date of a purchase order line item, I get the error
    "No update of sales order xxxxx from purchase order (error V1 348)" How can I resolve this?
    Sincerely,
    Ketan

    Hi,
    Check whether this PO is created w.r.t. PR and PR is created automatically during Sales order creation.
    If it is so then need no to change the delivery date in PO, it will always get updated as per the Schedule Line date of sales order.
    You can go for GR w.r.t. PO directly.

  • Incorrect quantity updates of sub-order in collective order

    Hi,
    We are using Cable solutions ver: 4.6c. When the quantity of the leading order is changed (co02), the sub-order quntities are not changing accordingly. Let me explain you in detail.
    Following are the settings in Material Master.
    Material      BaseUoM      AsseblyScrap  ProcurementType    SpecialProcurement   MatType
    MAT1          FT                11.5%               E - inhouse                                                  FERT
    MAT2          FT                                         E - inhouse               52 - Collective Order  HALB
    MAT3          LB                                         F - External               10 - consignment       ROH
    Following is the BOM structure for Leading Material MAT1 with base qty 1000FT
    Component      Qty     UoM
    MAT2               1000  FT
    Following is the BOM structure for MAT2 with base qty 1000FT
    Component      Qty     UoM
    MAT3               7.280  LB
    If I create a production order for MAT1 with qty 1000 - system adds 11.5% scrap and the final qty = 1115 and at the same time it creates a production order for MAt2 with qty 1215 (this is another issue - it suppose to be 1115 but it adds 100 more, dont know why). Now if go to change mode and change the qty for MAT1 to 10000 then the target qty = 11150, but the Qty for for order of MAT2 = 5529 - which is incorrect, it is suppose to be around 11150.
    One thing i noticed is - if Assembly scrap for MAT1 is removed in Material master then the Quantity of the MAT2 is updating correctly.
    Anyone had this kind of issue before? Please let me know the solution to this problem.
    Thanks in advance.

    Is any one there who can help me on this problem. I am waiting.....
    Thanks in advance

  • When I am making return order on cancelled invoice system should give error

    Experts,
    In this scenario I have cancelled the invoice 1234567 and when I am creating return order with reference to the cancelled invoice 1234567,system is accepting it
    Is there any process where the system should give the error
    Regards
    Kiran

    Hi,
    you should go for enhancement,use the exit MV45AFZZ
    Pass the XVBAK - VGBEL to VBUK - VBELN and check VBUK - VBTYP = N (Invoice cancellation) system throw an error.
    you can specify the message Ex: Return order can not be processed in spite of cancelled invoice.
    take ABAPer help.
    Regards
    Ram

  • RG23D Updation during returns Order Cycle.

    Hi,
    My client is not a manufacturing company,but a Depot,hence they cannot claim modvat.
    The customers they sell goods to,can be manufacturing companies and can hence claim modvat for the same.
    For this,we use j1ig in MM and J1iJ in sales to capture and tehn pass it on to the customer during sales order processing.
    at the billing level.
    Now, when the customer returns the goods,thru returns configuration,during PGR, i want to know wether the RG23D Register gets updated or not ?
    Also that, is there any other alternative way,where we can configure the same, in case of DEPOT Excise.
    If you have any solution on soft-copy,you can mail me on:   [email protected]
    Regard;s
    Priyanka

    Hi,
    For credit memo, you can get return order numer if you maintain "B" in copy control
    If you need  Previous sales order number then maintain sales order number in PO field of return order and you will get in credit memo if you set "A" in copy control
    Thanks
    Chidambaram

  • Update PTO Sales Order from PO with Partial MIGO

    Hi,
    how to update dates and quantites in PTO sales order from PO with partial MIGO.
    I could find the FM 'SD_PURCHASE_CHANGE_ORDER' which can change the date in PTO sales order from PO with MIGO fully done.
    Can we do it through any other means?

    I Could change the date through some user exit

  • How to close the Return Order from Billing due list

    Dear Gurus,
    This is the scenario of Free subsequent delivery with the reference of Return Delivery.
    In brief-->
    I created one sales order and done its normal delivery and billing. So this order to cash cycle is completed.
    Then due to the damage in transit of some material customer wants to return some good and ask for the subsequent delivery of same goods.
    therefore I create a return sales order with the reference of previous sales order and and do the return delivery. Here I am not making the credit note as I have to make the subsequent delivery for the return order.
    So I create the sales order for subsequent delivery with the reference of Return order and do the delivery.
    Now I have the query that when I run the billing due list (VF04) I get the same return order in billing due list as I have not created the credit memo with its reference. And the return order will remain there always. But I dont want that return order to appear in the billing due list as I have done the subsequent delivery for that return order.
    Please tell me how the return order's status can be made completed to avoid it in billing due list.
    Please suggest me all the possible solutions to complete the scenario.
    regards,
    Sanjay

    Hi,
    The SDF has to be created with refernce to the Sales Order only.
    In Brief:-
    When ever the goods are damaged in transit,generally we ask them to scrap the damaged goods and then decide what to do like
    1) Either to give a credit note to the customer for the damaged goods.
                          or
    2)Replace the Goods by SDF.
    Check me if iam wrong
    Regards
    SK

  • Order from the invoice

    Friends,
    I have a list of Invoices, I want to get all the sales order of these invoices,
    How shoudl I receive this,is there any report or database view exist?
    Regards
    Prashant

    Hey Prashant,
    Goto Table VBFA and give the Invoice number in <b>follow o</b>n column VBELN, it'll give you the sales order number in <b>preceding document</b> column VBELV.
    Hope it helps.
    Priya

  • Quantity update into sales order using BAPI_SALESORDER_CREATEFROMDAT2

    Hi All,
    I am able to create a sales order using the BAPI "BAPI_SALESORDER_CREATEFROMDAT2".
    But even after assinging the Target_quntity and the Target_quantity_units, the values are not getting updated into the Sales order, but the sales order gets created .
    Did anyone of you had a similare problem, how was it solved.
    cold some one please help me out on this.
    Regards

    Hi
    I had used below code (using <b>BAPI_SALESORDER_CREATEFROMDAT1</b>)..but never faced any problem.. you can try the same...
    Regards,
    Raj
    REPORT  z_sd_salesorder_create
            NO STANDARD PAGE HEADING
            LINE-SIZE 150
            MESSAGE-ID zz.
                  S T R U C T U R E  D E C L A R A T I O N S             *
    TYPES: BEGIN OF x_ppl,
            ppl_order(18),   " ppl Orderno
            auart(4),         " Sales Doc Type
            vkorg(4),         " Sales Organization
            vtweg(2),         " Distribution Channel
            spart(2),         " Division
            div(3),           " Division
            kunnr(10),        " Sold-to Party
            date(10),         " Doc Dt
            matnr(18),        " Item Matnr#
            uom(3),           " UOM
            qty(15),          " Qty
           kschl(4),         " Pricing condiiton type
           kbetr(11),        " Rate
           END OF x_ppl.
    TYPES: BEGIN OF x_file,
            loc(30),          " Location
            div(3),           " Division
            ppl_order(18),   " ppl Orderno
            kunnr(10),        " Sold-to Party
            date(10),         " Doc Dt
            matnr(20),        " Item Matnr#
            qty(15),          " Qty
            uom(3),           " UOM
           kbetr(11),        " Rate
           discount(5),      " Discount
           END OF x_file.
    TYPES: BEGIN OF x_output,
            ppl_order(18),       " ppl Orderno
            mesg(130),            " Mesg Success/Error
           END OF x_output.
    TYPES: BEGIN OF x_werks,
            name2(30),                " Location
            werks TYPE werks_ext,     " Plant
           END OF x_werks.
    TYPES: BEGIN OF x_info,
            vkorg TYPE vkorg ,   " Sales org
            vtweg TYPE vtweg,    " Dist channel
            werks TYPE werks_ext," Plant
            spart TYPE spart,    " Storage Loc
           END OF x_info.
    TYPES: BEGIN OF x_material,
            ppl_prdid(20),      " ppl Prd id
            matnr TYPE matnr,    " Material (SAP)
           END OF x_material.
           I N T E R N A L    T A B L E    D E C L A R A T I O N S       *
    DATA: it_file  TYPE STANDARD TABLE OF x_file  WITH HEADER LINE." File Data
    DATA: it_data  TYPE STANDARD TABLE OF x_ppl  WITH HEADER LINE." ppl File
    DATA: it_out TYPE STANDARD TABLE OF x_output WITH HEADER LINE. " Outcome
    DATA: it_werks TYPE STANDARD TABLE OF x_werks WITH HEADER LINE.    " Plant
    DATA: it_info TYPE STANDARD TABLE OF x_info WITH HEADER LINE.      " Othr Info
    DATA: it_matnr TYPE STANDARD TABLE OF x_material WITH HEADER LINE. " Material Info
    DATA: it_item TYPE STANDARD TABLE OF bapiitemin WITH HEADER LINE.  "Order Itm data
    DATA: it_partner TYPE STANDARD TABLE OF bapipartnr WITH HEADER LINE. "Order Partner data
               V A R I A B L E S      D E C L A R A T I O N S            *
    DATA  : v_correct  TYPE i,
            v_error    TYPE i,
            v_total    TYPE i,
            v_return   LIKE bapireturn1,
            v_index    LIKE sy-tabix.
    *- Return values
    DATA: it_orderh TYPE bapisdhead, "Order Hdr data
          order TYPE bapivbeln-vbeln,
          soldto TYPE bapisoldto,
          shipto TYPE bapishipto,
          return TYPE bapireturn1.
    DATA: hdate   TYPE sy-datum.
                    U S E R   I N P U T S   S C R E E N                  *
    SELECTION-SCREEN: BEGIN OF BLOCK blk01 WITH FRAME TITLE text-t01.
    PARAMETERS: p_file TYPE rlgrap-filename OBLIGATORY. " File name
    SELECTION-SCREEN END OF BLOCK blk01.
                      S E L E C T I O N    S C R E E N                   *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      PERFORM get_file.
                    S t a r t    o f    S e l e c t i o n                *
    START-OF-SELECTION.
      PERFORM get_upload.
      PERFORM validate_data.        " Validate the data
      PERFORM data_swap.            " Prepare the data for processing
      IF NOT it_data[] IS INITIAL.
        PERFORM get_update.           " Create SalesOrders
      ELSE.
        MESSAGE i001(zz) WITH text-001.
        STOP.
      ENDIF.
                    E n d    o f    S e l e c t i o n                    *
    END-OF-SELECTION.
      IF NOT it_data[] IS INITIAL.
        PERFORM get_write.
      ENDIF.
    *&      Form  get_file
          Get File name
    FORM get_file .
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          program_name  = syst-repid
          mask          = '*'
        CHANGING
          file_name     = p_file
        EXCEPTIONS
          mask_too_long = 1
          OTHERS        = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " get_file
    *&      Form  get_upload
          to upload the file
    FORM get_upload .
      DATA l_file TYPE string.
      CLEAR: it_file, it_file[].
      l_file = p_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = l_file
          filetype                = 'ASC'
          has_field_separator     = 'X'
        TABLES
          data_tab                = it_file
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSEIF sy-subrc = 0.
        SORT it_file BY loc ppl_order.
      ENDIF.
    ENDFORM.                    " get_upload
    *&      Form  get_update
          Creating mapping Data in Z table
    FORM get_update .
      DATA: l_itemno(2) TYPE n,
            l_partner TYPE parvw,
            l_kunnr TYPE kunnr,
            l_matnr TYPE matnr,
            l_mesg TYPE string,
            l_kbetr TYPE p DECIMALS 2.
      DATA: l_in_qty LIKE vbap-zmeng,
            l_meins LIKE mara-meins,
            l_qty   LIKE vbap-zmeng.
      CLEAR: v_correct, v_error, v_total.
      SORT it_data BY ppl_order.
      LOOP AT it_data.
        CLEAR v_index.
        v_index = sy-tabix.
    *- New SalesOrder
        AT NEW ppl_order.
          READ TABLE it_data INDEX v_index.
          CLEAR: it_orderh, it_item, it_partner,
                 order, soldto, shipto, return,
                 it_item[], it_partner[].
          v_total = v_total + 1.  "Increment Total SalesOrders counter
          CLEAR l_itemno.
          l_itemno = '10'.
    *- Covert date fields into Internal format
          CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'
            EXPORTING
              datum = it_data-date
              dtype = 'DATS'
            IMPORTING
              idate = it_data-date.
    *- Populate SalesOrder header data.
          CALL FUNCTION 'CONVERSION_EXIT_AUART_INPUT'
            EXPORTING
              input  = it_data-auart
            IMPORTING
              output = it_data-auart.
          it_orderh-doc_type   = it_data-auart.
          it_orderh-sales_org  = it_data-vkorg.
          it_orderh-distr_chan = it_data-vtweg.
          it_orderh-division   = it_data-spart.
          it_orderh-purch_no   = 'DEPOT'.
          it_orderh-price_date = it_data-date.      "Doc Dt
          it_orderh-req_date_h = it_data-date.      "Del.Dt
          it_orderh-purch_no_s = it_data-ppl_order.
    *- Partner data
          CLEAR: l_partner, l_kunnr.
    *- Convert Partner type into internal format
          l_partner = 'SP'.  "SoldTo Party
          CALL FUNCTION 'CONVERSION_EXIT_PARVW_INPUT'
            EXPORTING
              input  = l_partner
            IMPORTING
              output = l_partner.
    *- Convert Customer into internal format
          l_kunnr = it_data-kunnr.
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = l_kunnr
            IMPORTING
              output = l_kunnr.
          it_partner-partn_role = l_partner.
          it_partner-partn_numb = l_kunnr.
          APPEND it_partner.
          CLEAR it_partner.
        ENDAT.
    *- Item data
        it_item-itm_number = l_itemno.
    *- Convert material number into internal format
        CLEAR l_matnr.
        l_matnr = it_data-matnr.
        CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
          EXPORTING
            input        = l_matnr
          IMPORTING
            output       = l_matnr
          EXCEPTIONS
            length_error = 1
            OTHERS       = 2.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        it_item-material  = l_matnr.
    *- Call FM to get new qty based on SAP UOM
        CLEAR: l_meins, l_qty, l_in_qty.
        l_in_qty = it_data-qty.
        CALL FUNCTION 'Z_GET_QTY_FROM_UOM'
          EXPORTING
            matnr     = it_item-material
            in_meins  = it_data-uom
            in_qty    = l_in_qty
          IMPORTING
            out_meins = l_meins
            quantity  = l_qty.
        IF sy-subrc = 0.
          it_data-qty = l_qty.
          it_data-uom = l_meins.
        ENDIF.
        it_data-qty = it_data-qty * 1000.
        it_item-req_qty = it_data-qty.
        it_item-sales_unit = it_data-uom.
        it_item-req_date   = it_data-date.
    *- Pricing data
       it_item-cond_type = it_data-kschl.  "Pricing condition
       CLEAR l_kbetr.
       l_kbetr = it_data-kbetr / 10. "Price (Rate)
       it_item-cond_value = l_kbetr.
        APPEND it_item.
        CLEAR  it_item.
    *- Increment Item counter.
        l_itemno = l_itemno + 10.
    *- At end of SalesOrder
        AT END OF ppl_order.
          READ TABLE it_data INDEX v_index.
    *- Call the BAPI for SalesOrder creation
          CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
            EXPORTING
              order_header_in = it_orderh
            IMPORTING
              salesdocument   = order
              sold_to_party   = soldto
              ship_to_party   = shipto
              return          = return
            TABLES
              order_items_in  = it_item
              order_partners  = it_partner.
          IF sy-subrc = 0.
            COMMIT WORK.
          ENDIF.
          v_return = return+0(1).
          IF v_return = 'E'.
            v_error = v_error + 1.
            CLEAR l_mesg.
            l_mesg = return.
            CONDENSE l_mesg.
          ELSE.
            v_correct = v_correct + 1.
            CLEAR l_mesg.
            CONCATENATE 'Salesorder'(007) order 'successfully created.'(008)
            INTO l_mesg SEPARATED BY space.
            CONDENSE l_mesg.
          ENDIF.
    *- Populate the output table
          CLEAR it_out.
          it_out-ppl_order = it_data-ppl_order.
          it_out-mesg = l_mesg.
          APPEND it_out.
          CLEAR it_out.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " get_update
    *&      Form  get_write
          Write the results
    FORM get_write .
      WRITE:/ 'Total Number of Records :'(002), v_total COLOR 1.
      WRITE:/ 'Total Correct Records   :'(003), v_correct COLOR 3.
      WRITE:/ 'Total Error Records     :'(004), v_error COLOR 6.
      SKIP 3.
      IF NOT it_out[] IS INITIAL.
        WRITE:/5 'ppl Order #'(005),
              28 'Message'(006).
      ENDIF.
      SKIP 1.
      LOOP AT it_out.
        WRITE:/5  it_out-ppl_order,
               28 it_out-mesg.
      ENDLOOP.
    ENDFORM.                    " get_write
    *&      Form  validate_data
          Validate the data
    FORM validate_data .
      DATA: l_bstkde TYPE bstkd_e.
      LOOP AT it_file.
        SELECT bstkd_e INTO l_bstkde
         UP TO 1 ROWS
         FROM vbkd
         WHERE bstkd_e = it_file-ppl_order.
        ENDSELECT.
        IF sy-subrc = 0.  " This ppl Order is already been created in SAP, so delete record
          DELETE it_file.
        ENDIF.
      ENDLOOP.
      SORT it_file BY ppl_order.
    ENDFORM.                    " validate_data
    *&      Form  data_swap
          Prepare the data for processing
    FORM data_swap .
      CLEAR: it_werks, it_info, it_matnr, it_data,
             it_werks[], it_info[], it_matnr[], it_data[].
      IF NOT it_file[] IS INITIAL.
    *- Get the plant from location
        SELECT name2
               werks
          INTO CORRESPONDING FIELDS OF TABLE it_werks
        FROM t001w FOR ALL ENTRIES IN it_file
        WHERE name2 = it_file-loc.
        IF sy-subrc = 0.
          SORT it_werks BY name2 werks.
    *- Get the Sales Org, Division and Distribution Channel
          IF NOT it_werks[] IS INITIAL.
            SELECT vkorg
                   vtweg
                   werks
            INTO CORRESPONDING FIELDS OF TABLE it_info
            FROM tvkwz FOR ALL ENTRIES IN it_werks
            WHERE werks = it_werks-werks.
            IF sy-subrc =  0.
              LOOP AT it_info.
                it_info-spart = '99'.
                MODIFY it_info INDEX sy-tabix.
              ENDLOOP.
              SORT it_info BY vkorg vtweg werks.
            ENDIF.
          ENDIF.
        ENDIF.
    *- Get material from ppl material
        SELECT ppl_prdid
               matnr
          FROM zppl_master
          INTO TABLE it_matnr FOR ALL ENTRIES IN it_file
          WHERE ppl_prdid = it_file-matnr.
        IF sy-subrc = 0.
          SORT it_matnr BY ppl_prdid matnr.
        ENDIF.
      ENDIF.
    *- Update the data in it_data
      LOOP AT it_file.
        CLEAR it_data.
       it_data-auart = 'OR'.
        it_data-auart = 'OR'.  " CHANGED BY Jo ON 3103005
        READ TABLE it_werks WITH KEY name2 = it_file-loc BINARY SEARCH.
        IF sy-subrc = 0.
          READ TABLE it_info WITH KEY werks = it_werks-werks BINARY SEARCH.
          IF sy-subrc = 0.
            it_data-vkorg = it_info-vkorg.
            it_data-vtweg = it_info-vtweg.
          ENDIF.
        ENDIF.
    *- Material
        READ TABLE it_matnr WITH KEY ppl_prdid = it_file-matnr BINARY SEARCH.
        IF sy-subrc = 0.
          it_data-matnr = it_matnr-matnr.
        ENDIF.
        it_data-ppl_order = it_file-ppl_order.
        it_data-date  = it_file-date.
        CONCATENATE it_file-kunnr it_file-loc+1(2) INTO it_data-kunnr.
        it_data-qty   = it_file-qty.
        it_data-uom   = it_file-uom.
       it_data-kbetr = it_file-kbetr.
    *- Pricing condition
       it_data-kschl = 'PR00'.
        CASE it_file-div.
          WHEN 'BRN'.
            it_data-div = '04'.
          WHEN 'GEN'.
            it_data-div = '03'.
          WHEN 'IVF'.
            it_data-div = '02'.
          WHEN 'OPH'.
            it_data-div = '01'.
        ENDCASE.
        it_data-spart = it_data-div.
        APPEND it_data.
        CLEAR  it_data.
      ENDLOOP.
    ENDFORM.                    " data_swap

Maybe you are looking for

  • Oracle9i Application Server Release 2

    Oracle9i Application Server Release 2, which includes Oracle9iAS Portal Release 3.1, is planned for the final calendar quarter of 2001. What are the new features of 9iAS Release 2 and Portal Release 3.1? Thank you.

  • Error while importing the database of Oracle 10.2g to MaxDB - DB Migration

    Hi, We are testing the data migration from Oracle 10.2g to MaxDB 7.6. First i have exported the oracle database without any errors. But while importing to MaxDB i am getting error as below, tail -f ImportMonitor.console.log java.class.version = 49.0

  • New hp envy all in one printer shows a blank page after scanning

    I just went through this problem with my old printer and hp sent me a refurbished (new) one. I go to scan something into my computer and it won't scan. It shows a blank page on preview. I checked the settings and they all seem to be right. I am not w

  • Itunes will not open on my mac book

    OS MAC OS X v10.4 TIGER itunes 7.4 Basically bought a new mac book, gone to open itunes and it wont open! Even when i put and CD in and connect my ipod to it as well. No error messages come up atal :s

  • How to include help files when building installer

    Hi! How can I include my application help manual (in .pdf format) when building the installer such that the file goes into a designated folder and its link appears in the Start>Programs>App folder ? Thanks, Gurdas Gurdas Singh PhD. Candidate | Civil