Close work order using api

hi every one..
can any one plz tell me how to close eam work order by using api
plz say to me how to approach.
thanks in advance
ram

hi sandeep..
thanks for your response..
but i need to close eam work order by using Work Order Business Object API.
in this api there one procedure calld Process_Master_Child_WO.
the sample code has been given by some body..as follows..plz help me how to use this code..because im not aware of api's
plz any one help me...
thanks in advance...
Ram.
set serveroutput on;
Declare
l_eam_wo_rec EAM_PROCESS_WO_PUB.eam_wo_rec_type;
l_eam_op_tbl EAM_PROCESS_WO_PUB.eam_op_tbl_type;
l_eam_op_network_tbl EAM_PROCESS_WO_PUB.eam_op_network_tbl_type;
l_eam_res_tbl EAM_PROCESS_WO_PUB.eam_res_tbl_type;
l_eam_res_inst_tbl EAM_PROCESS_WO_PUB.eam_res_inst_tbl_type;
l_eam_sub_res_tbl EAM_PROCESS_WO_PUB.eam_sub_res_tbl_type;
l_eam_res_usage_tbl EAM_PROCESS_WO_PUB.eam_res_usage_tbl_type;
l_eam_mat_req_tbl EAM_PROCESS_WO_PUB.eam_mat_req_tbl_type;
l_out_eam_wo_rec EAM_PROCESS_WO_PUB.eam_wo_rec_type;
l_out_eam_op_tbl EAM_PROCESS_WO_PUB.eam_op_tbl_type;
l_out_eam_op_network_tbl EAM_PROCESS_WO_PUB.eam_op_network_tbl_type;
l_out_eam_res_tbl EAM_PROCESS_WO_PUB.eam_res_tbl_type;
l_out_eam_res_inst_tbl EAM_PROCESS_WO_PUB.eam_res_inst_tbl_type;
l_out_eam_sub_res_tbl EAM_PROCESS_WO_PUB.eam_sub_res_tbl_type;
l_out_eam_res_usage_tbl EAM_PROCESS_WO_PUB.eam_res_usage_tbl_type;
l_out_eam_mat_req_tbl EAM_PROCESS_WO_PUB.eam_mat_req_tbl_type;
l_out_eam_direct_items_tbl EAM_PROCESS_WO_PUB.eam_direct_items_tbl_type;
x_eam_wo_rec EAM_PROCESS_WO_PUB.eam_wo_rec_type;
x_eam_op_tbl EAM_PROCESS_WO_PUB.eam_op_tbl_type;
x_eam_op_network_tbl EAM_PROCESS_WO_PUB.eam_op_network_tbl_type;
x_eam_res_tbl EAM_PROCESS_WO_PUB.eam_res_tbl_type;
x_eam_res_inst_tbl EAM_PROCESS_WO_PUB.eam_res_inst_tbl_type;
x_eam_sub_res_tbl EAM_PROCESS_WO_PUB.eam_sub_res_tbl_type;
x_eam_res_usage_tbl EAM_PROCESS_WO_PUB.eam_res_usage_tbl_type;
x_eam_mat_req_tbl EAM_PROCESS_WO_PUB.eam_mat_req_tbl_type;
x_eam_direct_items_tbl EAM_PROCESS_WO_PUB.eam_direct_items_tbl_type;
X_status VARCHAR2(4000);
X_msg_cnt NUMBER;
X_msg_data VARCHAR2(4000);
Begin
fnd_global.apps_initialize (user_id => 27789,
resp_id => 23119,
resp_appl_id => 426
COMMIT;
l_eam_wo_rec := null; Record Group need to be initialized at the beginning
l_eam_wo_rec.WIP_ENTITY_NAME := '665443';
l_eam_wo_rec.organization_id := 12384;
l_eam_wo_rec.attribute10 := '2112000245';
l_eam_wo_rec.NOTIFICATION_REQUIRED := NULL;
l_eam_wo_rec.TRANSACTION_TYPE := '2';
l_eam_wo_rec.ASSET_NUMBER := '11234';
l_eam_wo_rec.ASSET_GROUP_ID := 481810;
l_eam_wo_rec.SCHEDULED_START_DATE := sysdate;
l_eam_wo_rec.SCHEDULED_COMPLETION_DATE := SYSDATE;
l_eam_wo_rec.STATUS_TYPE := wip_constants.released; -'Unreleased';
l_eam_wo_rec.OWNING_DEPARTMENT := 6003;
l_eam_wo_rec.PRIORITY := 10 ;
l_eam_wo_rec.SHUTDOWN_TYPE := null;
l_eam_wo_rec.class_code := 'WS0';
--l_eam_wo_rec.material_issue_by_mo := 'N';
--l_eam_wo_rec.issue_zero_cost_flag := 'Y';
--l_eam_wo_rec.po_creation_time := 1;
--l_eam_wo_rec.job_quantity := 1;
--l_eam_wo_rec.notification_required := 'N';
/* Additional Parameters to be passed Start */
l_eam_wo_rec.ACTIVITY_TYPE := 1; --It should be the lookup code value for the activity_type
l_eam_wo_rec.maintenance_object_source := 1;
l_eam_wo_rec.maintenance_object_type := 3;
l_eam_wo_rec.maintenance_object_id := 26005;
l_eam_wo_rec.requested_start_date := SYSDATE;
l_eam_wo_rec.job_quantity := 1;
l_eam_wo_rec.wip_supply_type := null;
/* Additional Parameters to be passed End */
apps.EAM_PROCESS_WO_PUB.PROCESS_WO
( p_bo_identifier => 'EAM'
, p_api_version_number =>1.0
, p_init_msg_list =>TRUE
, p_commit => 'Y'
, p_eam_wo_rec =>l_eam_wo_rec
, p_eam_op_tbl =>l_eam_op_tbl
, p_eam_op_network_tbl =>l_eam_op_network_tbl
, p_eam_res_tbl =>l_eam_res_tbl
, p_eam_res_inst_tbl =>l_eam_res_inst_tbl
, p_eam_sub_res_tbl =>l_eam_sub_res_tbl
, p_eam_res_usage_tbl =>l_eam_res_usage_tbl
, p_eam_mat_req_tbl =>l_eam_mat_req_tbl
, p_eam_direct_items_tbl => l_out_eam_direct_items_tbl
, x_eam_wo_rec =>x_eam_wo_rec
, x_eam_op_tbl =>x_eam_op_tbl
, x_eam_op_network_tbl =>x_eam_op_network_tbl
, x_eam_res_tbl =>x_eam_res_tbl
, x_eam_res_inst_tbl =>x_eam_res_inst_tbl
, x_eam_sub_res_tbl =>x_eam_sub_res_tbl
, x_eam_res_usage_tbl =>x_eam_res_usage_tbl
, x_eam_mat_req_tbl =>x_eam_mat_req_tbl
, x_eam_direct_items_tbl => x_eam_direct_items_tbl
, x_return_status =>X_status
, x_msg_count =>X_msg_cnt
, p_debug =>'Y'
, p_output_dir => '/user/temp'
, p_debug_filename =>'Amit_6_EAM_WO_DEBUG2.log'
, p_debug_file_mode => 'a'
commit;
DBMS_OUTPUT.PUT_LINE('Status : '||X_status);
IF X_msg_cnt > 0 THEN
DBMS_OUTPUT.PUT_LINE('Error Occurred in WO Creation : '|| X_msg_cnt||' : '||SQLERRM||' : '||SQLCODE);
END IF;
DBMS_OUTPUT.PUT_LINE('First record inserted.......');
END;

Similar Messages

  • Create a work order using the BAPI for IW31

    Hi,
          I want to create a work order using the BAPI for IW31 tr. can any one help me with the program description.
    Full points will be awarded for the useful answers.
    Thanks and regards,
    Sunil

    hi,
      first use fm "bapi_po_create".
      then use fm "BAPI_ACC_GL_POSTING_POST"
    The demo environment was made with real business scenario in mind, but following subjects need to be addressed in a live implementation:
    •     No exceptions and error handling is implemented, except the order rejection (e.g. partly delivery);
    •     In Navision both XML Ports and the XML DOM has been used to integrate with SAP XI, because XML ports has some drawbacks regarding to Namespaces in XML Documents (mandatory in SAP XI);
    •     A minimum of SAP and Navision customization is required to implement this solution. (e.g. user exit in SAP, Navision XML DOM).

  • On Work Order using Object lists for equip u can manually create Notifi

    On a maintenance Work Order using Object lists for equipment you can manually create a notification for each line item.
    We want to automate this process to do this when we save the document.
    Any ideau2019s on how to do this?
    Does a user exit exist for this?

    Hi:
    Check with Tcode: IBIP - Plant maintenace batch input utility tool.
    Hope, it may help!
    Thanks,
    Murali.

  • Required Copy Sales Order using API

    Hello Everyone,
    I got a requirement to copy a sales order using API. Did anyone tried this?
    If possible give me API name or the script.
    Thanks in advance.
    Thanx and Regards,
    Akil

    These might be helpful to you.
    1. OEOIMP: Script To Populate Order Import Interface Tables From Existing Sales Order [ID 436215.1]
    2.http://sriniik.blogspot.in/2010/05/copy-sales-order-book-order-sales-order.html

  • How to Attach permit automatically to an work order using abap

    how to Attach permit automatically to an work order using abap
    Moderator message : Not enough re-search before posting, show the work you have already done, thread locked.
    Edited by: Vinod Kumar on Jan 30, 2012 2:16 PM

    At least make sure that you have a default method 'browse' in your class. I mean that make a method for "displaying" or "browsing" or whatever you want to happen when you click the object, and make it default. OR actually if I remember correctly there is a default method existing already, but put your code to there.
    Also try this:
    -Create a container element of type 'sales order' into your task
    -Bind the sales order object from workflow to the the task
    Regards,
    Karri

  • PM: Create notification from a work order using transaction IW32.

    Hi guys,
    I am trying to create a Notification for a Functional Location thru Work Order Using transaction Code IW32.
    The actual transaction works fine as below -
    1. Open a work order in change mode using T code IW32
    2. Choose tab "Objects" to see the list of functional locations.
    3. Select a line with a functional loc, for which you want to create Notification & click "Create" Button at the bottom of the list.
    4. Enter Notification type on the pop up screen & enter.
    5. Enter the activity code, text & start date on the notif create screen & click Back. You can see the temp Notif Number in the row selected from the object list.
    6. Click save on the order change screen & the Notification is saved & is associated with the order & func Loc..
    However I can not do this in a program.
    I tried using Batch Input method. It works, but the problem is if you have more than 1 page of the Objects (Func locations) in objects tab, you can not goto the next pages.
    I also tried using BAPI_ALM_NOTIF_CREATE. Which doesnot for this purpose. It tries to create Notification but can't associate with the order.
    I appreciate your help.
    Thank you,
    Raj

    Hi:
    Check with Tcode: IBIP - Plant maintenace batch input utility tool.
    Hope, it may help!
    Thanks,
    Murali.

  • Create Work Order Using BAPI in LSMW

    Hi All,
    I searched in SCN but i dint get the correct idea to create Work Order USING BAPI,
    Im trying to create Work Order Using BAPI in LSWM
    Can any one Give me Brief Idea to create Work Order(Either Component or Operations) (t code - IW31) using BAPI in LSMW
    Regards
    Smitha

    Hi All,
    I searched in SCN but i dint get the correct idea to create Work Order USING BAPI,
    Im trying to create Work Order Using BAPI in LSWM
    Can any one Give me Brief Idea to create Work Order(Either Component or Operations) (t code - IW31) using BAPI in LSMW
    Regards
    Smitha

  • Steps For Goods Receipt For Work Order Using Handling Units

    Hello MM gurus,
    I'm new to HU Management.  Can you please share with me the steps for executing a "Goods Receipt For Work Order" using Handling Units?
    I created a HU (1000000026), and then using transaction COWBHUWE I tried using that HU to create a goods receipt, but I keep getting the message below:
    Handling unit 1000000026 is not provided for goods receipt
    Message no. VHURM046
    Do you have to assign/plan HUs to Process Orders first? I think the problem is that I'm not understanding the process or the requirements for a goods receipt for work order using HU.

    Hello Manish Kumar,
    I've been doing Handling Units testing in our sandbox environment and I've been trying to Pack a Finished Product for a Process Order using
    1-Transaction code HU02 to create the Handling Unit
    2-Transaction COWBHUE after creating the HU to enter the production order number and the HU number and propose it, but the it doesn't work. When I propose it, nothing happens.
    3.-I also tried COWBPACK, but for some reason, when I go into COWBPACK, key in the Process Order, and then press enter, I get the following message:
    You do not have authorization to create handling units for plant BP08
    Message no. VHUPD500
    Do you know how to solve this issue?

  • How to upload work orders using IW31

    HI,
    I am trying to upload PM Work orders using tcode IW31 but unable to do so. I have tried LSMW and now I am trying for BDC but still can't upload. Can anyone let me know what procedure do I need to perform for uploading DATA through IW31.
    Its really very important.
    Thanks.
    Regards,
    Yahya

    Hey
    You can upload the data for creating a work orders through IW31/IW34.
    IW31 is for Work Orders with out a Notification(In general) and IW34 is for Orders with Notification(Must)
    So if you want to load Orders With Notification Then first we need to create a Notification in IW24 and then Order in IW34 with the Notification created at that point.
    If you want to create Order with out Notification then Goto IW31 and then create it through BDC method.
    There might be a scenario in which you can create a Order w/o Notification and with Notfication sometimes in IW31 Only.
    Then at that point you need to goto IW31 and create a Order First and then Display the Order in IW33 and Click on Change from the top of the menu. It wil allow you to create a Notification from there(IW31) beside the Euipment field I remember.
    You can try it with BDC. if you still have a problem in doing so. i will send the code.
    Regards,
    Bhargav.

  • Have a Problem in EAM work order creation API........

    I have used the following code to create work order but i was unable to do so
    I am getting return status SUCCESS(S)....
    but am unable to view the record in EAM_WORK_ORDERS_V..
    any sort of help would be appreciated...
    declare
    g_eam_wo_relations_tbl0 eam_process_wo_pub.eam_wo_relations_tbl_type;
    g_eam_wo_relations_rec eam_process_wo_pub.eam_wo_relations_rec_type;
    g_eam_op_rec0 eam_process_wo_pub.eam_op_rec_type;
    g_eam_op_rec1 eam_process_wo_pub.eam_op_rec_type;
    g_eam_op_network_rec0 eam_process_wo_pub.eam_op_network_rec_type;
    g_eam_op_network_rec1 eam_process_wo_pub.eam_op_network_rec_type;
    g_eam_mat_req_rec0 eam_process_wo_pub.eam_mat_req_rec_type;
    g_eam_mat_req_rec1 eam_process_wo_pub.eam_mat_req_rec_type;
    g_eam_di_rec0 eam_process_wo_pub.eam_direct_items_rec_type;
    g_eam_di_rec1 eam_process_wo_pub.eam_direct_items_rec_type;
    g_eam_res_rec0 eam_process_wo_pub.eam_res_rec_type;
    g_eam_res_rec1 eam_process_wo_pub.eam_res_rec_type;
    g_eam_res_inst_rec0 eam_process_wo_pub.eam_res_inst_rec_type;
    g_eam_res_inst_rec1 eam_process_wo_pub.eam_res_inst_rec_type;
    g_eam_op_tbl0 EAM_PROCESS_WO_PUB.eam_op_tbl_type;
    g_eam_op_tbl1 EAM_PROCESS_WO_PUB.eam_op_tbl_type;
    g_eam_op_network_tbl0 EAM_PROCESS_WO_PUB.eam_op_network_tbl_type;
    g_eam_res_tbl0 EAM_PROCESS_WO_PUB.eam_res_tbl_type;
    g_eam_res_inst_tbl0 EAM_PROCESS_WO_PUB.eam_res_inst_tbl_type;
    g_eam_sub_res_tbl0 EAM_PROCESS_WO_PUB.eam_sub_res_tbl_type;
    g_eam_res_usage_tbl0 EAM_PROCESS_WO_PUB.eam_res_usage_tbl_type;
    g_eam_mat_req_tbl0 EAM_PROCESS_WO_PUB.eam_mat_req_tbl_type;
    g_eam_di_tbl0 EAM_PROCESS_WO_PUB.eam_direct_items_tbl_type;
    g_out_eam_wo_relations_tbl eam_process_wo_pub.eam_wo_relations_tbl_type;
    g_out_eam_wo_rec eam_process_wo_pub.eam_wo_rec_type;
    g_out_eam_wo_tbl eam_process_wo_pub.eam_wo_tbl_type;
    g_out_eam_op_tbl EAM_PROCESS_WO_PUB.eam_op_tbl_type;
    g_out_eam_op_network_tbl EAM_PROCESS_WO_PUB.eam_op_network_tbl_type;
    g_out_eam_res_tbl EAM_PROCESS_WO_PUB.eam_res_tbl_type;
    g_out_eam_res_inst_tbl EAM_PROCESS_WO_PUB.eam_res_inst_tbl_type;
    g_out_eam_sub_res_tbl EAM_PROCESS_WO_PUB.eam_sub_res_tbl_type;
    g_out_eam_res_usage_tbl EAM_PROCESS_WO_PUB.eam_res_usage_tbl_type;
    g_out_eam_mat_req_tbl EAM_PROCESS_WO_PUB.eam_mat_req_tbl_type;
    g_out_eam_di_tbl EAM_PROCESS_WO_PUB.eam_direct_items_tbl_type;
    g_eam_wo_rec1 eam_process_wo_pub.eam_wo_rec_type;
    g_eam_wo_rec2 eam_process_wo_pub.eam_wo_rec_type;
    g_eam_wo_tbl0 eam_process_wo_pub.eam_wo_tbl_type;
    g_eam_wo_res_usg_tbl0 eam_process_wo_pub.eam_res_usage_tbl_type;
    l_return_status VARCHAR2(1);
    l_msg_count NUMBER;
    g_eam_wo_usg_rec1 eam_process_wo_pub.eam_res_usage_rec_type;
    g_eam_wo_usg_rec2 eam_process_wo_pub.eam_res_usage_rec_type;
    begin
    g_eam_wo_rec1 := null;
    g_eam_wo_rec1.transaction_type := EAM_PROCESS_WO_PVT.G_OPR_CREATE;
    g_eam_wo_rec1.batch_id := 1;
    G_EAM_WO_REC1.HEADER_ID := 1;
    G_EAM_WO_REC1.WIP_ENTITY_ID := NULL;
    g_eam_wo_rec1.wip_entity_name := '10040';
    g_eam_wo_rec1.organization_id := 207;
    g_eam_wo_rec1.asset_group_id := 16884;
    g_eam_wo_rec1.asset_number := '28Z1933';
    g_eam_wo_rec1.rebuild_item_id := null;
    g_eam_wo_rec1.rebuild_serial_number := null;
    G_EAM_WO_REC1.MAINTENANCE_OBJECT_SOURCE := 1;
    g_eam_wo_rec1.maintenance_object_type := 3;
    g_eam_wo_rec1.maintenance_object_id := 1768219;
    g_eam_wo_rec1.parent_wip_entity_id := null;
    g_eam_wo_rec1.manual_rebuild_flag := null;
    g_eam_wo_rec1.owning_department := 4002 ;
    g_eam_wo_rec1.description := 'Creating a Released Work Order';
    g_eam_wo_rec1.class_code := 'MAINT';
    g_eam_wo_rec1.status_type := wip_constants.released;
    g_eam_wo_rec1.date_released := sysdate-100;
    g_eam_wo_rec1.firm_planned_flag := 1;
    g_eam_wo_rec1.scheduled_start_date := sysdate;
    g_eam_wo_rec1.requested_start_date := sysdate;
    g_eam_wo_rec1.scheduled_completion_date := sysdate;
    g_eam_wo_rec1.material_issue_by_mo := 'N';
    g_eam_wo_rec1.priority := 10;
    g_eam_wo_rec1.issue_zero_cost_flag := 'Y';
    g_eam_wo_rec1.po_creation_time := 1;
    g_eam_wo_rec1.job_quantity := 1;
    g_eam_wo_rec1.notification_required := 'N';
    g_eam_wo_tbl0(1) := g_eam_wo_rec1;
    EAM_PROCESS_WO_PUB.PROCESS_WO
    ( p_bo_identifier => 'EAM'
    , p_api_version_number => 1.0
    , p_init_msg_list => TRUE
    , p_commit => 'Y'
    , p_eam_wo_rec => g_eam_wo_rec1
    , p_eam_op_tbl => g_eam_op_tbl0
    , p_eam_op_network_tbl => g_eam_op_network_tbl0
    , p_eam_res_tbl => g_eam_res_tbl0
    , p_eam_res_inst_tbl => g_eam_res_inst_tbl0
    , p_eam_sub_res_tbl => g_eam_sub_res_tbl0
    , p_eam_res_usage_tbl => g_eam_res_usage_tbl0
    , p_eam_mat_req_tbl => g_eam_mat_req_tbl0
    , p_eam_direct_items_tbl => g_eam_di_tbl0
    , x_eam_wo_rec => g_eam_wo_rec2
    , x_eam_op_tbl => g_out_eam_op_tbl
    , x_eam_op_network_tbl => g_out_eam_op_network_tbl
    , x_eam_res_tbl => g_out_eam_res_tbl
    , x_eam_res_inst_tbl => g_out_eam_res_inst_tbl
    , x_eam_sub_res_tbl => g_out_eam_sub_res_tbl
    , x_eam_res_usage_tbl => g_eam_res_usage_tbl0
    , x_eam_mat_req_tbl => g_out_eam_mat_req_tbl
    , x_eam_direct_items_tbl => g_out_eam_di_tbl
    , x_return_status => l_return_status
    , x_msg_count => l_msg_count
    , p_debug => 'Y'
    , p_output_dir => '/sqlcom/log/lv115dyp'
    , p_debug_filename => 'eambo22.log'
    , p_debug_file_mode => 'w'
    dbms_output.put_line('work order creation status:'||l_return_status);
    commit;
    END;
    thanks in advance
    DEV

    You have opened the render engine, not the full program.
    Mylenium

  • Book Sales Order using API

    Hi ,
    I am using Oe_Order_Pub.Process_Order api to create the Sales Orders. I am setting flow_status_code = 'BOOKED then also , sales order is created in Entered status only.
    How to book the sales order to Booked status.
    Regards/Prasanth

    i am assigning the following fields also
    open_flag = 'Y'
    booked_flag = 'Y'
    booked_date = SYSDATE
    Then also System creating Sales Order in Entered status only.
    Regards/Prasanth

  • Updating quantity in sales order using api

    Hi all,
    SET SERVEROUTPUT ON;
    DECLARE
    v_api_version_number NUMBER := 1;
    v_return_status VARCHAR2 (2000);
    v_msg_count NUMBER;
    v_msg_data VARCHAR2 (2000);
    -- IN Variables --
    v_header_rec oe_order_pub.header_rec_type;
    v_line_tbl oe_order_pub.line_tbl_type;
    v_action_request_tbl oe_order_pub.request_tbl_type;
    v_line_adj_tbl oe_order_pub.line_adj_tbl_type;
    -- OUT Variables --
    v_header_rec_out oe_order_pub.header_rec_type;
    v_header_val_rec_out oe_order_pub.header_val_rec_type;
    v_header_adj_tbl_out oe_order_pub.header_adj_tbl_type;
    v_header_adj_val_tbl_out oe_order_pub.header_adj_val_tbl_type;
    v_header_price_att_tbl_out oe_order_pub.header_price_att_tbl_type;
    v_header_adj_att_tbl_out oe_order_pub.header_adj_att_tbl_type;
    v_header_adj_assoc_tbl_out oe_order_pub.header_adj_assoc_tbl_type;
    v_header_scredit_tbl_out oe_order_pub.header_scredit_tbl_type;
    v_header_scredit_val_tbl_out oe_order_pub.header_scredit_val_tbl_type;
    v_line_tbl_out oe_order_pub.line_tbl_type;
    v_line_val_tbl_out oe_order_pub.line_val_tbl_type;
    v_line_adj_tbl_out oe_order_pub.line_adj_tbl_type;
    v_line_adj_val_tbl_out oe_order_pub.line_adj_val_tbl_type;
    v_line_price_att_tbl_out oe_order_pub.line_price_att_tbl_type;
    v_line_adj_att_tbl_out oe_order_pub.line_adj_att_tbl_type;
    v_line_adj_assoc_tbl_out oe_order_pub.line_adj_assoc_tbl_type;
    v_line_scredit_tbl_out oe_order_pub.line_scredit_tbl_type;
    v_line_scredit_val_tbl_out oe_order_pub.line_scredit_val_tbl_type;
    v_lot_serial_tbl_out oe_order_pub.lot_serial_tbl_type;
    v_lot_serial_val_tbl_out oe_order_pub.lot_serial_val_tbl_type;
    v_action_request_tbl_out oe_order_pub.request_tbl_type;
    v_msg_index NUMBER;
    v_data VARCHAR2 (2000);
    v_loop_count NUMBER;
    v_debug_file VARCHAR2 (200);
    b_return_status VARCHAR2 (200);
    b_msg_count NUMBER;
    b_msg_data VARCHAR2 (2000);
    BEGIN
    DBMS_OUTPUT.PUT_LINE('Starting of script');
    -- Setting the Enviroment --
    mo_global.init('ONT');
    fnd_global.apps_initialize ( user_id => 1153,resp_id => 50602,resp_appl_id => 7000);
    mo_global.set_policy_context('S',85);
    -- Header Record --
    --v_header_rec                        := oe_order_pub.g_miss_header_rec;
    --v_header_rec.operation              := OE_GLOBALS.G_OPR_UPDATE;
    v_header_rec.request_date           := SYSDATE + 1; Updating the Request Date
    v_header_rec.header_id              := 6006; Existing order header id
    v_action_request_tbl (1) := oe_order_pub.g_miss_request_rec;
    -- Line Record --
    v_line_tbl (1) := oe_order_pub.g_miss_line_rec;
    --v_line_tbl (1).operation            := oe_globals.g_opr_create;
    v_line_tbl (1).header_id := 1087; -- Existing order header id
    --v_line_tbl (1).inventory_item_id    := 9;
    v_line_tbl (1).ordered_quantity := 1;
    v_line_tbl(1).invoice_to_org_id := 1060;
    v_line_tbl(1).line_id := 1046;
    v_line_tbl(1).change_reason := 'Not provided';
    --v_line_tbl (1).unit_selling_price   := 10;
    --v_line_tbl (1).unit_list_price   := 10;
    --v_line_tbl (1).calculate_price_flag := 'Y';
    v_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
    DBMS_OUTPUT.PUT_LINE('Starting of API');
    -- Calling the API to update the header details of an existing Order --
    OE_ORDER_PUB.PROCESS_ORDER (
    p_api_version_number => v_api_version_number,
    p_header_rec => v_header_rec,
    p_line_tbl => v_line_tbl,
    p_action_request_tbl => v_action_request_tbl,
    p_line_adj_tbl => v_line_adj_tbl, -- OUT variables,
    x_header_rec => v_header_rec_out,
    x_header_val_rec => v_header_val_rec_out,
    x_header_adj_tbl => v_header_adj_tbl_out,
    x_header_adj_val_tbl => v_header_adj_val_tbl_out,
    x_header_price_att_tbl => v_header_price_att_tbl_out,
    x_header_adj_att_tbl => v_header_adj_att_tbl_out,
    x_header_adj_assoc_tbl => v_header_adj_assoc_tbl_out,
    x_header_scredit_tbl => v_header_scredit_tbl_out,
    x_header_scredit_val_tbl => v_header_scredit_val_tbl_out,
    x_line_tbl => v_line_tbl_out,
    x_line_val_tbl => v_line_val_tbl_out,
    x_line_adj_tbl => v_line_adj_tbl_out,
    x_line_adj_val_tbl => v_line_adj_val_tbl_out,
    x_line_price_att_tbl => v_line_price_att_tbl_out,
    x_line_adj_att_tbl => v_line_adj_att_tbl_out,
    x_line_adj_assoc_tbl => v_line_adj_assoc_tbl_out,
    x_line_scredit_tbl => v_line_scredit_tbl_out,
    x_line_scredit_val_tbl => v_line_scredit_val_tbl_out,
    x_lot_serial_tbl => v_lot_serial_tbl_out,
    x_lot_serial_val_tbl => v_lot_serial_val_tbl_out,
    x_action_request_tbl => v_action_request_tbl_out,
    x_return_status => v_return_status,
    x_msg_count => v_msg_count,
    x_msg_data => v_msg_data);
    DBMS_OUTPUT.PUT_LINE('Completion of API');
    IF v_return_status = fnd_api.g_ret_sts_success THEN
    COMMIT;
    DBMS_OUTPUT.put_line ('Order Header Updation Success : '||v_header_rec_out.header_id);
    ELSE DBMS_OUTPUT.put_line ('Order Header Updation failed:'||v_msg_data);
    ROLLBACK;
    FOR i IN 1 .. v_msg_count
    LOOP v_msg_data := oe_msg_pub.get( p_msg_index => i, p_encoded => 'F');
    dbms_output.put_line( i|| ') '|| v_msg_data);
    END LOOP;
    END IF;
    END;
    im getting errors pls send me a solution
    rgds,
    sandy

    if you just want to change qty , then comment v_line_tbl(1).invoice_to_org_id := 1060; and try to run again
    Regards
    eoracleapps.blogspot.com

  • Create work order using BAPI_ALM_ORDER_MAINTAIN

    Does anybody know how to use BAPI_ALM_ORDER_MAINTAIN to create a maintenance order?  I did a where used and it isn't used by SAP.  The documentation makes it look like I can use it for create but I am not sure how to do that.
    Regards,
    Davis

    Hi,
    I have one sample code piece. try to fit your requirement.
    TYPES: t_alm_method       type bapi_alm_order_method occurs 1.
    TYPES: t_alm_component    type bapi_alm_order_component occurs 1.
    TYPES: t_alm_component_up type bapi_alm_order_component_up occurs 1.
    TYPES: BEGIN of tp_sv_update,
             aufnr            type aufnr,             
             method           type t_alm_method,
             component        type t_alm_component,
             component_up     type t_alm_component_up,
           END of tp_sv_update.
      DATA:    ls_method       type bapi_alm_order_method.
      DATA:    ls_component    type bapi_alm_order_component.
      DATA:    ls_component_up type bapi_alm_order_component_up.
      DATA:    ls_sv_update    type tp_sv_update.
      DATA:    lv_tabix        like sy-tabix.
      STATICS: sv_refno        type i.
        clear: lv_tabix, sv_refno.
        ls_sv_update-aufnr     =  gt_alv1_data-aufnr.
      endif.
      sv_refno  = sv_refno + 1.
      ls_method-refnumber      =  sv_refno.
      ls_method-objecttype     =  'COMPONENT'.
      ls_method-method         =  'CHANGE'.
      ls_method-objectkey      =  gt_alv1_data-aufnr.
      APPEND ls_method to ls_sv_update-method.
      if sv_refno eq 1.
        ls_method-refnumber      =  sv_refno.
        ls_method-objecttype     =  space.
        ls_method-method         =  'SAVE'.
        ls_method-objectkey      =  gt_alv1_data-aufnr.
        APPEND ls_method to ls_sv_update-method.
      endif.
      ls_component-reserv_no   =  gt_alv1_data-rsnum.
      ls_component-res_item    =  gt_alv1_data-rspos.
      ls_component-activity    =  gt_alv1_data-vornr.
      ls_component-material    =  gt_alv1_data-matnr.
      if gt_alv1_data-menge_up is not initial.
        ls_component-requirement_quantity =  gt_alv1_data-menge_up.
      endif.
      if gt_alv1_data-netpr_up is not initial.
        ls_component-price       =  gt_alv1_data-netpr_up.
        ls_component-currency    =  gt_alv1_data-waers.
    *   It appears the Price is not updated unless the quantity is
        if gt_alv1_data-menge_up is initial.
          ls_component-requirement_quantity =  gt_alv1_data-bdmng.
        endif.
      endif.
      APPEND ls_component to ls_sv_update-component.
      if gt_alv1_data-menge_up is not initial.
        ls_component_up-requirement_quantity =  'X'.
      endif.
      if gt_alv1_data-netpr_up is not initial.
        ls_component_up-price    =  'X'.
        ls_component_up-currency =  'X'.
    *   It appears the Price is not updated unless the quantity is
        ls_component_up-requirement_quantity =  'X'.
      endif.
      APPEND ls_component_up to ls_sv_update-component_up.
      if lv_tabix is not initial.
        SORT    ls_sv_update-method by method.
        MODIFY  gt_sv_update  from ls_sv_update
          index lv_tabix transporting method component component_up.
      else.
        APPEND  ls_sv_update    to gt_sv_update.
      endif.
      if gt_alv1_data-menge_up is not initial.
        move 'UPDATED'  to gt_alv1_data-input_menge.
      endif.
      if gt_alv1_data-netpr_up is not initial.
        move 'UPDATED'  to gt_alv1_data-input_netpr.
      endif.
      modify gt_alv1_data transporting input_menge input_netpr.
      LOOP at gt_sv_update.
        CLEAR: lt_return[].
        CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
          TABLES
            it_methods      = gt_sv_update-method
            it_component    = gt_sv_update-component
            it_component_up = gt_sv_update-component_up
            return          = lt_return.
    ENDLOOP.

  • Work Center update during work order save (SAP PM) using exit IWO10009

    Hi All,
    I am updating the work center in the operation record of a work order using exit IWO1009. In the debug, the internal table for operation is updated successfully. But once the processing is done and I see the order though t-code IW33, I couldn't see the updated workcenter. And surprisingly, plant field which I am updating with work center, is getting updated in the operation and I can see this in IW33.
    Pls help.
    Thanks,
    Bhaskar

    Here is the code:
        REFRESH : lt_afvgd.
    Getting Operation details
        CALL FUNCTION 'CO_BO_OPR_OF_ORDER_GET'
          EXPORTING
            aufnr_imp = caufvd_imp-aufnr
          TABLES
            afvgd_get = lt_afvgd.
        IF caufvd_imp-AUART = lc_auart1 or caufvd_imp-AUART = lc_auart2 .
    Determination of Work Centre for Operation Relevent To PTE Eng.
          CLEAR : ls_afvgd.
          READ TABLE lt_afvgd INTO ls_afvgd WITH KEY usr00 = 'PTE'.
          IF sy-subrc eq 0.
            ls_afvgd-arbpl  = caufvd_imp-VAPLZ.
            ls_afvgd-WERKS  = caufvd_imp-VAWRK.
            MODIFY lt_afvgd  FROM ls_afvgd TRANSPORTING arbpl WERKS WHERE usr00 = 'PTE'.
          ENDIF.
        endif.
    **-- Updating operations buffer
        CALL FUNCTION 'CO_BO_UPDATE_OPR_OF_ORDER'
          TABLES
            afvgd_upd = lt_afvgd.

  • Close Sale Orders via DTW

    Hi,
    I want to close Sales Orders using DTW but I got an error:
    Document rows Cannot be closed concurrently.
    I read some threads:
    Link: [Document rows Cannot be closed concurrently - Purchase Orders;
    Link: [How to close a row in a Sales Order?;
    Link: [Closing Order rows;
    Link: [Documents rows cannot be closed concurrently with the other document modify;
    and many more but couldn't solve problem.
    I work on 8.8 version and try to close Sale Order that has few rows. I can close line via UI ( right mouse button and choose close line) but when I try to do it via DTW I have an error.
    I disabled all formatted searches and it didn't help.
    Need help.
    Reagrds
    Szymon

    Hi,
    the problem now is not the error message. The problem is: what about the sales order which should be lost after we regenerate the program RSM13000?
    We installed the following support packages:
    1.     SPAM and SAINT      from 26 to 38
    2.     SAP Basis:           From SAPKB62047 to SAPKB62068
    3.     SAP_ABA:          SAPKA62047 to SAPKA62068
    a.     And 2 CRT
    4.     SAP_APPL          SAPKH47022 to SAPKH47033
    5.     SAP_HR:          SAPKE47024 to SAPKE47099
    6.     SAP_IPPE:          SAPKGPIA06 to SAPKGPIA28
    7.     PI:               SAPKIPZI55 to SAPKIPZI59  
    8.     PI_Basis:          SAPKIPYI57 to  SAPKIPYI59 
    9.     ST_PI:               SAPKITLQG7 to SAPKITLQG8 
    10.     EA_APPL:          SAPKGPAA06 to SAPKGPAA29
    11.     EA_FINSERV:          SAPKGPFA06 to SAPKGPFA29
    12.     EA_GL TRADE          SAPKGPGA06 to SAPKGPGA29
    13.     EA_HR               SAPKGPHA10 to u2026u2026  SAPKGPHA99
    14.     EA_PS               SAPKGPPA06 to SAPKGPPA29     
    15.     EA_RETAIL:          SAPKGPRA06 to  SAPKGPRA29
    Thanks in advance
    Hanseatik

Maybe you are looking for