Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Modify a field in the standard table using BAPI

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hope this is update related to sales order. If yes use BAPI "BAPI_SALESORDER_CHANGE"

Regards

Vinod

5 REPLIES 5

Former Member
0 Kudos

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.

0 Kudos

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

0 Kudos

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

Former Member
0 Kudos

Hope this is update related to sales order. If yes use BAPI "BAPI_SALESORDER_CHANGE"

Regards

Vinod

Former Member
0 Kudos

Hi,

Thank you for your quick response!

Regards,

Kittu