Updating Condition Rate in SO using BAPI 'BAPI_SALESORDER_CHANGE'
Hi,
I want to update the price related to condtions(both automatic and manual) in Sales Order items from input file. I am using bapi 'BAPI_SALESORDER_CHANGE' to for this.
I used follwing code,
wa_so_cond-itm_number = wa_input-so_item.
wa_so_cond-cond_type = wa_input-kschl.
wa_so_cond-cond_st_no = '011'.
wa_so_cond-cond_count = '00'.
wa_so_cond-cond_value = wa_input-kbetr.
APPEND wa_so_cond TO i_so_cond.
CLEAR wa_so_cond.
wa_so_condx-itm_number = wa_input-so_item.
wa_so_condx-cond_type = wa_input-kschl.
wa_so_condx-cond_st_no = '011'.
wa_so_condx-cond_count = '00'.
wa_so_condx-updateflag = c_u.
wa_so_condx-cond_value = c_x.
APPEND wa_so_condx TO i_so_condx.
CLEAR wa_so_condx.
But this is creating a new line in conditions instead of updating the existing line, even though the existing line is a inactive by crerating a new line I want to update the exsting line with new condition rate instead of creating a new line. Please help me if you have any soultion for this.
Thanks in Advance,
Prasad JVV.
Hi Sandipan,
I used APPEND to fill the conditions_in & conditions_inx, without filling the tables how can I modify?
Thanks,
Prasad JVV.
Similar Messages
-
Custom fields update using BAPI: BAPI_SALESORDER_CHANGE
Hi,
I have append one field into VBAP Table, and i want to update that filed value by using BAPI_SALESORDER_CHANGE FM. I have done all the coding but still its not updating the table. I have checked with SAP fields like order quantity, its upadating the database but the custom fileds are not upadting.
steps i have done: Append field to : VBAP,BAPE_VBAP,VBAPKOZ
Append Check field to : BAPE_VBAPX,VBAPKOZX
Here is the code : plz check and add ur comments
DATA : l_wa_bapiparex TYPE bapiparex,
l_wa_ord_header TYPE bapisdh1x,
l_itab_bapiparex TYPE STANDARD TABLE OF bapiparex INITIAL SIZE 0,
l_itab_return TYPE STANDARD TABLE OF bapiret2 INITIAL SIZE 0,
l_wa_item TYPE bapisditm,
l_itab_item TYPE STANDARD TABLE OF bapisditm INITIAL SIZE 0,
l_wa_itemx TYPE bapisditmx,
l_itab_itemx TYPE STANDARD TABLE OF bapisditmx INITIAL SIZE 0,
ORDER_HEADER_IN LIKE BAPISDH1.
l_wa_ord_header-updateflag = 'U'.
ORDER_HEADER_IN-REF_DOC = '0000000244'.
*Populate Item detail
l_wa_item-itm_number = '000010'.
l_wa_item-NET_WEIGHT = '5000'.
APPEND l_wa_item TO l_itab_item.
*Populate Item detail checkbox
l_wa_itemx-itm_number = '000010'.
l_wa_itemX-NET_WEIGHT = 'X'.
l_wa_itemx-updateflag = 'U'.
APPEND l_wa_itemx TO l_itab_itemx.
l_wa_bapiparex-structure = 'BAPE_VBAP'.
l_wa_bapiparex-valuepart1+0(10) = '0000000244'.
l_wa_bapiparex-valuepart1+10(6) = '000010'.
l_wa_bapiparex-valuepart1+16(15) = 'ABCDEF'.
APPEND l_wa_bapiparex TO l_itab_bapiparex.
CLEAR l_wa_bapiparex.
l_wa_bapiparex-structure = 'BAPE_VBAPX'.
l_wa_bapiparex-valuepart1+0(10) = '0000000244'.
l_wa_bapiparex-valuepart1+10(6) = '000010'.
l_wa_bapiparex-valuepart1+17(1) = 'X'.
APPEND l_wa_bapiparex TO l_itab_bapiparex.
clear l_wa_bapiparex.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = '0000000244'
order_header_in = ORDER_HEADER_IN
order_header_inx = l_wa_ord_header
TABLES
return = return
order_item_in = l_itab_item
order_item_inx = l_itab_itemx
schedule_lines = l_itab_schedule
schedule_linesx = l_itab_schedulex
extensionin = l_itab_bapiparex.
IF SY-SUBRC = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN =
ELSE.
RAISE ERROR.
ENDIF.
I HAVE GONE THROUGH DEBUGGING AND FOUND ALL ARE GOING FINE...ITS UPDATING VBKOM AND VBKOMX STRUCTURE BUT AT LAST ITS NOT UPDATING THE CUSTOM FIELDS
Thanks,
BaidyaSorry guys........this code is correct one.......there is a problem in IDES....i tried in client server its working fine
If anyone is having this type of requirement then copy this program.
thanks,
Baidya -
BADI for updating condition rate in CRMD_ORDER
Hi Gurus,
I am creating a sales order using CRMD_ORDER and trying to update the condition rate in ABAP. I need to know how exactly i can do the same.
I have identified CRM_COND_COM_BADI and CRM_PRICING_I_BADI but I don't know which parameters to alter in order to update the condition rate.
Regards.Hi Charles,
Here is a piece of code which i used to update pricing conditions.
From here you can see what all fields are to be passed to maintain price conditions.
y_lwa_pric_cond_change-stunr = y_lwa_pric_cond-stunr.
y_lwa_pric_cond_change-zaehk = y_lwa_pric_cond-zaehk.
y_lwa_pric_cond_change-waers = y_lwa_pric_cond-waers.
y_lwa_pric_cond_change-kbetr = y_lwa_pridoc-ypriccndp.
INSERT y_lwa_pric_cond_change INTO TABLE y_li_pric_cond_change.
y_lwa_pridoc-cond_change = y_li_pric_cond_change.
INSERT y_lwa_pridoc INTO TABLE p_it_pridoc.
y_lwa_input_fields-ref_guid = y_lwa_pridoc-ref_guid.
y_lwa_input_fields-ref_kind = 'B'.
y_lwa_input_fields-objectname = 'PRIDOC_COM'.
y_lwa_field_names-fieldname = 'LIST_PRICE'.
INSERT y_lwa_field_names INTO TABLE y_li_field_names.
y_lwa_field_names-fieldname = 'DISCOUNT'.
INSERT y_lwa_field_names INTO TABLE y_li_field_names.
y_lwa_field_names-fieldname = 'NET_PRICE'.
INSERT y_lwa_field_names INTO TABLE y_li_field_names.
y_lwa_input_fields-field_names = y_li_field_names.
INSERT y_lwa_input_fields INTO TABLE y_ct_input_fields.
REFRESH y_li_field_names.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_pridoc = p_it_pridoc
CHANGING
ct_orderadm_i = p_it_orderadm_i
ct_input_fields = y_ct_input_fields.
Let me know if you need any clarrification.
Regards,
Vinay Sah
Edited by: Vinay Sah on May 26, 2009 11:17 AM -
Update delivery address in PO using BAPI BAPI_PO_CREATE1
Hi,
I want to update the delivery address of line item using BAPI BAPI_PO_CREATE1. I am creating address using BAPI BAPI_ADDRESSORG_SAVEREPLICA and I am sending the address number in the import parameter POADDRDELIVERY but it is not updating the delivery address.
Regards,
Anil N.Hi.
after called the BAPI BAPI_PO_CREATE1 call the FM BAPI_TRANSACTION_COMMIT.
it will work
regards
Marco -
Update VAT registration number by use BAPI BAPI_CONTRACT_CREATE
Hi,Experts!
I have a problem when I use BAPI BAPI_CONTRACT_CREATE to Create contract ,
I need to fill in the field EKKO-stceg(VAT registration number),but can't find any parameter in that BAPI.
please help!Hi Mf,
Yes there is no field for vat no in this bapi.Please check with extension parameter.
Regards,
Madhu. -
International Address versions updation in SAP Bank master using BAPI
Is there a function module/BAPI to update the adrc and related tables when the bank master creation is done?The bank master creation is done via BSP pages.
Regards,BAPI_BANK_CREATE creates only one version and BAPI_BANK_CHANGE can be used only to modify existing entries.SO both wont work in my case.
-
Problem in updating the GR processing time using BAPI 'BAPI_SAG_CHANGE'
Hi,
I am using the BAPI 'BAPI_SAG_CHANGE' for uopdating the GR processing time(BAPIMEOUTITEM-GR_PR_TIME) of the scheduling agreements.
Issue: when there is no value maintained for GR processing time for a particular scheduling agreemnet the BAPI updates the GR processing time successfully but when there is some value already existing for a particular scheculing agreement then the BAPI does not update this field eventhough the return parameter shows the message 'successfully updated'.
Can somebody suggest what could be the reason.
OR
Is there any other way/FM to update the scheduling agreements.
Thanks,
RavindraThis appears to be old-style BAPI, with ....X tables. Did you populate the field in the X version of the outitem for the column(s) to be changed? Did you call the COMMIT bapi after the update?
-
ISU Change Register Group and Rate type and Rate fact Group using BAPIs
Hi,
Can anyone please help me on how to use ISU_O_DEVICEMOD_OPEN and ISU_S_DEVICEMOD_CHANGE for changing the Register Group and Rate type and Rate fact Group.
Thanks,
JohnHello,
Can an expert please reply to this thread? I have the same issue.
Thanks,
Andre -
Updating NETPR field of table EINE using BAPI
Hello All,
I have a requirement to update info record data in tables EINE, EINA, KONP. The fields to be updated are KSCHL, KBETR and NETPR. I am able to successfully update KBETR and KSCHL fields using bapi BAPI_PRICES_CONDITIONS. But I am unable to find any field in the bapi structures that would update NETPR field.
Request you to please suggest how can I update NETPR successfully in table EINE.
Thanks in advance.
AnandHi Anand,
Use the Function Module 'ME_DIRECT_INPUT_INFORECORD' to update/change the info record values.
Pass the netpr value in ls_eine structure.
To get better understanding on using this function module, please have a look on this link
Create new inforecord with standard-condition via FM
Regards,
Arun Prasath Kumar.
Edited by: Arun Prasath Kumar on Jan 17, 2011 12:09 PM -
Create / Change Sales Order using BAPI - Populating Enhanced Fields
Hi,
I am using BAPI: BAPI_SALESORDER_CHANGE to change the Sales Order and want to update the Enhanced Screen Field (Screen Exit Fields) in the Sales Order. Where to populate these enhanced screen fields in the BAPI Structure?
Appreciate Your Help!.
Thanks,
KannanHi,
MV45AFZZ BAPI_SALESORDER_CHANGE
Regards,
Padmam. -
How to use bapi to change so's schedule line category
dear friends:
I try to change so's schedule line category using bapi "BAPI_SALESORDER_CHANGE", but it doesn't work,the code is as following:
T_SCHEDULE_LINES-ITM_NUMBER = ITAB-POSNR.
T_SCHEDULE_LINES-SCHED_TYPE = ITAB-ETTYP.
T_SCHEDULE_LINES-SCHED_LINE = '0001'.
APPEND T_SCHEDULE_LINES.
T_SCHEDULE_LINESX-ITM_NUMBER = ITAB-POSNR.
T_SCHEDULE_LINES-SCHED_TYPE = ITAB-ETTYP.
T_SCHEDULE_LINESX-SCHED_LINE = '0001'.
T_SCHEDULE_LINESX-UPDATEFLAG = 'U'.
who can tell me the reason.thanks in advance.Hi
First try to execute same bapi in test mode and then check thwe respective SO if this work then you have to commint the changes through program, some more help on this topic
The BAPI does not run a database Commit, which means that the application must trigger the Commit so that the changes are read to the database. To do this, use the BAPI_TRANSACTION_COMMIT BAPI. -
Performance of bapi BAPI_SALESORDER_CHANGE.
Now we meet the reqeust to split the order item by quantity in order to assign wbs number to each material
For example the sales order contains one item with 10 Qty and we need to split to 10 items and each item with 1Qty
Order:
Line 0001 Material 10Qty
Change to:
Line 0001 Material 1Qty WBS-001
Line 0002 Material 1Qty WBS-002
Line 0003 Material 1Qty WBS-003
Line 0010 Material 1Qty WBS-010
We used bapi BAPI_SALESORDER_CHANGE to do above process but the run time seems very slowly (time out)
I tried to delete the schedule_lines and schedule_linessx from import for test.
it runs fast but the result is there is no quantity in each line item.
without schedule_line import, the order will be:
Line 0001 Material 0Qty WBS-001
Line 0002 Material 0Qty WBS-002
Line 0003 Material 0Qty WBS-003
Line 0010 Material 0Qty WBS-010
Does any one tried BAPI BAPI_SALESORDER_CHANGE and met the same problem (slowly)?
And any suggestion?
Thank you very much!Hi,
BAPI_SALESORDER_CHANGE should not raise time out,
unless you process huge amount of data.
Maybe some data are locked or some user-exit causes infinite loop or incorrect select on large table.
Try to perform runtime analysis with small amount of data,
and during execution check SM12 for locks and SM50 for sequential reads.
Regards,
Przemysław -
Error in BAPI_SALESORDER_CHANGE while updating condition
Hi,
I am using this BAPI to change an existing pricing condition. However, I am getting an error " Manual change of condition type is not possible". I'm not sure whether this is a coding error or is it related to configuration. this is how I am populating the structures:
so_cond_in-itm_number = wa_vbap1-posnr.
so_cond_in-cond_count = wa_konv-zaehk.
so_cond_in-cond_st_no = wa_konv-STUNR.
so_cond_in-cond_type = wa_konv-kschl.
so_cond_in-cond_value = wa_konv-kbetr.
so_cond_in-currency = wa_konv-waers.
so_condx_in-itm_number = wa_vbap1-posnr.
so_condx_in-updateflag = 'U'.
so_condx_in-cond_st_no = wa_konv-STUNR.
so_condx_in-cond_count = wa_konv-zaehk.
so_condx_in-cond_type = wa_konv-kschl.
so_condx_in-cond_value = 'X'.
so_condx_in-currency = 'X'.
APPEND so_condx_in.
CLEAR so_condx_in.
APPEND so_cond_in.
CLEAR so_cond_in.
st_logswitch-cond_handl = 'X'.
Any help would be appreciated.
Thanks
SMHi Sneha ,
Can you please check the code for using the BAPI_SALESORDER_CHANGE bapi. this is similar to your chase. Please compare with the passing parameters
then you will get some idea on your code.
*- Population of Order Item data
ls_order_item-itm_number = ls_submit-posnr. "Item
ls_order_item-prc_group5 = '003'."lc_004. "Material Group5
IF ls_submit-zmeng = 0.
ls_order_item-reason_rej = lc_99. "Reason for Rejection
ENDIF.
APPEND ls_order_item TO lt_order_item.
*-Population of update flag for Order Item
ls_order_itemx-itm_number = ls_submit-posnr."Item
ls_order_itemx-updateflag = lc_u. "Update flag
ls_order_itemx-prc_group5 = gc_x. "Material Group5 update
*- if the required quanity is zero then reject the line
IF ls_submit-zmeng = 0.
ls_order_itemx-reason_rej = gc_x. "Reason for Rejection
ENDIF.
APPEND ls_order_itemx TO lt_order_itemx.
*-Population of
ls_schedule_lines-itm_number = ls_submit-posnr.
ls_schedule_lines-sched_line = ls_submit-etenr.
ls_schedule_lines-req_qty = ls_submit-zmeng.
APPEND ls_schedule_lines TO lt_schedule_lines.
*-Population of update flag for Schedule line data
ls_schedule_linesx-itm_number = ls_submit-posnr.
ls_schedule_linesx-sched_line = ls_submit-etenr.
ls_schedule_linesx-updateflag = lc_u.
ls_schedule_linesx-req_qty = gc_x.
APPEND ls_schedule_linesx TO lt_schedule_linesx.
*- at the end of Order call the BAPI to Update the Order
ls_order_head-collect_no = ls_submit-vbeln.
ls_order_headx-updateflag = lc_u.
ls_order_headx-collect_no = gc_x.
*- BAPI Call to Update the Order
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = ls_submit-vbeln
order_header_in = ls_order_head
order_header_inx = ls_order_headx
TABLES
return = lt_return
order_item_in = lt_order_item
order_item_inx = lt_order_itemx
schedule_lines = lt_schedule_lines
schedule_linesx = lt_schedule_linesx.
*- Check for the errors and based on that populate the log
READ TABLE lt_return INTO ls_return WITH KEY type = lc_e.
IF sy-subrc EQ 0.
LOOP AT lt_return INTO ls_return WHERE type = lc_e.
ls_log-excep = 1.
ls_log-vbeln = ls_submit-vbeln.
ls_log-message = ls_return-message.
APPEND ls_log TO gt_log.
CLEAR: ls_log,
ls_submit-vbeln .
ENDLOOP.
ELSE.
*- Commit the Changes
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = gc_x.
*- Check for the success message and populate the log
LOOP AT lt_return INTO ls_return WHERE number = lc_311.
ls_log-excep = 3.
ls_log-vbeln = ls_submit-vbeln.
ls_log-message = ls_return-message.
APPEND ls_log TO gt_log.
CLEAR: ls_log,
ls_submit-vbeln .
ENDLOOP.
ENDIF.
Thanks
Sekhar -
Unable to update sales order unsing the BAPI 'BAPI_SALESORDER_CHANGE'
Hi All,
I am unable to update the payment method field for some sales orders using the bapi 'BAPI_SALESORDER_CHANGE'. I am getting the reason in the table RETURN as 'Field 'ZLSCH' cannot be changed, VBAPKOM 000050 ready for input'.
Could anyone throw some light on it.
Thanks a ton.
Regards,
Santosh Kotra.Hi
Without reversing invoice we can't update price and this is standard bevaior which is logical too. For your scenario I am wondering why would you want to change price for a line item or order which is alrady invoiced and posted to FI. What difference would it make to change price in sale order when this has already been posted in FI?
Thank$ -
Can we update The extended VBPA database table using BAPI
Hi,
We have a table VBPA appended with two fields start date and end date. Our scenario is to when modifying the sales order using the bapi BAPI_SALESORDER_CHANGE we need to update the two fields star_date and end_date of VBPA table for the corresponding Ship to or Sold to partner for the Given Sales Order.
Thanks,
Venkat.Hi,
YES You can, You should be updating this to fields using a BAPI - "BAPI_SALESORDER_CHANGE" and use table user this BAPI "EXTENSIONIN" to update this fields. Refer to BAPI documentation for more reference. Please check below code which was done for VBAK (2 date fields).
Regards,
Tim
DATA:
ZBAPISDH1 TYPE BAPISDH1,
ZBAPISDH1X TYPE BAPISDH1X,
ZEXTENSIONIN TYPE TABLE OF BAPIPAREX WITH HEADER LINE,
BAPE_VBAK TYPE BAPE_VBAK,
BAPE_VBAKX TYPE BAPE_VBAKX.
ZBAPISDH1X-UPDATEFLAG = 'U'.
BAPE_VBAK-VBELN = P_VBELN.
BAPE_VBAK-ZZSD_FROM = P_START.
BAPE_VBAK-ZZSD_TO = P_END.
BAPE_VBAKX-VBELN = P_VBELN.
BAPE_VBAKX-ZZSD_FROM = CO_X.
BAPE_VBAKX-ZZSD_TO = CO_X.
ZEXTENSIONIN-STRUCTURE = 'BAPE_VBAK'.
ZEXTENSIONIN-VALUEPART1 = BAPE_VBAK.
APPEND ZEXTENSIONIN.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'.
Maybe you are looking for
-
I created an excise invice for purchase return using J1IS. But for some reason it was wronly prepared and now I want to cancel it. How do we cancel it along with reversing its accounting entries? Also, can I et a list of cancelled invoices? VS
-
J1ID - EXCISE MASTER REPORT & TABLE OF J1ID
Hi Friends, We have maintained Vendors excise masters details in J1ID, Please let me know the t-code of the report where I can extract all excise masters OR Table name for J1ID. Regards Suresh
-
Building a Tabular Form Manually - More then 50 entries in a Selectlist
Hi 2 all! I discovered a problem by creating a tabular form manually using this tutorial: http://www.oracle.com/technology/products/database/application_express/howtos/tabular_form.html#MANUAL When i use the apex_item.select_list_from_query function,
-
Deploy nexus1000v on HP C7000 Virtual Connect
Today i have a problem , i should deploy a N1KV on my enclosure c7000 with virtual Connect, I have 3 Clusters : 1 cluster : 2 X ESX 5.5 Management 1 Cluster : 1 X ESX 5.5 PCA/PRA 1 Cluster : 2 X ESX 5.5 Production The first cluster Management
-
Hi , While executing below query I am getting exception inserted value too large for column I want to track which column(data) is getting problem kindly suggest DECLARE o_MessageCode number; o_MessageText varchar2(4000); w_proc CONSTANT VARCHAR2(30)