Sales order change BAPI not updating items Profit center
Dear ,
I am facing the problem in using the BAPI for Item 's profit centre in blank space.
I write down the below code <but it's not at all updating the profite centre .
please ccorrect the code if any required'
TYPES: BEGIN OF file_data ,
vbeln TYPE vbap-vbeln, " order numner
posnr TYPE vbap-posnr, " orderitem
profit_ctr TYPE vbap-prctr, " [profite centre
END OF file_data.
DATA: t_data TYPE STANDARD TABLE OF file_data .
DATA : wa_data LIKE LINE OF t_data.
DATA: t_data_item TYPE STANDARD TABLE OF file_data .
DATA : wa_data_item LIKE LINE OF t_data_item.
**DATA: t_data_item TYPE file_data OCCURS 0.
*DATA: return TYPE STANDARD TABLE OF bapiret2.
*DATA: wa_return LIKE LINE OF return.
DATA: wait LIKE bapita-wait VALUE 'X'.
DATA: s_order_header_in LIKE bapisdh1.
DATA: s_order_header_inx LIKE bapisdh1x.
DATA: BEGIN OF i_order_item_in OCCURS 0.
INCLUDE STRUCTURE bapisditm.
DATA: END OF i_order_item_in.
DATA: BEGIN OF i_order_item_inx OCCURS 0.
INCLUDE STRUCTURE bapisditmx.
DATA: END OF i_order_item_inx.
DATA: BEGIN OF it_return OCCURS 0.
INCLUDE STRUCTURE bapiret2.
DATA: END OF it_return.
***********************selection
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS : file LIKE rlgrap-filename OBLIGATORY.
"ctu_mode TYPE ctu_mode DEFAULT 'N'.
SELECTION-SCREEN END OF BLOCK b1.
*********assign file
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
CLEAR file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = file
EXCEPTIONS
OTHERS = 1.
DATA: it_text TYPE truxs_t_text_data .
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
i_line_header = 'X'
i_tab_raw_data = it_text
i_filename = file
TABLES
i_tab_converted_data = t_data[] " Your internal table of structure of Excel sheet
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
t_data_item[] = t_data[].
DELETE ADJACENT DUPLICATES FROM t_data COMPARING vbeln.
Header update indicator
s_order_header_inx-updateflag = 'U'.
Line items
REFRESH: i_order_item_in, i_order_item_inx.
LOOP AT t_data INTO wa_data.
LOOP AT t_data_item INTO wa_data_item WHERE vbeln = wa_data-vbeln. .
i_order_item_in-itm_number = wa_data_item-posnr.
i_order_item_in-profit_ctr = wa_data_item-profit_ctr.
i_order_item_inx-itm_number = wa_data_item-posnr.
i_order_item_inx-updateflag = 'U'.
i_order_item_inx-profit_ctr = 'X'.
APPEND: i_order_item_in, i_order_item_inx.
ENDLOOP.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_data-vbeln
IMPORTING
output = wa_data-vbeln.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = wa_data-vbeln
order_header_in = s_order_header_in
order_header_inx = s_order_header_inx
behave_when_error = 'P'
TABLES
return = it_return
order_item_in = i_order_item_in
order_item_inx = i_order_item_inx.
i already used same But it's not working
s_order_header_inx-updateflag = 'U'.
Line items
REFRESH: i_order_item_in, i_order_item_inx.
LOOP AT t_data INTO wa_data.
LOOP AT t_data_item INTO wa_data_item WHERE vbeln = wa_data-vbeln. .
BAPISDITM
i_order_item_in-itm_number = wa_data_item-posnr.
i_order_item_in-profit_ctr = wa_data_item-profit_ctr.
BAPISDITMX
i_order_item_inx-itm_number = wa_data_item-posnr.
i_order_item_inx-updateflag = 'U'.
i_order_item_inx-profit_ctr = 'X'.
APPEND: i_order_item_in, i_order_item_inx.
ENDLOOP.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_data-vbeln
IMPORTING
output = wa_data-vbeln.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = wa_data-vbeln
order_header_in = s_order_header_in
order_header_inx = s_order_header_inx
behave_when_error = 'P'
TABLES
return = it_return
order_item_in = i_order_item_in
order_item_inx = i_order_item_inx.
Similar Messages
-
Extending sales order change BAPI and updating custom fields
Hi
i added 3 new fields into VA01/02/03 screen.i added at the header level in the additional data tab B area and appended them in VBAK table.
i want to change these values using sales order change BAPI.i added the fields in the structure VBAKKOZ,VBAKKOZX,BAPE_VBAK,BAPE_VBAKX.
may i know what else i need to do?should i move them anywhere with in the code or does the bapi take those values automatically using EXTENSIONIN structure?
also can some one send me code to actually check if bapi is changing my values?
if poss tell me how should i populate values into BAPI.After adding field in structures VBAKKOZ,VBAKKOZX,BAPE_VBAK,BAPE_VBAKX, create pair of name-value pair extensiot structure and value.
Fill values as follows :
Data : ls_parex TYPE bapiparex,
lt_parex TYPE STANDARD TABLE OF bapiparex.
ls_parex-structure = 'BAPE_VBAK'.
ls_parex-valuepart1+0(10) = Sales order no
ls_parex-valuepart1+10(XX) = somevalue. <---- Value for custom field no 1
ls_parex-valuepart1+XX(XX) = somevalue. <---- Value for custom field no 2
APPEND ls_parex TO lt_parex .
clear ls_parex.
ls_parex-structure = 'BAPE_VBAKX'.
ls_parex-valuepart1+0(10) = Sales order no
ls_parex-valuepart1+10(1) = 'X'. <--- checkbox mark for custom field no 1
ls_parex-valuepart1+11(1) = 'X'. <--- checkbox mark for custom field no 2
APPEND ls_parex TO lt_parex.
Same pair for VBAKKOZ & VBAKKOZX
Updating custom fields
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = Sales order number
order_header_inx = 'U' <--- U for update
TABLES
extensionin = lt_parex[].
Edited by: nkarwa on Oct 25, 2010 12:39 PM -
Sale Order change BAPI - Storage loc not updated
Hi Everybody,
Iam using "BAPI_SALESORDER_CHANGE", to change the sale order items.
First iam calling above bapi with switch B, for new pricing & then second time for material change.
When i change any material number, it is getting updated correctly.
But the storage location, even though iam passing in the bapi it is not updated, & is blank - updation flag is also passed.
When i execute sale order change again it is updated - ie, for any material change for first bapi call, storage loc is not updated - for 2nd bapi call storage loc is updation - for same input in both the cases.
Is there any way to update the storage loc is first call of sales order change bapi.
Below is the parameters iam passing in bapi :
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = LS_SALESDOCUMENT
ORDER_HEADER_IN = LT_HEADER_IN
ORDER_HEADER_INX = LT_HEADER_X
TABLES
RETURN = LT_RETURN
ORDER_ITEM_IN = LT_ITEMS
ORDER_ITEM_INX = LT_ITEM_X
ORDER_CFGS_REF = LT_CFGS_REF
ORDER_CFGS_INST = LT_PARTS
ORDER_CFGS_VALUE = LT_VALUES
ORDER_CFGS_BLOB = LT_CUBLOB
ORDER_CFGS_VK = LT_CUVK
ORDER_CFGS_REFINST = LT_CUREF
SCHEDULE_LINES = LT_SCHEDULE_L
SCHEDULE_LINESX = LT_SCHEDULE_X
ORDER_TEXT = LT_TEXT
CONDITIONS_IN = LT_CONDITION_L
CONDITIONS_INX = LT_CONDITION_X.
Any help is appreciated.
Regards,
Nagarajan.JHi,
Storage location is updated only when same sale order bapi is called another time with required details.
rgs,
Nagarajan J -
Calling a Sales Order Change BAPI in a Sales Order Exit
Functional Requirement:
While creating a Sales Order with Reference to another Sales Order, on saving the new sales order, change something in the referenced sales order.
I am trying to achieve the same by doing the following:
In the standard SAP user exit called during saving the new sales order USEREXIT_SAVE_DOCUMENT I am calling the BAPI BAPI_SALESORDER_CHANGE on the referenced Sales Order.
However the BAPI is unable to change the other sales order giving an error Enter the document number. I am specifying the Document Number while calling the BAPI, so I know that is not the error.
I just wish to know whether it is technically possible to call a BAPI to update another Sales Order while we are currently saving one Sales Order.Hi Girish,
If it works correctly when run seperately and you are sure the data passed into the BAPI is exactly the same then it may be something like table locks or similar causing your original problems...
What about packaging up your working Z program into a custom function module and calling that from within USEREXIT_SAVE_DOCUMENT as a seperate task (IN NEW TASK) and building in a slight delay of say 5 seconds at the start of your code?
I'll be honest, this isn't an ideal solution but might be sufficient to resolve your issues. I'd be inclined to see if you could just run your Z program as a background process every 5 minutes or so to capture any changes and perform updates but if this is a no no from your functional people I'm not sure what else to suggest sorry. I've never personally had to update a document from within the save routine of another document so can't give any advice based on my own experiences sorry.
Gareth. -
Sales Order Change BAPI - Reason for Rejection
Hi,
I want to update reason for rejection field for a particular sales order at item level. When I am executing the BAPI "BAPI_SALESORDER_CHANGE", I am getting the error "Field header_inx-updateflag is not an input field". I did not check this field as I'm not making any change in the header part.
Please help me in resolving this issue. Let me know if I have to provide any other information.
regards,
ravikiran.Found BAPI myself...... BAPI_SALESORDER_CHANGE
-
Credit card handling using sales order change BAPI
Hi all,
Currently, I am working on creating a custom BAPI for changing the sales order information. I am having a scenario where I need to handle multiple credit cards during the change of the sales order data. For example, if I have created a sales order with a credit card A and a bill amount of 100. Now, in the change BAPI, I need to handle the situation like I would be getting two credit cards data out of which I need to Bill against credit card A with 200 and credit card B with 300. I need to see the entries in the sales order processing in the following fashion:
During the creation:
Credit card type Credit card number Maximum amount Limit To
AMEX A 100 Flag checked
After performing change order:
Credit card type Credit card number Maximum amount Limit To
AMEX A 100 Flag checked
VISA B 300 Flag checked
AMEX A 100 Flag checked
Which implies that I am billing 200 against card A and 300 against card B.
I want to acheive this functionality. Can any one throw some light in order to accomplish my task?
Thanks in advance,
From,
Adithyai already used same But it's not working
s_order_header_inx-updateflag = 'U'.
Line items
REFRESH: i_order_item_in, i_order_item_inx.
LOOP AT t_data INTO wa_data.
LOOP AT t_data_item INTO wa_data_item WHERE vbeln = wa_data-vbeln. .
BAPISDITM
i_order_item_in-itm_number = wa_data_item-posnr.
i_order_item_in-profit_ctr = wa_data_item-profit_ctr.
BAPISDITMX
i_order_item_inx-itm_number = wa_data_item-posnr.
i_order_item_inx-updateflag = 'U'.
i_order_item_inx-profit_ctr = 'X'.
APPEND: i_order_item_in, i_order_item_inx.
ENDLOOP.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wa_data-vbeln
IMPORTING
output = wa_data-vbeln.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = wa_data-vbeln
order_header_in = s_order_header_in
order_header_inx = s_order_header_inx
behave_when_error = 'P'
TABLES
return = it_return
order_item_in = i_order_item_in
order_item_inx = i_order_item_inx. -
Sales order qty is not updated in COPA
Dear All,
for Warranty process ; we are using the standard item category - TANN which is working correctly and updates the sales qty in COPA at the time of billing
and today we have created new Z item category-ZTAA ( it is same as standard item category ) but this item category is not posted any COPA values at the time of billing and its posted the COPA at the sales order settlement without sales qty values.
Can you please help me to know the reason for this 2 item category behavior and what can be the missing configuration or setup ? ( pls note i have checked different settings for this both the item categories configuration and the configuration is always same )
Thanks for your quick feedback
Regards
RamuHi Ajay,
yes ; i already checked this settings and the sales order does not have any requirement type.
i think its very strange for me becuase both standard item categories ( without any item type in item categories ) and the behaviour is different ; for your quick reference pls check the below exmaple.
Sales order - 123
Item-10 /TANN
Item-20/ZTAA
COPA results :
for item -10 , COPA is posted at the time of billing with correct qty
for item-20, COPA is posted at the time of sales order settlement without qty.
BR
Ramu -
Sales order delivery date not update on PO delivery confirmation
Hi all,
I have the following issue. When a sales order is created for a material that is to be purchased a purch req is automatically created. Next I create a Po from this Purch req. When I confirm the delivery date to a later date in this po and do this without entering a storage loc in the po, the delivery date in the sales order remains unchanged, which should be adjusted according to the confirmed delivery date in the PO.
When I do this with a storage location, the date is changed in the sales order.
Anybody any ideas on what could be the reason for this?
Thanks,
Kevin.Hi there,
I thumb rule that you have to follow when posting the thread is, to be clear in what you are asking. Looking at the thread posted, can you make out anything? No spaces, no full stops. How will people understand what your query is? Just read back your question & help us understand what does the query mean.
From what you have given, you are saying that in material master MRP views, GR processing time is mentioned as 15 days. What after that? Are you asking of the materials are available before that 15 days & you run an availability check is the delivery date going to change? Is that what you are asking?
If the material is already available on that date, system will confirm the reqested delivery date. If item is not available then system will propose a new confirmed delivery date basing on the availability check. It will not propose a date which is earlier to the requested delivery date. It either confirms the requested delivery date or proposes a confirmed delivery date at a later time.
For eg when the customer requests delivery on the 25th in the sales order, then if material is available, system will confirm 25th as the delivery date. If material is not available,, then it will check item availability & proposes 28th as confimed delivery date. It will never propose 22nd as delivery date.
Regards,
Sivanand -
Quantity confirmed in sales order change mode not in display mode !!!
Dear All !!
We have a problem in sales order .
In sales order the line item 580 quantity confirmed 15 pc in change mode VA02 if I open the sales order in display mode VA03 the quantity confirmed “0”
More details refer the attachment .
Kindly advise why the system behaving like this and suggest how to control.
Thanks in advance.
Best Regards,
RampeDear All !!
The issue has been sort it out .
Reason for cause : The Problem happened due to wrong material master data defined in material master.
The material has been changed and marked "as configurable material" in material view "Basic Data 2".Even though the material is not configurable. So we have forced correct value in material master and open the sales order with VA02 and then saved in order to redetermine correct master data. Then the problem got resolved.
Thanks for your Help.
Best Regards
Rampe -
Completed sales order changed with the updated ship-to address
Hi,
My client did the following test and found that:
- Change the ship-to address of a customer
- new sales order of this customer defauted to the update ship-to address (good!)
- old/completed sales orders of this customer show the new ship-to address (bad!)
Data used in occurred transactions should not be affected by data maintenances that made after the transactions. So, is the finding a design flaw in OM or there is parameter that can be tuned?
Thanks in advance for any input!Hi,
Oracle will not store the entire Address in Sales Order tables. It will only store the internal id.
Now there could be two possible scenarios for which your client tried to chance the ship to address:
1) There is a correction required in the address(e.g. change in street name). If this is the case then changing the address would be correct approach, and I think all the sales orders(old or new) should reflect correct address.
2) If there is a relocation, then the correct approach would be to make the current customer site inactive and create a new site for the new address instead of changing the existing site. Changing the address of existing site for such a business scenario may not be a correct approach.
So based on what was the reason for changing the ship to address, I would say the system is functioning as expected.
Hope this helps.
Regards,
Nitin S. Darji -
Sales order text is not updating
Hi All,
call function 'SD_SALESDOCUMENT_CHANGE'
exporting
salesdocument = salesdocument
order_header_inx = w_order_header_inx
simulation = testrun
business_object = 'BUS2032'
call_from_bapi = 'X'
tables
return = return
sales_text = order_text
textlines_ex = text_lines.
COMMIT WORK.
I am using above FM for updating Sales order test .I am Passing test in the Prameters textlines_ex = text_lines.
I am Unable to dig what the issue is .Can anyone help me out in this .
salesdocument = Sales Document number
Moderator Message: Even we cant help you, with a question like that. Put more effort into framing your questions.
Edited by: kishan P on Jan 9, 2011 6:56 PMSounds like a text determination config issue - have you assigned the text in VOTXN? Have you run the text determination analysis from VA02 in the document?
-
Asset acquisition value is not updated in Profit center as well as segment
Dear All,
I procured an asset through MM, (MIGO and MIRO). the acquisition value is updated in the asset master as well as GL account. but no value is updated in the profit center and related segment.
I did the following (using ECC 6, document spiltting activated)
1. Asset master data created and cost center assigned. Profit center is assigned in the Cost center and Segment is assigned in the profit center master data.
1. me21n - po created
2. MIGO - done
3. MIRO - done.
Can any one help me to solve this issue
Looking forward your valuable reply
Thanks in advance
regards
GovanHi
Please check whether cost center is suppressed field for the respective GL Account. Also it seems that you have not made profit cneter as mandatory field. Goto IMG> Financial Accounting (New) > General Ledger Accounting (New) > Business Transactions > Document Splitting > Define Document Splitting Characteristics for General Ledger Accounting . Here you can make the mandatory field as per requirement.
Warm Regards -
Valuation field not updated in Profit Center view
Good morning Gurus,
I am facing a big problem in KE24 report. As I've checked here, one of my valuation fields related to Raw Materials (VVM01) is only being updated in Legal View from CO. Even I check it in CE1SA01 table (my table for CO documents), the value is not updated there for Profit Center view. I've check all exits that we have here, but the problem is not there. Derivation rules for the field are not customized, so I don't know where is the problem.
Anyone have already faced this problem? Could you please help me? Points will be awarded.
Many thanks in advance,
Diogo Patriota.Issue has been resolved.1
Issue has been resolved -
3KEH Balance Sheet Values not updated in Profit Center
Hello Peofit Center experts
I have Assigned Profit Center for few balance Sheet Accounts in 3KEH.But values are not updated in respective Profit Centers.
I have to do any configuration settings for transfer Balance Sheet accounts to Profit center or Assignment 3KEH is enough.
Please guide me
Thanks
Kameshwar RaoIssue has been resolved.1
Issue has been resolved -
Sales Order Change BAPI Extension for Customer Fields
Hello!
I am working on customer field enhancement for BAPI_salesorder_change. The extensionin parameter has more than 1000 characters (fields in the structure BAPE_VBAP) and hence, the two fields that I added to VBAP (using append structure) are not getting the data.
I have followed all the steps that was given in the documentation to fill extensionin like adding the fields to VBAPKOZ and BAPE_VBAP. This is the logic I have used to fill EXTENSIONIN:
BAPE_VBAP-VBELN = P_order.
BAPE_VBAP-POSNR = i_vbap-posnr.
BAPE_VBAP-ZZSTART_DT = sy-datum.
BAPE_VBAP-ZZdnload_DT = sy-datum.
T_EXTEN-STRUCTURE = 'BAPE_VBAP'.
*T_EXTEN+30 = BAPE_VBAP.
T_EXTEN-valuepart1 = bape_vbap.
T_EXTEN-valuepart2 = bape_vbap+240(240).
T_EXTEN-valuepart3 = bape_vbap+480(240).
T_EXTEN-valuepart4 = bape_vbap+720(240).
APPEND T_EXTEN.
Clear t_exten.
BAPE_VBAPX-VBELN = P_order.
BAPE_VBAPX-POSNR = i_vbap-posnr.
BAPE_VBAPX-ZZSTART_DTX = 'X'.
BAPE_VBAPX-ZZdnload_DTX = 'X'.
T_EXTEN-STRUCTURE = 'BAPE_VBAPX'.
T_EXTEN-valuepart1 = bape_vbapx.
APPEND T_EXTEN.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = p_order
order_header_inx = ORDER_HEADERX
tables
return = T_RETURN
*ORDER_ITEM_IN = T_LINE
*ORDER_ITEM_INX = T_LINEX
EXTENSIONIN = T_EXTEN.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
I guess there is 960 character limitation for BAPIPAREX structure but I would like to know if there is a way to work around it.
Thanks to all for your time.Found BAPI myself...... BAPI_SALESORDER_CHANGE
Maybe you are looking for
-
Mid 2010 15" Macbook Pro Random Shut down and Restart
I know this questions have more than likely come up a few times. But I have a mid 2010 15" Macbook pro that, for the last year, has randomly shut-down and restated displaying an error message each time. I have had this computer into three different c
-
I inadvertently deleted my iPhone backup on my MacBook Pro. I restored iPhone to factory settings and then synced remotely with iCloud. However the error message repeatedly states: iTunes could not back up the iPhone because the backup was corrupt or
-
Problem in creating Excel file
Dear all, i have occured aproblem while creating an Excel file while using JSP. in my jsp file i have given the two codes of line: <% response.setContentType("application/vnd.ms-excel"); response.addHeader("Content-Disposition", "attachment"); %> whi
-
Need help converting Oracle PIVOT script to SQL Server
I hope it is not inappropriate to ask for SQL Server question in a .NET forum. I can not understand SQl 2k5+ syntax for pivoting. I am pivoting on company name and storenbr in the following. Thanks for any help. WITH dummydata AS SELECT 'Stor
-
Value Contracts for Credit note
Dear Friends, Can we create Value contracts for Credit note processing? Please refer to the below scenario: I have certain budget that needs to be distributed to some of the customers depending upon the claims (Credit Notes). This budget is included