‎2014 Oct 28 11:21 AM
Dea All,
Can I modify data of VBAP table .? I want to change the FKREL field from A to C.
Regards,
Aneel
‎2014 Oct 28 12:45 PM
The question you should be asking, is "should you modify data of table VBAP"... The answers you have received so far make me cry.
There is a massive gap between what you can technically do on a system, and what you should actually do. There are all sorts of reasons why direct updates of standard SAP tables are bad. If you search, you will find lots of discussions about them.
Cheers,
G.
‎2014 Oct 28 11:59 AM
Moderator message: updating standard SAP table directly is a silly thing to do, and it is equally silly to advise others to do it.
Hello
go to se38-> type UPDATE-> hit F1.
*------------------------
TABLES VBAP.
UPDATE VBAP SET FKREL = 'C'
WHERE FKREL = 'A' .
*------------------------
regrads
faiz rahman
Moderator message: updating standard SAP table directly is a silly thing to do, and it is equally silly to advise others to do it.
Message was edited by: Matthew Billingham
‎2014 Oct 28 12:01 PM
Moderator message: updating standard SAP table directly is a silly thing to do, and it is equally silly to advise others to do it.
Hi,
If you are trying to multiple records then you can use the above logic which has suggested by Anish otherwise if you are trying to modify few records then please follow this process. its very simple.
in se11-> display the records whatever data you want to modify->enter /h in command box and select enter->then it will get the debugging mode->there change the value of Code(initally the value will be 'SHOW').
code = EDIT then you will get change mode there you can change the data.
Thanks & Regards,
Polu
Moderator message: updating standard SAP table directly is a silly thing to do, and it is equally silly to advise others to do it.
Message was edited by: Matthew Billingham
‎2014 Oct 28 12:47 PM
Hi Polu,
Are you suggesting that using debug to work around authorisation checks and directly update a standard SAP table is something you would actually consider doing on your's/your customer's systems?
Cheers,
G.
‎2014 Oct 28 12:45 PM
The question you should be asking, is "should you modify data of table VBAP"... The answers you have received so far make me cry.
There is a massive gap between what you can technically do on a system, and what you should actually do. There are all sorts of reasons why direct updates of standard SAP tables are bad. If you search, you will find lots of discussions about them.
Cheers,
G.
‎2014 Oct 28 1:21 PM
I'm not a developer and I can see why some client sites have the developers sit a test before they are provided with a developer key and S_DEVELOP access.
‎2014 Oct 28 1:29 PM
You know, it's a place for developper here, only developper
sorry, hard day today
Fred
‎2014 Oct 28 1:58 PM
Hopefully my editing of those responses will allow you to dry your eyes. I was going to reject them, but I think I'll leave them with my comment, pour encourager les autres.
‎2014 Oct 29 4:53 AM
Agreed ,
Rather than rejecting these threads should be highlighted like this only.
This will make people stop themselves and think twice before posting any REALLY SILLY answers like this.
And this will even make them smile when after having a long experience with SAP they turn back their earlier pages in SCN.
‎2014 Oct 28 1:01 PM
Can I modify data of VBAP table .?
Yes.
Should I modify data of VBAP table .?
NO
Can you explain your requirement? what do you want to achieve?
‎2014 Oct 28 1:05 PM
If you can explain the business process as to why you want to change in table instead of achieving via standard configuration, suitable suggestion can be given. Also, you have not indicated at which stage you want to change. After saving the sale order or creation of subsequent document ? Need more detailed explanation
G. Lakshmipathi
‎2014 Oct 28 1:30 PM
You should not change the transactional data of client directly from the table as all these changes are get stored and at the time of audit can cause issues. Ask your functional consultant to do it through front end.
Thanks
‎2014 Oct 28 1:36 PM
Did you try BAPI_SALESORDER_CHANGE.
NB: Don't update standard tables with OPEN-SQL statement, for database sake (or just database consistency)
But why do you want to change this field, is its valued determined thru Customizing (VOV7 ?) as well as history/flow of documents, so you should change other fields (e.g. ) to get this result. Ask functional to perform this requirement thru VA02, if they cannot, close.
Regards,
Raymond
‎2014 Oct 29 4:37 AM
Dear All,
Thanks for your reply and help. I dont want to update the table by using direct sql. I want to use BAPI. I have used the fillowing code . The system gives message that order has been updated but when I open the table, the data is not updated. The code is given below. Remember that I want to change the field 'FKREL' of VBAP table from 'A' to 'C'.
Regards,
Aneel
report zaneel.
data: t_item like bapisditm occurs 0 with header line.
data: t_itemx like bapisditmx occurs 0 with header line.
data: t_return like bapiret2 occurs 0 with header line.
data: bapisdh1x like bapisdh1x.
data: t_vbap like vbap occurs 0 with header line.
bapisdh1x-updateflag = 'u'.
t_item-itm_number = '10'.
t_item-bill_rel = 'A'.
append t_item. t_itemx-itm_number = '10'.
t_itemx-updateflag = 'u'.
t_itemx-bill_rel = 'C'.
append t_itemx.
call function 'bapi_salesorder_change'
exporting
salesdocument = '0020000085'
order_header_inx = bapisdh1x
tables return = t_return
order_item_in = t_item
order_item_inx = t_itemx .
loop at t_return where type = 'e'
or type = 'a'.
exit.
endloop.
if sy-subrc = 0.
write: / 'sales order not updated',
t_return-message.
else.
write: / 'sales order updated'. endif.
commit work.
‎2014 Oct 29 5:40 AM
t_item-bill_rel = 'A'. < --- this should be 'C'
t_itemx-bill_rel = 'C'. <-- this you try 'U" and 'X', one of them should affect.
‎2014 Oct 29 5:48 AM
I used this code then even data not changed.
REPORT zaneel.
DATA: t_item LIKE bapisditm OCCURS 0 WITH HEADER LINE.
DATA: t_itemx LIKE bapisditmx OCCURS 0 WITH HEADER LINE.
DATA: t_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: bapisdh1x LIKE bapisdh1x.
DATA: t_vbap LIKE vbap OCCURS 0 WITH HEADER LINE.
bapisdh1x-updateflag = 'U'.
t_item-itm_number = '000010'.
t_item-bill_rel = 'A'.
APPEND t_item.
t_itemx-itm_number = '000010'.
t_itemx-updateflag = 'U'.
t_itemx-bill_rel = 'X'.
APPEND t_itemx.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = '0020000085'
order_header_inx = bapisdh1x
TABLES
return = t_return
order_item_in = t_item
order_item_inx = t_itemx.
COMMIT WORK.
LOOP AT t_return WHERE type = 'e'
OR type = 'a'.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
WRITE: / 'sales order not updated',
t_return-message.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
WRITE: / 'sales order updated'.
ENDIF.
COMMIT WORK.
‎2014 Oct 29 5:54 AM
t_item-bill_rel = 'A'.
Shouldnt this be 'C'?
Also try to debug to see if this value is passed onto vbap-fkrel or else you'll have to use some exit or badi for the same
‎2014 Oct 29 6:11 AM
‎2014 Oct 29 6:24 AM
‎2014 Oct 29 6:33 AM
I want to change by using BAPI. Why above code is not working.?
Regards,
Aneel
‎2014 Oct 29 6:53 AM
Did you have check the RETURN table of the BAPI function ?
Fred
‎2014 Oct 29 7:10 AM
Debug and check how the values are passed on, if you check the code in bapi, another FM SD_SALESDOCUMENT_CHANGE is called, now within this check -
perform ms_move_item_in tables return
item_in.
In this perform I dont see FKREL or BILL_REL being used so I think this field may not be used by the bapi to update FKREL.
I see a BTE in this ms_move_item_in_bte_00501020 you can use this to read itemin and populate vbapkom-fkrel
‎2014 Oct 29 7:16 AM
‎2014 Oct 29 7:19 AM
Kartik,
When you search 'FKREL' in table 'BAPISDITM' then it will take you to the field 'BILL_REL'.
Thats why I used this field.
Regards,
‎2014 Oct 29 7:21 AM
Aneel,
Sharing Lakshmipathi G's the point of view this change does not make much sense functionally!
The sales orders have to billed based on the quantity delivered.
You want to "forcefully" change it to quantity in order (more specifically target quantity) which is applicable in credit process etc.
Assuming that you can do this change in VBAP, after that business might encounter issues...to create subsequent documents, e.g. bill, quantity in bill etc. etc. (I don't really know what all problems can be faced)
I share the same thoughts as Raymond too
As your functional analyst for the reasons.
Typewriter
‎2014 Oct 29 7:24 AM
BILL_REL is indeed FKREL, but doesnt mean BAPI will update that automatically, as I mentioned ITEMIN-BILL_REL doesnt have any mapping to VBAPKOM-FKREL, so you need to use the BTE I mentioned above and move the values
‎2014 Oct 29 7:29 AM
First ask functional analyst to perform a demo with VA02, if he is not able to change the value, not much hope with the BAPI. (I'm nearly convinced this field is actually calculated from Customizing and changed during life of SO, e.g. already invoicde, material shipped, etc.) -> so note the data changed by functional and try to replicate in BAPI call, of course if requester is unable to change the value...
NB: I'm not sure (not SD/CRM specialist) but the flag you try to change in the BAPI call is CRM related ?
Regards,
Raymond
‎2014 Oct 29 7:30 AM
Btw do check with your functional consultant on why they dont want this to be done via config, config should be first priority, development should be take up only if there are limitation in doing this via config
‎2014 Oct 29 7:43 AM
Raymond,
As you said, FKREL (billing relevance) in VBAP comes from the item category used in the sales order, at line item.
In item category configuration VOV7, we set billing relevance.
So if we want to change VBAP-FKREL, the user changes the item category in the sales order. Only permitted to a certain stage in the sales process (logically so)
Directly changing FKREL without changing the item category might lead to many issues, if there is no copy control then billing quantity will be an issue etc.
Aneel,
So better don't do this change at table level
Or else...we don't know what other things might not work or work incorrectly.
Typewriter
‎2014 Oct 29 7:50 AM
So if his functional analyst is able to change item category, just code the same in BAPI, else not possible so try to refuse... else -> Note 7 - Error caused by customer modification/development
Else if the actual requirement is correction of currently wrong values in database, look at good old correction reports like SDVBUK00 (Such reports can be found in some OSS notes)
Regards,
Raymond
‎2014 Oct 29 8:00 AM
added: aneel, as you want to change A to C, even by changing item category; I suggest do not do it
C is for completely different process, in comparison to A
Let business or functional handle this. (with VA02)
Aneel,
As suggested by Raymond,
Discuss this with your functional analyst -
- Why change to C?
as commented earlier, this is used for target qty e.g. credit process etc.
- try to change VBAP-PSTYV (item category)
(and not FKREL)
Typewriter
Message was edited by: TW Typewriter
‎2014 Oct 29 9:08 AM
the usage of billing relevance in this BAPI is restricted to new dimension products like CRM, you can read this in 429160 - Billing-relevance indicator CRM: BTE interface
‎2014 Oct 29 10:21 AM
Thank you to all for helpful suggestions .
We will try to resolve it through SAP front end.
Regards,
Aneel