9 Replies Latest reply on Jul 2, 2013 8:26 AM by Akil Pariyani

    API to change the Ship To location on a sales order.

    user12116742
      Hello,

      We have a requirement to change the Ship To address from a custom page.
      Please let me know if there is a standard API which I can use to change the Ship To address on a sales order.

      Thanks in advance.

      Cheers!!!
        • 1. Re: API to change the Ship To location on a sales order.
          shreevat
          Check oe_order_pub package. oe_order_pub.process_order can be used for updating sales order header/line.

          Thanks
          Shree
          1 person found this helpful
          • 2. Re: API to change the Ship To location on a sales order.
            Akil Pariyani

            Hello shree,

            Is there any API to copy order.

             

            Thanx

            Akil

            • 3. Re: API to change the Ship To location on a sales order.
              David Weber

              Akil,

               

              I'd say use the same API / package: oe_order_pub

               

              You could use function/procedure GET_ORDER to retrieve the information about the order you want to copy and then use PROCESS_ORDER to create a new order.

               

              I found following thread that might be helpful for you, at least some start:COPY AN ORDER OE_ORDER_PUB.PROCESS_ORDER

               

              regards,

              David.

              • 4. Re: API to change the Ship To location on a sales order.
                user12116742


                Hi Shree,

                 

                I tried using the API to change the ship to. But now I am stuck with another error. Below is the error which I am receiving when I run the code. Please let me know what could be the issue.

                 

                Cheers!!!

                 

                Message from API ()

                *****************************

                Unit List Price is required on a booked order line.
                Unit List Price is required on a booked order line.

                *****************************

                 

                API Call

                -----------

                Declare
                    l_line_tbl                 oe_order_pub.line_tbl_type;
                    lx_header_rec              oe_order_pub.header_rec_type;
                    lx_header_val_rec          oe_order_pub.header_val_rec_type;
                    lx_header_adj_tbl          oe_order_pub.header_adj_tbl_type;
                    lx_header_adj_val_tbl      oe_order_pub.header_adj_val_tbl_type;
                    lx_header_price_att_tbl    oe_order_pub.header_price_att_tbl_type;
                    lx_header_adj_att_tbl      oe_order_pub.header_adj_att_tbl_type;
                    lx_header_adj_assoc_tbl    oe_order_pub.header_adj_assoc_tbl_type;
                    lx_header_scredit_tbl      oe_order_pub.header_scredit_tbl_type;
                    lx_header_scredit_val_tbl  oe_order_pub.header_scredit_val_tbl_type;
                    lx_line_tbl                oe_order_pub.line_tbl_type;
                    lx_line_val_tbl            oe_order_pub.line_val_tbl_type;
                    lx_line_adj_tbl            oe_order_pub.line_adj_tbl_type;
                    lx_line_adj_val_tbl        oe_order_pub.line_adj_val_tbl_type;
                    lx_line_price_att_tbl      oe_order_pub.line_price_att_tbl_type;
                    lx_line_adj_att_tbl        oe_order_pub.line_adj_att_tbl_type;
                    lx_line_adj_assoc_tbl      oe_order_pub.line_adj_assoc_tbl_type;
                    lx_line_scredit_tbl        oe_order_pub.line_scredit_tbl_type;
                    lx_line_scredit_val_tbl    oe_order_pub.line_scredit_val_tbl_type;
                    lx_lot_serial_tbl          oe_order_pub.lot_serial_tbl_type;
                    lx_lot_serial_val_tbl      oe_order_pub.lot_serial_val_tbl_type;
                    lx_action_request_tbl      oe_order_pub.request_tbl_type;
                    l_return_status            VARCHAR2(150);
                    l_msg_count                NUMBER;
                    l_msg_data                 VARCHAR2(240);
                    v_status_check1            varchar2(10);
                    v_err_msg1                 varchar2(240);
                    v_org_id                   NUMBER :='116';

                BEGIN

                    l_line_tbl := oe_order_pub.g_miss_line_tbl;
                    l_line_tbl(1) := oe_order_pub.g_miss_line_rec;
                    l_line_tbl(1).line_id := 24292869;
                    l_line_tbl(1).change_reason := 'ISTORE_UPDATE';
                    l_line_tbl(1).ship_to_org_id := 85096;
                    l_line_tbl(1).request_date := SYSDATE+7;--add lead time to the request date
                    l_line_tbl(1).operation := oe_globals.g_opr_update;

                    dbms_application_info.set_client_info(v_org_id);

                    oe_order_pub.process_order
                    (p_api_version_number => 1.0,
                    p_init_msg_list                  => fnd_api.g_true,
                    p_return_values                  => fnd_api.g_false,
                    x_return_status                  => l_return_status,
                    x_msg_count                      => l_msg_count,
                    x_msg_data                       => l_msg_data,
                    p_line_tbl                       => l_line_tbl,
                    x_header_rec                     => lx_header_rec,
                    x_header_val_rec                 => lx_header_val_rec,
                    x_header_adj_tbl                 => lx_header_adj_tbl,
                    x_header_adj_val_tbl             => lx_header_adj_val_tbl,
                    x_header_price_att_tbl           => lx_header_price_att_tbl,
                    x_header_adj_att_tbl             => lx_header_adj_att_tbl,
                    x_header_adj_assoc_tbl           => lx_header_adj_assoc_tbl,
                    x_header_scredit_tbl             => lx_header_scredit_tbl,
                    x_header_scredit_val_tbl         => lx_header_scredit_val_tbl,
                    x_line_tbl                       => lx_line_tbl,
                    x_line_val_tbl                   => lx_line_val_tbl,
                    x_line_adj_tbl                   => lx_line_adj_tbl,
                    x_line_adj_val_tbl               => lx_line_adj_val_tbl,
                    x_line_price_att_tbl             => lx_line_price_att_tbl,
                    x_line_adj_att_tbl               => lx_line_adj_att_tbl,
                    x_line_adj_assoc_tbl             => lx_line_adj_assoc_tbl,
                    x_line_scredit_tbl               => lx_line_scredit_tbl,
                    x_line_scredit_val_tbl           => lx_line_scredit_val_tbl,
                    x_lot_serial_tbl                 => lx_lot_serial_tbl,
                    x_lot_serial_val_tbl             => lx_lot_serial_val_tbl,
                    x_action_request_tbl             => lx_action_request_tbl
                );
                if l_msg_count > 0 then
                    for l_index in 1..l_msg_count loop
                       l_msg_data := oe_msg_pub.get(p_msg_index=>l_index,p_encoded=>'F');
                       dbms_output.put_line(l_msg_data);
                    end loop;
                end if;

                EXCEPTION
                    WHEN OTHERS THEN
                            DBMS_OUTPUT.PUT_LINE('Error occurred' || SQLERRM);
                            RAISE;
                END;
                /

                • 5. Re: API to change the Ship To location on a sales order.
                  David Weber

                  Hi, most probably your order is getting repriced if you change the ship-to address!? Try out the same update through the UI (Order Organizer Form or something) and see what happens. What if you just pass the original unit price as an attribute to the API?

                   

                  And have a look at following metalink note:

                  Why does the OE_Order_PUB.Process_Order API reprice the ORDER and ORDER Lines when called from a customized program ? [ID 728091.1]

                   

                  regards, David.

                  • 6. Re: API to change the Ship To location on a sales order.
                    user12116742

                    Thanks David!! Will have a look.

                    • 7. Re: API to change the Ship To location on a sales order.
                      shreevat

                      Comment these lines and check

                       

                      l_line_tbl := oe_order_pub.g_miss_line_tbl;

                          l_line_tbl(1) := oe_order_pub.g_miss_line_rec;

                       

                      Thanks

                      Shree

                      • 8. Re: API to change the Ship To location on a sales order.
                        Akil Pariyani

                        Thanx David

                         

                        I 'll try it.

                         

                         

                        Regards,

                        Akil

                        • 9. Re: API to change the Ship To location on a sales order.
                          Akil Pariyani

                          Hello

                           

                          Following metalink might be usefull for you

                           

                          Process Order API In Order Management [ID 746787.1]

                           

                           

                          Regards,

                          Akil