04-06-2010 11:53 AM
I have values of VKBD in Intrenal table I_VBKD and have an another internal table I_FINAL.
I need to modify a field in the standard table using BAPI.
Conditins are as below :
if COLA/Economic change date = u201800000000u2018. "SPACE
Change VBKD-PRSDT = = Date of first adjustment
Else
Change VBKD-PRSDT = = COLA/Economic change date.
Endif
My code :
LOOP AT I_FINAL INTO WG_FINAL.
IF WG_FINAL-ZZCOLA_ECO = '00000000'. "sPACE
READ TABLE I_VBKD INTO WG_VBKD WITH KEY VBELN =
WG_FINAL-VBELN BINARY SEARCH.
IF SY-SUBRC = 0.
WG_VBKD-PRSDT = WG_FINAL-ZZCOLA_DATE.
* Change VBKD-PRSDT = = Date of first adjustment
*** Updating the database
MODIFY VBKD FROM WG_VBKD. " Here instead of Modify i want to use BAPI.
Can somebody provide me some sample code code how i can achive this?
Any suggestions are appreciated!
Regards,
Kittu
Edited by: Kittu on Apr 6, 2010 12:53 PM
04-06-2010 12:03 PM
Hope this is update related to sales order. If yes use BAPI "BAPI_SALESORDER_CHANGE"
Regards
Vinod
04-06-2010 12:02 PM
You will not have BAPI specific to one table. You will get the BAPI based on the transactions, it will update all the relevant tables.
If you want to update only one single table, then you can make use of the below function module.
DB_UPDATE_TABLE.
Here you need to pass the table name and it's contents as well.
04-06-2010 12:34 PM
Hi Santosh,
Thank you for your quick response!
For the FM : - DB_UPDATE_TABLE.
Suppose i want to modify the
- Table VBKD then should i ftech all fields based on key fields from that table?
- and after changing the required field then i need to pass it to the Function module so that it will modify the table VBKD.
Please correct me if i am wrong....
Thank you for your help so far...
Regards,
Kittu
04-06-2010 11:37 PM
There is ONE THING YOU MUST NEVER DO in SAP software, it's updating directly a standard SAP table!!!
Do you want to get fired?
You MUST use BAPIs, batch input or IDoc, but NEVER update directly.
DB_UPDATE_TABLE should be considered as direct update, so forget it.
These remarks are mostly addressed to santhosh kumar
04-06-2010 12:03 PM
Hope this is update related to sales order. If yes use BAPI "BAPI_SALESORDER_CHANGE"
Regards
Vinod
07-08-2010 6:14 AM