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
Similar Messages
-
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,
AkilThese 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 -
Update quantity in sales order by 'BAPI_SALESORDER_CHANGE'
I am trying to use the 'BAPI_SALESORDER_CHANGE' to change a sales order. I have to add a line item for empties in the sales order. the line gets sucessfully added but the quantity is not gettign updated.
I have tried all the fields of table ITEM_IN (target_qty COMP_QUANT RNDDLV_QTY) and set the flag for the corresponding in item_in as 'X' but still the order quantity field in sales order remains empty. How can I add the value in order quantity.Hi,
Have you tried using the BAPI table SCHEDULE_LINES? This should work. Just add one line to this table for the required quantity.
Hope this helps,
Sumant. -
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/Prasanthi 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 -
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.
RegardsHi
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 -
Update the material quantity in the sales order using LSMW...
Hi Guru's,
I created one sales order using BAPI..now i wanted update the material quantity in the sales order using LSMW...
could you please provide the step by step process....
if anyone of you provide the program logic similar to requirement that would be helpfull to me...
thanks in advance
Srinivas....Hi Sri,
Hope it may help you.
First do the recording for VA02 transaction, in that give the existing sales order number
and update the Quantity and save it. Remaining steps are same what we used(LSMW) to upload data to applications.
Regards,
Vishvesh
if helpful, rewards it. -
Open quantity in Sales Order did not update after cancelling Reserve Invoice
Client created Credit Memo with reference to Reserve Invoice but this did not update the open quantity in Sales Order. Client is using SAP B1 8.82 PL9. I tested this in SAP 9.0 and still same behavior. Is there a work around other than creating another SO?
I checked Document Settings and "Reopening Doc by creating credit memo based on Doc" is enabled.
Thanks in advance.Thanks for the reply. How will the client be able to make new reserve invoices from the SO? They are trying to make partial reserve invoices from the sales order. I already suggested to just change the quantity in the reserve invoice before adding. But I have doubt because the SO might close prematurely before they complete the quantity in the SO because open quantity is much less then the quantity in SO.
SO Quantity: 100
Open Quantity: 40
Reserve Invoice 1: 60
Reserve Invoice 2: 40
SO closes before they can make Reserve Invoice 2 -
How to update sales orders using B1WS in SAP 8.8 PL18
Hello all.
We are having a problem updating sales orders using Sap Business One Web Service ( B1WS ).
We are running SBO 8.8 PL18, MS-SQL 2008, and all is fine when using the SBO client.
But when it comes to updating sales orders through B1WS we just cannot get it to work.
We can add new orders easily without problems. Updating orders always gives this error:
\[ORDR.PayDuMonth\]\[line: 0\] , 'Field cannot be updated (ODBC -1029)'
We have checked and verified multiple times that our setup is correct.
Also the WDSL files are verified.
We can update orders just fine using the sboclient.
And using B1WS we can basically do everything, besides updating.
We have also tried this on different company db's, so we are quite sure this is not
something related to some general setting we missed, but who knows?
We have tried different ways to "assemble" the order before updating, but it always
ends with the above error.
Here is an example of one of the tests, where we load an order by docentry,
increment the quantity of all open lines by '1', and then try to update it.
protected void Page_Load(object sender, EventArgs e)
// First we login
string sessionId = "";
LoginService.LoginService l_login = new LoginService.LoginService();
LoginService.LoginDatabaseType l_dbtype = LoginService.LoginDatabaseType.dst_MSSQL2008;
LoginService.LoginLanguage _lang = LoginService.LoginLanguage.ln_English;
string _server = "SAP-8_8PL18";
string _licserver = "SAP-8_8PL18:30000";
string _db = "my_test_company";
string _user = "manager";
string _pass = "********";
try
sessionId = l_login.Login(_server, _db, l_dbtype, true, _user, _pass,
_lang, true, _licserver);
catch (Exception ex)
Response.Clear();
Response.Write(ex.Message);
Response.End();
if (sessionId == "")
Response.Clear();
Response.Write("No sessionId");
Response.End();
// We are logged in and have a sessionId
// Now load a valid open order by docentry
try
OrdersServiceRef.OrdersService orderService = new OrdersServiceRef.OrdersService();
orderService.MsgHeaderValue = new OrdersServiceRef.MsgHeader();
orderService.MsgHeaderValue.SessionID = sessionId;
orderService.MsgHeaderValue.ServiceName = OrdersServiceRef.MsgHeaderServiceName.OrdersService;
orderService.MsgHeaderValue.ServiceNameSpecified = true;
OrdersServiceRef.DocumentParams docParams = new OrdersServiceRef.DocumentParams();
docParams.DocEntry = 31; // Docentry of a known open order
docParams.DocEntrySpecified = true;
OrdersServiceRef.Document order = orderService.GetByParams(docParams);
OrdersServiceRef.DocumentDocumentLine line = null;
for (int i = 0; i < order.DocumentLines.Length; i++)
line = order.DocumentLines<i>;
if (line.LineStatus == OrdersServiceRef.DocumentDocumentLineLineStatus.bost_Open)
line.Quantity += 1;
orderService.Update(order);
catch (System.Web.Services.Protocols.SoapException ex)
Response.Clear();
Response.Write(ex.Message);
Response.End();
catch (Exception ex)
Response.Clear();
Response.Write(ex.Message);
Response.End();
Response.Clear();
Response.Write("All OK");
Response.End();
I hope that someone has an idea as to why this happens.
The customer often changes quantity or adds lines on their orders,
and the only way to solve it so far has been to make a new order and
close the old one.
Thanks in advance
J. ThomsenHi,
Welcome you post on the forum.
Have you checked if you only update a specific line instead of a loop?
Thanks,
Gordon -
Price is not being updated when creating a sales order using DTW oOrders
Hello experts,
When I create a sales Order using DTW (oOrders), the information in the input files document.csv and document_lines.csv is updated with no problem, except the price. The price is being ignored from the input files.
Is there something that I must considered when trying to update the price of a sales order using the DTW?
The field "price" was mapped in the source and target fields in DTW.
Here is the document_lines.csv
RecordKey,LineNum,AccountCode,Address,ItemCode,LineTotal,Price,Quantity,ShipDate,WarehouseCode,TaxCode
RecordKey,LineNum,AccountCode,Address,ItemCode,LineTotal,Price,Quantity,ShipDate,WarehouseCode,TaxCode
1,1,_SYS00000000059, ,30PA08-0360-25,1,11.2,3,20110702,V08,A5
1,2,_SYS00000000059, ,30PA08-0707-25,1,15.2,3,20110702,V08,A5
1,3,_SYS00000000059, ,30PA08-0707-22,1,18.3,3,20110702,V08,A5
And the document.csv:
RecordKey,DocEntry,CardCode,DocDate,DocDueDate,DocTotal
RecordKey,DocEntry,CardCode,DocDate,DocDueDate,DocTotal
1, ,c-6167,20110702,20110702,2
Thank you for your help
Jorge ManzoHi,
Try to re-create your dtw using my template,and use text tab when saving your template.
SO-Header
RecordKey CardCode CardName Comments DocDate DocDueDate DocNum
RecordKey CardCode CardName Comments DocDate DocDueDate DocNum
1 24-25 MANUFACTU 24-25 MANUFACTURING 4/5/2010 4/15/2010 11142
SO-LINE
RecordKey linenum itemcode qty uom PriceAfterVAT Price SalesPersonCode
RecordKey linenum itemcode qty uom PriceAfterVAT Price SalesPersonCode
1 0 SHAFT HEX 7/8" 1 pc 4536 4050 CRIS
Note : Line -(LINE NUM and QTY is important upon computation of Price if SO is ITEM TYPE Document.
hope this will help you!
Regards,
Darius -
Sale Order Item Quantity Not Populating When Create A Sale Order Using BAPI
I am having a problem when creating a sale order using BAPI
BAPI_SALESORDER_CREATEFROMDAT2
Problem is that sale order item quantity field is not populating
code is as follows
ORDER_ITEMS_IN-ITM_NUMBER = '0010'.
ORDER_ITEMS_IN-MATERIAL = '000000000010000262'.
ORDER_ITEMS_IN-TARGET_QU = 'LB'.
ORDER_ITEMS_IN-TARGET_QTY = 1.Hi,
Try populating ORDER_SCHEDULES_IN table in the bapi field REQ_QTY.
Regds,
Rudra -
Update ship-to partner in sales order using BAPI_SALESORDER_CHANGE
Dear all,
We are trying to update the ship-to partner in a sales order using BAPI_SALESORDER_CHANGE. This is working correctly for most of our orders, so we do fill the BAPI correctly. However for some of our orders on item level a different payer is specified than on header level. However in that case the BAPI will not update the ship-to partner, but given an error message VPD 034 u2018The document must contain the same credit control areas for all payersu2019. Debugging already learned that actually the message is given not because of different credit control areas, but due to the fact that the payers and therefore the credit customers are different (although in the same credit control areas). For this reason we can not update the ship-to party of a large number of our sales orders with this BAPI. Actually we have 2 questions:
· Has somebody experienced the same issue and did you manage to solve it somehow, so the BAPI could be used for this purpose of updating partner data?
· Do you know other ways of updating the partners or partner address of an existing sales order in the background?
Thanks in advance for your assistance.
Regards,
Satish.It was caused by standard SAP.
-
Confirmation Quantity issue while creating Sales order using BAPI
Hi SDN,
Can anyone of you help mein the below issue:
I have a program to create a sales order using upload file. for this i use "BAPI_SALESORDER_CREATEFROMDAT2" & for changing existing "BAPI_SALESORDER_CHANGE".
Now If the upload file contains the Same Material, Based on other conditions, it needs to create Multiple sales order.
When the first Salesorder is created, the Quantity is getting confirmed (Confirmed quantity VBEP-BMENG). But during actual run, since the confirmation is getting done for the same material in the above Sales order, the confirmation is not being done in the subsequent Sales order".
This poses a problem for business, user need to manual refresh the u201Cconfirmed quantity for each line item in the particular SO where it failed during program upload.
Also while uploading using the BAPI, if we wait forsometime after creating the first sales order in Debug, then the above material is unlocked & the confirmation quantity is done for the subsequent sales order also.
But in the actual run, this is creating a problem. Some Refresh or Unlocking problem.
Can you please suggest a suitable solution for this issue.
Thanks & regrads,
Chaitanya LBKHave you tried backorder processing?
V_V1
V_V2
V_RA
V_R1
V_R2 -
Issue in creating sales order using process_header API
Hi all,
We have a requirement to create sales order using apps adapter in ebiz from SOA suite composite.I used OE_ORDER_PUB.Process_header API to create order header.
When I pass the inputs and test the service,I get output with return_status='S'. But no record falls at the OE_ORDER_HEADER_ALL table.
I cant identify where the problem is.Pls suggest me with the things to resolve this issue.
Thanks,
gouthamHi all,
We have a requirement to create sales order using apps adapter in ebiz from SOA suite composite.I used OE_ORDER_PUB.Process_header API to create order header.
When I pass the inputs and test the service,I get output with return_status='S'. But no record falls at the OE_ORDER_HEADER_ALL table.
I cant identify where the problem is.Pls suggest me with the things to resolve this issue.
Thanks,
goutham -
How to Create RMA Based on Sales order using OE_ORDER_PUB api
Hi,
Can any one pls help me how to create a RMA based on the sales order using oe_order_pub.process_order APi.
Thanks.Creating RMA is very similar to creating an Order. You need to make sure you're passing the correct order_type, line_type which'll be setup as 'RETURN' (or 'MIXED') category in transaction type definition.
For the API to automatically create a reference on your RMA lines to the original Order lines, you need to pass the following
l_line_tbl (l_line_tbl.COUNT).return_reason_code := 'RETURN'; -- Mandatory for RMA
l_line_tbl (l_line_tbl.COUNT).reference_line_id := v_ref_line_id; -- Original order line_id
l_line_tbl (l_line_tbl.COUNT).reference_header_id := v_ref_header_id; -- Original order header_id
l_line_tbl (l_line_tbl.COUNT).return_context := 'ORDER';
l_line_tbl (l_line_tbl.COUNT).return_attribute1 := v_ref_header_id; -- Original order header_id
l_line_tbl (l_line_tbl.COUNT).return_attribute2 := v_ref_line_id; -- Original order line_id
Once the RMA gets created, query the order and navigate to Lines>Returns tab. You can see the original order number and line number.
Thanks
Gopal -
Create sales order using IBE_Quote_W1_PVT.SUBMITQUOTEWRAPPER
Hi,
I am trying to create an sales order using following api. which creates cart from shopping cart.
SET serveroutput ON
DECLARE
P_API_VERSION_NUMBER NUMBER;
P_INIT_MSG_LIST VARCHAR2(200);
P_COMMIT VARCHAR2(200);
X_RETURN_STATUS VARCHAR2(200);
X_MSG_COUNT NUMBER;
X_MSG_DATA VARCHAR2(200);
P_QUOTE_HEADERID NUMBER;
P_LAST_UPDATE_DATE DATE;
P_SHAREE_NUMBER NUMBER;
P_SHAREE_PARTY_ID NUMBER;
P_SHAREE_ACCOUNT_ID NUMBER;
P_SC_BOOK_FLAG VARCHAR2(200);
P_SC_RESERVE_FLAG VARCHAR2(200);
P_SC_CALCULATE_PRICE VARCHAR2(200);
P_SC_SERVER_ID NUMBER;
P_SC_CC_BY_FAX VARCHAR2(200);
P_CUSTOMER_COMMENTS VARCHAR2(200);
P_REASON_CODE VARCHAR2(200);
P_SALESREP_EMAIL_ID VARCHAR2(200);
P_MINISITE_ID NUMBER;
X_LAST_UPDATE_DATE DATE;
X_ORDER_NUMBER NUMBER;
X_ORDER_HEADER_ID NUMBER;
X_ORDER_REQUEST_ID NUMBER;
X_CONTRACT_ID NUMBER;
X_STATUS VARCHAR2(200);
X_HOLD_FLAG VARCHAR2(200);
BEGIN
P_API_VERSION_NUMBER := 1;
P_INIT_MSG_LIST := FND_API.G_TRUE;
P_COMMIT := FND_API.G_FALSE;
P_QUOTE_HEADERID := 18534;
P_LAST_UPDATE_DATE := to_date('2012-10-01 04:33:45','YYYY-MM-DD HH24:MI:SS');
P_SHAREE_NUMBER := FND_API.G_MISS_NUM ;
P_SHAREE_PARTY_ID := FND_API.G_MISS_NUM ;
P_SHAREE_ACCOUNT_ID := FND_API.G_MISS_NUM ;
P_SC_BOOK_FLAG := FND_API.G_MISS_CHAR;
P_SC_RESERVE_FLAG := FND_API.G_FALSE;
P_SC_CALCULATE_PRICE := FND_API.G_FALSE;
P_SC_SERVER_ID := -1;
P_SC_CC_BY_FAX := FND_API.G_FALSE;
P_CUSTOMER_COMMENTS := FND_API.G_MISS_CHAR;
P_REASON_CODE := FND_API.G_MISS_CHAR;
P_SALESREP_EMAIL_ID := FND_API.G_MISS_CHAR;
P_MINISITE_ID := 10660;
IBE_Quote_W1_PVT.SUBMITQUOTEWRAPPER(
P_API_VERSION_NUMBER => P_API_VERSION_NUMBER,
P_INIT_MSG_LIST => P_INIT_MSG_LIST,
P_COMMIT => P_COMMIT,
X_RETURN_STATUS => X_RETURN_STATUS,
X_MSG_COUNT => X_MSG_COUNT,
X_MSG_DATA => X_MSG_DATA,
P_QUOTE_HEADERID => P_QUOTE_HEADERID,
P_LAST_UPDATE_DATE => P_LAST_UPDATE_DATE,
P_SHAREE_NUMBER => P_SHAREE_NUMBER,
P_SHAREE_PARTY_ID => P_SHAREE_PARTY_ID,
P_SHAREE_ACCOUNT_ID => P_SHAREE_ACCOUNT_ID,
P_SC_BOOK_FLAG => P_SC_BOOK_FLAG,
P_SC_RESERVE_FLAG => P_SC_RESERVE_FLAG,
P_SC_CALCULATE_PRICE => P_SC_CALCULATE_PRICE,
P_SC_SERVER_ID => P_SC_SERVER_ID,
P_SC_CC_BY_FAX => P_SC_CC_BY_FAX,
P_CUSTOMER_COMMENTS => P_CUSTOMER_COMMENTS,
P_REASON_CODE => P_REASON_CODE,
P_SALESREP_EMAIL_ID => P_SALESREP_EMAIL_ID,
P_MINISITE_ID => P_MINISITE_ID,
X_LAST_UPDATE_DATE => X_LAST_UPDATE_DATE,
X_ORDER_NUMBER => X_ORDER_NUMBER,
X_ORDER_HEADER_ID => X_ORDER_HEADER_ID,
X_ORDER_REQUEST_ID => X_ORDER_REQUEST_ID,
X_CONTRACT_ID => X_CONTRACT_ID,
X_STATUS => X_STATUS,
X_HOLD_FLAG => X_HOLD_FLAG
DBMS_OUTPUT.PUT_LINE('X_RETURN_STATUS = ' || X_RETURN_STATUS);
DBMS_OUTPUT.PUT_LINE('X_MSG_COUNT = ' || X_MSG_COUNT);
DBMS_OUTPUT.PUT_LINE('X_MSG_DATA = ' || X_MSG_DATA);
DBMS_OUTPUT.PUT_LINE('X_LAST_UPDATE_DATE = ' || X_LAST_UPDATE_DATE);
DBMS_OUTPUT.PUT_LINE('X_ORDER_NUMBER = ' || X_ORDER_NUMBER);
DBMS_OUTPUT.PUT_LINE('X_ORDER_HEADER_ID = ' || X_ORDER_HEADER_ID);
DBMS_OUTPUT.PUT_LINE('X_ORDER_REQUEST_ID = ' || X_ORDER_REQUEST_ID);
DBMS_OUTPUT.PUT_LINE('X_CONTRACT_ID = ' || X_CONTRACT_ID);
DBMS_OUTPUT.PUT_LINE('X_STATUS = ' || X_STATUS);
DBMS_OUTPUT.PUT_LINE('X_HOLD_FLAG = ' || X_HOLD_FLAG);
END;
When i use this from a OA_HTML jsp the sales order is created . But when i use it from the sql developer
i got following error
X_RETURN_STATUS = E
X_MSG_COUNT = 1
X_MSG_DATA = You do not have access to this cart.
X_LAST_UPDATE_DATE =
X_ORDER_NUMBER = 9.990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+125
X_ORDER_HEADER_ID = 9.990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+125
X_ORDER_REQUEST_ID = 9.990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+125
X_CONTRACT_ID = 9.990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+125
X_STATUS =
I checked logs for both .
For working one log is ie. using jsp
01-OCT-2012:01:24:46 IBE IBE_UTIL.enable_debug_new p_check_profile is N
01-OCT-2012:01:24:46 IBE IBE_UTIL.enable_debug_new p_check_profile is N
01-OCT-2012:01:24:46 IBE Begin validate_user_update10/01/2012:01:24:46
01-OCT-2012:01:24:46 IBE Incoming party_id is 423832
01-OCT-2012:01:24:46 IBE Incoming cust_account_id is 140757
01-OCT-2012:01:24:46 IBE Incoming quote_header_id is 18529
01-OCT-2012:01:24:46 IBE User id obtained from environment is: -1
01-OCT-2012:01:24:46 IBE p_save_type is :6
01-OCT-2012:01:24:46 IBE Entered Validation...T
01-OCT-2012:01:24:46 IBE no sharee number
01-OCT-2012:01:24:46 IBE quote_source_code of cart passed in=IStore Account
01-OCT-2012:01:24:46 IBE In validating Owner flow: 423832,140757 10/01/2012:01:24:46
01-OCT-2012:01:24:46 IBE Validate_user_update: Before Last update date validation,p_last_update_date= 01-10-12
01-OCT-2012:01:24:46 IBE Validate_user_update: Last update date validation START
01-OCT-2012:01:24:46 IBE Validate_user_update: l_last_update_date=
01-OCT-2012:01:24:46 IBE Validate_user_update: p_last_update_date=10/01/2012:00:22:07
01-OCT-2012:01:24:46 IBE Validate_user_update: Last update date validation END
01-OCT-2012:01:24:46 IBE Before calling validate_quote10/01/2012:01:24:46
01-OCT-2012:01:24:46 IBE Begin Validate_quote10/01/2012:01:24:46
01-OCT-2012:01:24:46 IBE Validate_quote: Validation for one-click start
01-OCT-2012:01:24:46 IBE End validate_quote10/01/2012:01:24:46
01-OCT-2012:01:24:46 IBE End validate_user_update10/01/2012:01:24:46
but for the failure it is.
01-OCT-2012:01:20:53 IBE IBE_UTIL.enable_debug_new p_check_profile is N
01-OCT-2012:01:20:53 IBE IBE_UTIL.enable_debug_new p_check_profile is N
01-OCT-2012:01:20:53 IBE Begin validate_user_update10/01/2012:01:20:53
01-OCT-2012:01:20:53 IBE Incoming party_id is 9.990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+125
01-OCT-2012:01:20:53 IBE Incoming cust_account_id is 9.990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+125
01-OCT-2012:01:20:53 IBE Incoming quote_header_id is 18529
01-OCT-2012:01:20:53 IBE User id obtained from environment is: -1
01-OCT-2012:01:20:53 IBE p_save_type is :6
01-OCT-2012:01:20:53 IBE Entered Validation...T
01-OCT-2012:01:20:53 IBE no sharee number
01-OCT-2012:01:20:53 IBE quote_source_code of cart passed in=IStore Account
01-OCT-2012:01:20:53 IBE Owner flow with env. userid: 10/01/2012:01:20:53
01-OCT-2012:01:20:53 IBE partyId::quotehdrId(9.990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+125,18529)
01-OCT-2012:01:20:53 IBE End:Expected exception:IBE_Quote_Misc_pvt.validate_user_update
From this u can see that party id and account is fetched when using jsp. but direct running of procedure not getting these values.
is there sql api running when accessing through jsp . so that these values are got from session.
Thanks
MarkHi,
I have passed that too . still getting same error.
IBE_Quote_W1_PVT.SUBMITQUOTEWRAPPER calls IBE_Quote_Checkout_Pvt.submitQuote
which calls another package
PROCEDURE Validate_User_Update(
p_api_version_number IN NUMBER := 1.0
,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
,p_quote_header_id IN NUMBER
,p_party_id IN NUMBER := FND_API.G_MISS_NUM
,p_cust_account_id IN NUMBER := FND_API.G_MISS_NUM
,p_quote_retrieval_number IN NUMBER := FND_API.G_MISS_NUM
,p_validate_user IN VARCHAR2 := FND_API.G_FALSE
,p_privilege_type_code IN VARCHAR2 := 'F'
,p_save_type IN NUMBER := FND_API.G_MISS_NUM
,p_last_update_date IN DATE := FND_API.G_MISS_DATE
,x_return_status OUT NOCOPY VARCHAR2
,x_msg_count OUT NOCOPY NUMBER
,x_msg_data OUT NOCOPY VARCHAR2)
in it like this
IBE_Quote_Misc_pvt.Validate_User_Update(
p_init_msg_list => FND_API.G_TRUE
,p_quote_header_id => p_quote_Header_Id
,p_quote_retrieval_number => p_sharee_number
,p_validate_user => FND_API.G_TRUE
,p_privilege_type_code => 'A'
,p_save_type => PLACE_ORDER
,p_last_update_date => p_last_update_date
,x_return_status => x_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data
from this u can see that there no value passed for party id and account id .
Thanks
Mark
Maybe you are looking for
-
How to get af:commandbutton id in java code when it is triggered?
Hi All In my application's homepage, I am using 2 af:commandbuttons and each using action attribute to call a method. Both are calling the same method, and based on its id, it should perform different operations. Could anyone please tell me how to ge
-
Append XML elements with same name in an XML document
Hi, I am using Oracle9i XMLDB utilities to modify an XML document stored in the database. I have a sample XML document like this in the database: <Person> <Address ID="1"> </Address> </Person> My task is to include a second <Address> element with a d
-
Address Book Does Not Link to Faces, Button Grayed Out
The import face from iPhoto button is grayed out and not active on my computer, is this new Lion feature not working or not yet acitved within Lion? Here's a description of how the feature was supposed to work (see bold text description). I can onl
-
Is there a plug-in manager in LR 1.1?
I am using Lightroom 1.1 and want to download/activate a plugin, but don't see the plugin manager in the File menu - is this feature available in 1.1? Or is there some other way to activate plugins?
-
Dear Barbara B From Adobe online I purchased the holiday special price Adobe Photoshop Elements 10 & Adobe Premiere Elements 10 on 11/29/2011. The download of the three files was surprisingly snappy. I am running a Mac Pro with four internal HDs --