Changing ITEM catergory using BAPI_SALESORDER_CHANGE
Hi
i am working on changing ITEM catergory for line items of sales order.
If the owner(ZZORD_OWNER) is 'AM' then i hv to populate PSTYV in VBAP as 'ZTAC' else 'ZDEL'.
the field ZZORD_OWNER is custom field added in header level(value is populated using BAPI, cannot be entered from screen).Kindly let me know how can i attain this activity.
hi
i have to change entries in table for corresponding items when ZZORD_OWNER is populated or changed.
i want to know where should i write the code for this.
Similar Messages
-
How to change pricing formula using bapi_salesorder_change
Hi,
I have a customer portal web application developed in .Net from which I will be getting different values which are changes related to a particular sales order item in SAP. One among these values is the pricing formula used with the sales order item. I am using bapi_salesorder_change to update all the values other than the pricing formula. My input to the bapi is the formula id. I am not sure about the field which I have to use in the bapi structures to update the same. Also I don't even know whether I can use the same bapi to do the required task.
Requesting help ....
Thanks,
SivaSir,
Thank you for your immediate response.
Actually we are integrating SAP with the customer portal web application. The requirement is in such a way that the customer portal provides the option to change the sale order details both at the header level as well as item level. The fields include Order qty,Delivery date,Partner details,Payment terms,Terms of sale, Pricing formula etc. The front end consists of a Pricing formula drop down which consists of the formula descriptions (for eg: ZFA1015-LAST LME W/DAY OF CONT. MOTH) with its corresponding ID(ID is nothing but ZFA1015). At the SAP side my RFC should pick it up and update it for the given item. The process is like if we go to VA02 we have an option called MAINTAIN FORMULA from where we can change the formula used with an item. There the formula id is obtained from the formula repository. In here the we already have the Formula ID given by the front end.
Hope you are clear wtith the requirement..
Requesting help..
Thanks,
Siva -
Problem while updating Item category using Bapi_salesorder_change
Hi,
Iam facing a probelm while updating item category using bapi Bapi_salesorder_change
In the Return table iam getting the folowing mesages.
Inforation mesage : Field 'PSTYV' cannot be changed, VBAPKOM 000010 ready for input
Error Message : Item 000010 cannot be processed.
Please find the code below
CLEAR wa_bapisdh1x.
wa_bapisdh1x-updateflag = 'U'.
CLEAR wa_order_item_inx.
wa_order_item_inx-itm_number = wa_vbap-posnr.
wa_order_item_inx-item_categ = 'X'.
wa_order_item_inx-UPDATEFLAG = 'U'.
APPEND wa_order_item_inx TO it_order_item_inx.
CLEAR wa_order_item_inx.
CLEAR wa_order_item_in.
wa_order_item_in-itm_number = wa_vbap-posnr.
wa_order_item_in-item_categ = 'ABC'.
APPEND wa_order_item_in TO it_order_item_in.
CLEAR wa_order_item_in.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = w_vbeln
order_header_inx = wa_bapisdh1x
TABLES
return = it_return
order_item_in = it_order_item_in
order_item_inx = it_order_item_inx
How can i correct it..
Regards
KumarActually iam facing a strange problem here.
When i copy the program into another sample program and execute it iam able to change both the item catgegory and delivery block for particular sales order and item number.
But in my main program i have BDC for MB1B transaction to create the material document.
Once the material document is created succesfully iam using BAPI Sales_order_change to change the item category and delivery block..
In my main program iam not to change the item catgeory getting an error field PSTYV cannot be changed.
But the same code is running percfectly in the copied one..
How can i correct that..
Regards
Kumar -
Change sales order using BAPI_SALESORDER_CHANGE
Hi i want to add a new line item to the existing sales order using BAPI_SALESORDER_CHANGE
but when i am trying it is giving
'Schedule line 0001 for item 000020 does not exist ' error..
please help me..*********I wanted to add an new line item.***.. this is my code..********
LOOP AT gt_input3 INTO st_input3.
*Finding Max No of line Items
IF fl_set IS INITIAL.
READ TABLE gt_vbap INTO st_vbap WITH KEY vbeln = st_input3-vbeln.
IF sy-subrc EQ 0.
lv_posnr = st_vbap-posnr.
fl_set = 'X'.
ENDIF.
ENDIF.
*Populate Item details
lv_posnr = lv_posnr + 10.
lv_vbeln = st_input3-vbeln.
lv_order_header_inx-updateflag = 'U'.
st_order_item_in-itm_number = lv_posnr.
st_order_item_in-material = st_input3-matnr.
st_order_item_in-target_qty = st_input3-imv_qty.
st_order_item_in-plant = st_input3-werks.
st_order_item_in-store_loc = st_input3-lgort.
st_order_item_in-store_loc = st_input3-lgort.
APPEND st_order_item_in TO lt_order_item_in.
*Populate item updation Details
st_order_item_inx-itm_number = lv_posnr.
st_order_item_inx-updateflag = 'U'.
st_order_item_inx-material = 'X'.
st_order_item_inx-plant = 'X'.
st_order_item_inx-store_loc = 'X'.
st_order_item_inx-target_qty = 'X'.
APPEND st_order_item_inx TO lt_order_item_inx.
*Populate the Schedule Lines
st_schedule_lines-itm_number = lv_posnr.
st_schedule_lines-sched_line = '0001'.
st_schedule_lines-req_qty = st_input3-imv_qty.
APPEND st_schedule_lines TO lt_schedule_lines.
*Populate the update details of schedule lines
st_schedule_linesx-itm_number = lv_posnr.
st_schedule_linesx-sched_line = '0001'.
st_schedule_linesx-req_qty = 'X'.
st_schedule_linesx-updateflag = 'U'.
APPEND st_schedule_linesx TO lt_schedule_linesx.
AT END OF vbeln.
*Call BAPI Sales order change
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = lv_vbeln
order_header_inx = lv_order_header_inx
TABLES
return = lt_return
order_item_in = lt_order_item_in
order_item_inx = lt_order_item_inx
schedule_lines = lt_schedule_lines
schedule_linesx = lt_schedule_linesx.
*Save Sales Order
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
CLEAR lv_posnr.
READ TABLE lt_return INTO st_return WITH KEY type = 'E'.
st_ipfile_err3-message = st_return-message.
*Error Log
LOOP AT gt_temp3 INTO st_temp3.
IF st_ipfile_err3-message IS NOT INITIAL.
MOVE st_temp3-record TO st_ipfile_err3-record.
IF fl_set1 IS INITIAL.
APPEND st_temp_err TO gt_ipfile_err3.
fl_set1 = 'X'.
ENDIF.
APPEND st_ipfile_err3 TO gt_ipfile_err3.
ELSE.
APPEND st_temp3 TO gt_audit3.
ENDIF.
CLEAR : st_temp3,
st_temp_err,
st_ipfile_err3,
fl_set.
ENDLOOP.
REFRESH : gt_zrman, -
Hi All,
I have to change the tax jurisdiction code of ship to party to Tax Jusrisdiction code of Ship from Party (Delivering Plant). How can I achieve this using BAPI_SALESORDER_CHANGE. Please give some inputs.
Regards,
ShankarHi Nakul,
Thanks for immediate response. I tried to change the fields in BAPIADDR1, the Partner Number is updating but the address fields are not updating.
Any suggestions. URGENT Please -
Problem while changing Sales order using 'BAPI_SALESORDER_CHANGE'
Hi all,
Below is my code to update delivery block value:
FORM call_bapi_salesorder_change .
DATA: iv_bapi_view LIKE order_view.
DATA: gt_sales_doc TYPE STANDARD TABLE OF sales_key, " Document Numbers to Be Selected
gt_items TYPE STANDARD TABLE OF bapisdit. " Order Item Data for Document Numbers
*************************************************************8
DATA:order_headers_out LIKE bapisdhd OCCURS 0 WITH HEADER LINE.
DATA:order_header_inx LIKE bapisdh1x.
DATA: lv_salesdocument LIKE bapivbeln-vbeln.
data: lv_matnr(10) type c.
DATA:
gt_schdule TYPE STANDARD TABLE OF bapischdl, " for gl date & load date
gt_schdulex TYPE STANDARD TABLE OF bapischdlx, " for partner role and partner function.
gt_return TYPE STANDARD TABLE OF bapiret2,
gt_itemin TYPE STANDARD TABLE OF bapisditm,
gt_iteminx TYPE STANDARD TABLE OF bapisditmx ,
gt_bapisdh1 TYPE STANDARD TABLE OF bapisdh1.
DATA:gs_head_bapi TYPE bapisdh1x,
gs_schdule TYPE bapischdl,
gs_schdulex TYPE bapischdlx,
gs_return TYPE bapiret2,
gs_itemin TYPE bapisditm,
gs_iteminx TYPE bapisditmx,
gs_bapisdh1 TYPE bapisdh1.
CLEAR : gt_schdule,gt_schdulex,gs_return.
REFRESH gt_return.
gs_head_bapi-updateflag = 'U'.
SORT gt_final BY vbeln.
CLEAR gs_vbep.
REFRESH gt_vbep[].
CLEAR gs_final.
LOOP AT gt_final1 INTO gs_final.
gs_itemin-itm_number = gs_final-posnr.
*move gs_final-matnr to lv_matnr."qx94162
gs_itemin-material = gs_final-matnr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = gs_final-matnr
IMPORTING
output = gs_final-matnr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_matnr
IMPORTING
output = lv_matnr.
gs_itemin-material = lv_matnr.
gs_itemin-material = gs_final-matnr.
gs_iteminx-itm_number = gs_final-posnr.
gs_iteminx-updateflag = 'U'.""changed to I
gs_iteminx-material = 'X'.
" gs_schdule-req_dlv_bl = gs_final-lifsp. " Delivery block
gs_schdule-itm_number = gs_final-posnr.
gs_schdulex-itm_number = gs_final-posnr.
gs_schdule-sched_line = '0001'.
gs_schdulex-sched_line = '0001'.
MOVE gs_final-lifsp to gs_schdule-req_dlv_bl.
gs_schdule-req_dlv_bl = gs_final-lifsp.
gs_schdulex-req_dlv_bl = 'X'. " Delivery block
gs_schdulex-updateflag = 'U'.
gs_bapisdh1-sales_org = gs_final-vkorg.
APPEND gs_schdule TO gt_schdule.
APPEND gs_schdulex TO gt_schdulex.
APPEND gs_itemin TO gt_itemin.
APPEND gs_iteminx TO gt_iteminx.
Append gs_BAPISDH1 to gt_BAPISDH1.
lv_salesdocument = gs_final-vbeln.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = lv_salesdocument
ORDER_HEADER_IN = gs_BAPISDH1
order_header_inx = gs_head_bapi
SIMULATION =
BEHAVE_WHEN_ERROR = ' '
INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH =
NO_STATUS_BUF_INIT = ' '
TABLES
return = gt_return
order_item_in = gt_itemin
order_item_inx = gt_iteminx
PARTNERS =
PARTNERCHANGES =
PARTNERADDRESSES =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
schedule_lines = gt_schdule
schedule_linesx = gt_schdulex
ORDER_TEXT =
ORDER_KEYS =
CONDITIONS_IN =
CONDITIONS_INX =
EXTENSIONIN =
NFMETALLITMS =
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
REFRESH: gt_schdule, gt_schdulex, gt_itemin , gt_iteminx.
LOOP AT gt_return INTO gs_return.
WRITE / gs_return-message .
ENDLOOP .
ENDLOOP.
ENDFORM. " CALL_BAPI_SALESORDER_CHANGE
When I am using material value as 18342 using CONVERSION_EXIT_ALPHA_OUTPUT:
ORDER_HEADER_IN has been processed successfully
Material is not defined for sales org.A101, distr.chan.00, language DE
Error in ITEM_IN 000030
SCHEDULE_IN has been processed successfully
The sales document is not yet complete: Edit data
Sales document 5010000715 was not changed
and when I am using CONVERSION_EXIT_ALPHA_INPUT (000000000000018342)or while debuging when I am changing value to 0018342 :
I am getting below dump:
Runtime Errors DATA_LENGTH_0
Exception CX_SY_RANGE_OUT_OF_BOUNDS
Date and Time 21.10.2010 07:22:17
Information on where terminated
Termination occurred in the ABAP program "SAPLVBAK" - in
"MAP_VBAP_TO_BAPISDIT".
The main program was "RS_TESTFRAME_CALL ".
In the source code you have the termination point in line 168
of the (Include) program "LVBAK001".
The termination is caused because exception "CX_SY_RANGE_OUT_OF_BOUNDS"
occurred in
procedure "MAP_VBAP_TO_BAPISDIT" "(FORM)", but it was neither handled local
nor declared
in the RAISING clause of its signature.
The procedure is in program "SAPLVBAK "; its source code begins in line
99 of the (Include program "LVBAK001 ".
The same dump I am getting while executing this above BAPI from SE37 tcode with the same test data.
but I am able to change it though Va02 tcode.
Edited by: Arora26 on Oct 21, 2010 7:58 AMHi,
have you searched for OSS notes? The note 1137897 looks like related to your problem. It mentions different BAPI but I assume that both BAPI reuse same routines and therefore it might solve your problem as well.
Cheers -
Using Bapi_salesorder_change adding a item, deleting a item,Quanty change
I need help on Bapi_salesorder_change.
I have a table control in which there will be data of a particular sales document no, items, quantity, sales unit. When user changes the quantity, or adds a line item or deletes a line item and the press the save button bapi_salesorder_change should trigger and should change the order as the user changes.
Can u help how to write code for this three conditions
1> adding line item.
2> deleting a line item.
3> changing the quantity.
using bapi_salesorder_change
Can i use the same bapi for three conditions?
Please help me in this as soon as possible.
I thank them in advanceHello Geeks,
i am using this bapi for updating my item quantity no....
but the bapi return msg say tat its not changing....
i think i may did some mistake pls anyone can rectify it....
i hv attached my code below......
*For line item
TYPES :BEGIN OF y_t_vbap,
vbeln TYPE vbeln_va, "sales Document
posnr TYPE posnr_va, "Item no of SD document
matnr TYPE matnr, "Material No
zmeng TYPE dzmeng , "Target qty in Sales unit
spart TYPE spart, "division
message TYPE BAPI_MSG,
kwmeng type kwmeng, "cummulative order qty
END OF y_t_vbap.
TYPES : y_t_itemin TYPE bapisditm,
y_t_return TYPE bapiret2,
y_t_headerx TYPE bapisdh1x.
TYPES: BEGIN OF y_t_logdata,
lno TYPE lineno, "Lineno
field TYPE fieldname, "Field Name
value TYPE lmon_fvalue, "Field Value
message TYPE bapi_msg, "Messages
END OF y_t_logdata.
Internal table declaration
DATA: "y_i_vbak TYPE STANDARD TABLE OF y_t_vbak,
y_i_vbap TYPE STANDARD TABLE OF y_t_vbap,
y_i_headerx TYPE STANDARD TABLE OF bapisdh1x,
y_i_itemin TYPE STANDARD TABLE OF bapisditm ,
y_i_iteminx TYPE STANDARD TABLE OF bapisditmx,
y_i_return TYPE STANDARD TABLE OF y_t_return,
y_i_logdata TYPE STANDARD TABLE OF y_t_logdata,
y_i_bapiret TYPE STANDARD TABLE OF bapiret2.
Table type declaration
TYPES: y_tt_vbap TYPE STANDARD TABLE OF y_t_vbap ,
y_tt_logdata TYPE STANDARD TABLE OF y_t_logdata.
Work Area declaration.
DATA: y_wa_vbap TYPE y_t_vbap,
y_wa_itemin TYPE bapisditm ,
y_wa_iteminx TYPE bapisditmx,
y_wa_headerx TYPE bapisdh1x,
y_wa_return TYPE y_t_return,
y_wa_logdata TYPE y_t_logdata,
y_wa_event TYPE slis_alv_event,
y_wa_event1 TYPE slis_t_event,
y_wa_bapiret TYPE bapiret2.
Variables declaration.
DATA: y_i_event TYPE slis_t_event,
y_v_success TYPE i , "For Success
y_v_error TYPE i , "For Error
y_v_sno TYPE char30 ,
y_v_eno TYPE char30 ,
y_v_msg TYPE char100 . "error msg
Constants declaration.
constants : y_k_x type char1 value 'X',
y_k_u type char1 value 'U',
y_k_e type char1 value 'E'.
SELECTION SCREEN LAYOUT
SELECTION-SCREEN:BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: COMMENT 3(18) text-003.
PARAMETERS : y_p_vbln TYPE vbak-vbeln OBLIGATORY.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN : END OF BLOCK b1.
START-OF-SELECTION.
START-OF-SELECTION.
WRITE: text-002.
END-OF-SELECTION.
END-OF-SELECTION.
SELECT vbeln
posnr
matnr
zmeng
spart
FROM vbap
INTO TABLE y_i_vbap
WHERE vbeln = y_p_vbln.
LOOP AT y_i_vbap INTO y_wa_vbap.
y_wa_vbap-zmeng = 2 + y_wa_vbap-zmeng.
MODIFY y_i_vbap FROM y_wa_vbap INDEX sy-tabix.
ENDLOOP.
PERFORM y_f_update USING y_i_vbap.
*& Form y_f_update
POPULATE BAPI DATA AND RUN BAPI
FORM y_f_update USING y_p_vbap TYPE y_tt_vbap.
CLEAR: y_i_headerx, y_i_itemin, y_i_iteminx,
y_i_return, y_i_bapiret.
REFRESH: y_i_itemin, y_i_iteminx, y_i_return, y_i_bapiret.
LOOP AT y_i_vbap INTO y_wa_vbap.
MOVE y_wa_vbap-zmeng TO y_wa_itemin-target_qty.
MOVE y_wa_vbap-posnr TO y_wa_itemin-itm_number.
APPEND y_wa_itemin TO y_i_itemin.
ENDLOOP.
*Update the Bapi Itnernal tables
y_wa_headerx-updateflag = y_k_u .
APPEND y_wa_headerx TO y_i_headerx.
LOOP AT y_i_vbap INTO y_wa_vbap.
y_wa_iteminx-itm_number = y_wa_vbap-posnr.
y_wa_iteminx-target_qty = y_k_x .
y_wa_iteminx-updateflag = y_k_u .
APPEND y_wa_iteminx TO y_i_iteminx .
ENDLOOP .
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = y_wa_vbap-vbeln
order_header_inx = y_wa_headerx
TABLES
return = y_i_return
order_item_in = y_i_itemin
order_item_inx = y_i_iteminx.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
CLEAR y_i_vbap.
IF y_i_return is not initial.
LOOP AT y_i_return INTO y_wa_return where TYPE = y_k_e .
MOVE y_wa_return-message TO y_wa_vbap-message .
Append y_wa_vbap to y_i_vbap.
y_v_success = y_v_success + 1.
ENDLOOP.
ENDIF.
y_wa_event-name = 'TOP_OF_PAGE'.
y_wa_event-form = 'Y_FD_TOP_OF_LIST'.
APPEND y_wa_event TO y_i_event.
CLEAR y_wa_event.
CALL FUNCTION 'ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_tabtypename1 = 'Y_T_VBAP'
it_events1 = y_i_event[]
TABLES
t_outtab1 = y_i_vbap[]
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " y_f_vbap
*& Form Y_FD_TOP_OF_LIST
FORM y_fd_top_of_list.
MOVE: y_v_success TO y_v_sno,
y_v_error TO y_v_eno.
CONCATENATE text-002 y_v_sno '/' y_v_eno INTO y_v_msg SEPARATED BY
space.
CONDENSE y_v_msg.
WRITE / y_v_msg .
SKIP 1.
ENDFORM. "Y_FD_TOP_OF_LIST -
Regarding adding new pricing condition using BAPI_SALESORDER_CHANGE
Hi All,
I am trying to add a new pricing condition at item level using Bapi_salesorder_change, but it is not getting updated. I am also doing Bapi_transaction_commit as the next step.
I am passing the sales order number and the Update flag in the header. Tried passing G as the logic switch-pricing and also tried with logic_switch-COND_HANDL = X.
I am passing the data in structure CONDITIONS_IN with the value for item numebr, condition step number, condition count , condition value, currency and unit.
Also I am passing data in CONDITIONS_INX with the required flags set and update flag as 'I'.
The output says that order is changed and saved successfully, but the condition type is not there when i check the pricing coinditions inside the order at item level.Please help.
Regards,
Kaustubh B. KhasnisHi,
In the condition tab..
Press the determination analysis button..
There it will show the why the pricing condition type is not added..
Thanks,
Naren -
Update sales order using BAPI_SALESORDER_CHANGE --- URGENT!!!!
Hello,
<b> I want to update Batch, Pricing date, Header text & Item text using BAPI_SALESORDER_CHANGE.</b>
But i am not able to do it.
i have written a code, but it's still not updating:
PARAMETERS: p_vbeln LIKE vbak-vbeln.
TYPES: BEGIN OF t_return.
INCLUDE STRUCTURE bapiret2.
TYPES: END OF t_return.
TYPES: BEGIN OF t_order_item_in.
INCLUDE STRUCTURE bapisditm.
TYPES: END OF t_order_item_in.
TYPES: BEGIN OF t_order_item_inx.
INCLUDE STRUCTURE bapisditmx.
TYPES: END OF t_order_item_inx.
TYPES: BEGIN OF t_schedule_lines.
INCLUDE STRUCTURE bapischdl.
TYPES: END OF t_schedule_lines.
TYPES: BEGIN OF t_schedule_linesx.
INCLUDE STRUCTURE bapischdlx.
TYPES: END OF t_schedule_linesx.
TYPES: BEGIN OF t_order_text.
INCLUDE STRUCTURE bapisdtext.
TYPES: END OF t_order_text.
DATA: l_vbeln LIKE bapivbeln-vbeln,
i_order_header_inx LIKE bapisdh1x,
i_order_header_in LIKE bapisdh1,
i_return TYPE TABLE OF t_return,
i_order_item_in TYPE TABLE OF t_order_item_in,
wa_order_item_in LIKE LINE OF i_order_item_in,
i_order_item_inx TYPE TABLE OF t_order_item_inx,
wa_order_item_inx LIKE LINE OF i_order_item_inx,
i_schedule_lines TYPE TABLE OF t_schedule_lines,
wa_schedule_lines LIKE LINE OF i_schedule_lines,
i_schedule_linesx TYPE TABLE OF t_schedule_linesx,
wa_schedule_linesx LIKE LINE OF i_schedule_linesx,
i_order_text TYPE TABLE OF t_order_text,
wa_order_text LIKE LINE OF i_order_text,
w_return LIKE bapiret2,
l_date TYPE char10.
CLEAR l_vbeln.
l_vbeln = p_vbeln.
UPDATE REJECTION REASON IN SALES ORDER *
*WRITE sy-datum TO l_date.
i_order_header_inx-updateflag = 'U'.
REFRESH i_order_item_in.
CLEAR wa_order_item_in.
wa_order_item_in-itm_number = '000010'.
wa_order_item_in-batch = '2007450027'.
wa_order_item_in-price_date = sy-datum.
wa_order_item_in-reason_rej = '00'.
APPEND wa_order_item_in TO i_order_item_in.
REFRESH i_order_item_inx.
CLEAR wa_order_item_inx.
wa_order_item_inx-itm_number = '000010'.
wa_order_item_inx-updateflag = 'U'.
wa_order_item_in-batch = 'X'.
wa_order_item_in-price_date = 'X'.
wa_order_item_inx-reason_rej = 'X'.
APPEND wa_order_item_inx TO i_order_item_inx.
*wa_order_text-doc_number = l_vbeln.
**wa_order_text-TDOBJECT = 'EHSWA_MAN'.
***wa_order_text-text_id = '0001'.
**wa_order_text-TDTEXT = 'Header Texts'.
*wa_order_text-text_line = 'SYNGENTA HEADER'.
***wa_order_text-function = 'U'.
wa_order_text-doc_number = l_vbeln.
wa_order_text-itm_number = '000010'.
*wa_order_text-TDOBJECT = 'EBAN'.
wa_order_text-text_id = '0001'.
*wa_order_text-TDTEXT = 'Item text'.
wa_order_text-text_line = 'SYNGENTA TEXT'.
wa_order_text-function = '004'.
APPEND wa_order_text TO i_order_text.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = l_vbeln
ORDER_HEADER_IN =
order_header_inx = i_order_header_inx
SIMULATION =
BEHAVE_WHEN_ERROR = ' '
INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH =
NO_STATUS_BUF_INIT = ' '
TABLES
return = i_return
order_item_in = i_order_item_in
order_item_inx = i_order_item_inx
PARTNERS =
PARTNERCHANGES =
PARTNERADDRESSES =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
schedule_lines = i_schedule_lines
schedule_linesx = i_schedule_linesx
order_text = i_order_text
ORDER_KEYS =
CONDITIONS_IN =
CONDITIONS_INX =
EXTENSIONIN =
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = w_return.
ENDIF.
Please help out.
Please send the code of it.
Thanks in advance...START-OF-SELECTION.
Get Blocked Orders
PERFORM sub_select_orders.
PERFORM order_reason_for_reject.
END-OF-SELECTION.
Display output
PERFORM sub_display_output.
*& Form sub_select_orders
text
FORM sub_select_orders .
SELECT a~vbeln
a~erdat
a~erzet
a~auart
b~posnr
FROM ( vbak as A
INNER JOIN VBAP AS B
on Bvbeln = AVBELN )
INTO TABLE i_order_data
WHERE a~vbeln IN s_ordno AND
A~auart IN s_auart AND
A~erdat IN s_orddt AND
A~vkorg IN s_vkorg AND
A~vtweg IN s_vtweg AND
A~spart IN s_spart .
IF sy-subrc NE 0.
MESSAGE i001.
No data selected
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " sub_get_blocked_orders
*& Form order_reason_for_reject
text
--> p1 text
<-- p2 text
FORM order_reason_for_reject .
LOOP AT i_order_data INTO w_order_data.
w_output-vbeln = w_order_data-vbeln.
w_ordhdrx-updateflag = c_update.
Update Order Reason for rejection .
w_orditem-ITM_NUMBER = w_order_data-posnr.
w_orditem-reason_rej = p_abgru.
append w_orditem to i_orditem .
w_orditemx-ITM_NUMBER = w_order_data-posnr.
w_orditemx-updateflag = c_update.
w_orditemx-reason_rej = 'X'.
append w_orditemx to i_orditemx .
At end of vbeln .
w_output-vbeln = w_order_data-vbeln .
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = w_order_data-vbeln
order_header_in = w_ordhdr
order_header_inx = w_ordhdrx
TABLES
ORDER_ITEM_IN = i_orditem
ORDER_ITEM_INX = i_orditemx
return = i_bapiret.
READ TABLE i_bapiret WITH KEY type = c_error
TRANSPORTING NO FIELDS.
IF sy-subrc EQ '0'.
move 'Order Reason for rejection update Failed' to
w_output-message .
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = c_check
IMPORTING
return = i_return.
move 'Order Reason for rejection update successful' to
w_output-message .
endif .
refresh :i_orditemx , i_orditem .
Endat .
APPEND w_output TO i_output.
CLEAR w_output.
endloop .
ENDFORM. " order_reason_for_reject -
Changing quantity using bapi_salesorder_change function
hi ,
i am changing quantity using 'bapi_salesorder_change' function.what are the minimum parameteres that needs to be passsed to the function.i am not able to change the quantity for some items.also for some sales orders i am not getting any error message but commit work is not working.
thanks ,
nitinHi Nitin,
After you call the BAPI_SALESORDER_CHANGE, specifically call BAPI_TRANSACTION_COMMIT , as BAPI_SALESORDER_CHANGE does not run a database commit.(as per the documentation provided by SAP for BAPI_SALESORDER_CHANGE)
Thanks
Lakshman -
How to used BAPI_SALESORDER_CHANGE to add items
Hi, I am trying to use the above bapi to add items to a sales order, but I can't get the qty to map across. I had the same problem using the create bapi whcih I resolved by populating the schedule tables, but in change this just causes an "unhandled exception" to occur, so i can;t even step into the FM to see the problem. Has anyone got any ideas.
s_header_inx-updateflag = 'U'.
* set item data
s_items-itm_number = s_stock-item_no.
s_items-material = s_stock-material_no.
s_items-target_qty = s_stock-quantity.
s_items-target_qu = s_stock-uom.
s_items-ref_doc = s_stock-agreement.
s_items-ref_doc_it = s_stock-agreement_item.
s_items-batch = s_stock-batch.
s_items-plant = s_stock-plant.
s_items-store_loc = s_stock-storage_location_no.
append s_items to it_items.
* set flag to add items (I)
s_itemsx-updateflag = insert.
s_itemsx-itm_number = s_items-itm_number.
s_itemsx-material = abap_true.
s_itemsx-target_qty = abap_true.
s_itemsx-ref_doc = abap_true.
s_itemsx-ref_doc_it = abap_true.
s_itemsx-batch = abap_true.
s_itemsx-plant = abap_true.
s_itemsx-store_loc = abap_true.
append s_itemsx to it_itemsx.
s_sched-itm_number = s_items-itm_number.
s_sched-sched_line = '0001'.
s_sched-REQ_DATE = sy-datum + 30.
s_sched-req_qty = s_items-target_qty.
append s_sched to it_sched.
* set flag to add items (I)
* s_schedx-updateflag = 'I'
s_schedx-itm_number = s_items-itm_number.
s_schedx-sched_line = '0001'.
s_schedx-REQ_DATE = 'X'.
s_schedx-req_qty = abap_true.
append s_schedx to it_schedx.
* Now call the BAPI to add the items
call function 'BAPI_SALESORDER_CHANGE'
exporting
salesdocument = me->number
* ORDER_HEADER_IN =
order_header_inx = s_header_inx
SIMULATION = ' '
* BEHAVE_WHEN_ERROR = 'P'
* INT_NUMBER_ASSIGNMENT = ' '
* LOGIC_SWITCH =
* NO_STATUS_BUF_INIT = ' '
tables
return = it_return
order_item_in = it_items
order_item_inx = it_itemsx
* PARTNERS =
* PARTNERCHANGES =
* PARTNERADDRESSES =
* ORDER_CFGS_REF =
* ORDER_CFGS_INST =
* ORDER_CFGS_PART_OF =
* ORDER_CFGS_VALUE =
* ORDER_CFGS_BLOB =
* ORDER_CFGS_VK =
* ORDER_CFGS_REFINST =
order_schedules_in = it_sched
order_schedules_inx = it_schedx
* ORDER_TEXT =
* ORDER_KEYS =
* CONDITIONS_IN =
* CONDITIONS_INX =
* EXTENSIONIN =hi,
BAPI_SALESORDER_CHANGE didn't work for me either though i'm 100% sure the bapi works
See SAP note 366265 which tells you how to fill the structures but
you can use your program which you used to create the sales order to change the order and all you need to
do is change a few parameters
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
SALESDOCUMENTIN = P_VBELN
ORDER_HEADER_IN = ORDER_HEADER_IN
ORDER_HEADER_INX = 'U'
(make sure your partners are blank, otherwise you'll get a duprec on VBPA)
-( PS , yes, i;m saying , see if BAPI_SALESORDER_CREATEFROMDAT2 works for you)
I hope this helps
Paul Q
Edited by: Paul Quinn on Jun 2, 2011 11:10 PM -
Mass change of BOM item and BOM item catergory
Hello Everyone,
I have a need to complete a mass change of a BOM item with another, usually I use transaction CS20,this works o.k. but this time I'm also changing the material with a new item catergory, for example a stock item with a phantom item.
Does anyone have an idea how to complete this task.
Kind Regards
FrankieHello,
Thankyou very much for your reply.
I did try adding the new material using CS20 but all the BOM qty's are different and as you know you have to complete this field, so it would mean changing one at a time, I attacked this issue from a different angle and created an LSMW so I can Mass delete the parts but then use this program to change the BOM item to the new part.
Thanks again for your reply
Kind Regards
Frankie -
Partner address change issue using BAPI_SALESORDER_CHANGE
Hi,
I'm trying to change partner address in an order using the Bapi BAPI_SALESORDER_CHANGE. I have searched the known threads but did not found a solution.
my requrirement is to change partner address without passing address number to 'PARTNERADDRESSES' parameter
This is brief about my requirement.
Our requirement is sales order executin from ECC6 to ECC5 i.e. when a sales order is created in ECC6 it should be created in ECC5 when we save order in ECC6, so in a similar way even changes done in EC6 sales order should be reflectedin ECC5 (whichi includes ATP also) so during this process a user can add additional line items with different ship_to party address, so for newly added line item in ECC6 during VA02 (change process) address number will not be there in ECC5 so i can not pass address number in ECC5 during address change using BAPI_SALESORDER_CHANGE.
since stock is not maintained in ECC6 we are doing above process i.e. sales order execution from ECC6 to ECC5.
so in order to change partner address for newly added line item in ECC6 i will not be having adrees number in ECC5 so can any body plz let me know how to change address of a parter without passing address number to 'PARTNERADDRESSES' parameter of
'BAPI_SALESORDER_CHANGE'.
If any body has faced this and found a solutin for this plz let me know.
Hope you understood my requirement.give a meaningful title to ur thread, so that, people get u back quickly. Just tip that, try to do ur requirement online, then Observe How the system is behaving....thanq
-
How to use BAPI_SALESORDER_CHANGE to change payment terms in Orders?
Can any body give me an idea on how to use BAPI_SALESORDER_CHANGE to change payment terms in Orders?
Regards,
Dantham ConpolwedsonHi,
try the link
Link:[https://forums.sdn.sap.com/click.jspa?searchID=24060901&messageID=7265357] -
Change item level security using wwsbr_api.modify_item
Hi.
Im using wwsbr_api.modify_item for change item level security.
Its code for change type access for item of my procedure
l_masterid := portal30.wwsbr_api.modify_item(
p_master_item_id => 7061,
p_item_id => 7062,
p_caid => 136,
p_folder_id => 1,
p_display_name => 'test',
p_region_id => 5,
p_access_level => portal30.wwsbr_api.item_access,
p_text => 'test change item security',
p_addnewversion => true, -- My content area have item versioning
level is audit
After execute my procedure access type = folder.
I see in wwv_things table new record
masterthingid = 7061,
id = 7064,
security = 'folder'
How to change item level security programmatically?
ThanksJerry,
Please forgive me for persisting with this, and thankyou for your continued patience, but let me try to explain the issue I'm having in another way...
I have a function that calls wwsbr_api.modify_item to change, say, the description. In this case "description" is the one and only thing I want to change about the item. As you've described above, I am able to query most things associated with the item (via wwsbr_all_items, wwsec_api.grantee_list, etc) so that I can pass current values to the wwsbr_api.modify parameters. However, I haven't found a way to query the current level of access control for a given item (i.e. wether it is currently set to ITEM_ACCESS, FOLDER_ACCESS, or null). As documented, I can force the item to be ITEM_ACCESS or FOLDER_ACCESS. However, I don't want to force a value and as we have concluded, passing null will nullify the current state.
So, in summary, an answer to this question will solve my problem:
Is it possible to query the current access control level of an item (either directly via one of the published views or indirectly via one of the views)?
If the answer is yes - great that solves my problem. How please?!?!?
If the answer is no - this must be a bug is it would mean that it isn't possible to use wwsbr_api.modify_item without inadvertently altering the current access control level of the item.
Again thanks for your patience...
Mark
Maybe you are looking for
-
Transfer Movies from iPod to PC
Ok, so my PC recently crashed, all my movies and songs going down with it. I had about 2000 songs and about 50 movies. All of the songs and movies are on my iPod right now, but how can i get them back on my PC in case my iPod Classic crashes? Thanks
-
Quick question - Setting up an XP desktop to stream music through AE?
Hi, This might be a silly question, but I'm slightly confused about how to set up the Airport Express to stream music to my sound system. I am buying a desktop (win XP) which I connect via ethernet cable to my existing wireless router (D-Link). Does
-
I can't open any app since I restore my phone ( company setting) all the app the I download are all the same I don't know what to do! please help Thz
-
Where is Facebook on Mountain Lion?
I got the new OSX Mountain Lion and i cant find Facebook on it, please help. <Edited by host>
-
I'm curious if anyone is using the Cisco Content switches to load balance traffic/sessions across a citrix server farm. Any luck and what type of load balancing method did you use? Round robin? Response time? And do these methods REALLY work with Cit