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: 

Update multiple records of WCOCOH table

0 Kudos
1,327

Hi folks,

Is there any way to update multiple records of WCOCOH table in single go through ABAP code? BAPI_CONDITION_CONTRACT_CHANGE takes contract number as input and updates only single record.

Thanks,

Raj

9 REPLIES 9

yogananda
Product and Topic Expert
Product and Topic Expert
0 Kudos
1,181

pankaj_p

Yes, there is a way to update multiple records of WCOCOH table through ABAP code. You can use UPDATE statement to update multiple rows 1.

Here is an example of how you can use UPDATE statement to update multiple rows:

UPDATE WCOCOH SET field1 = value1 WHERE condition;

You can replace field1 with the name of the field you want to update and value1 with the new value you want to set 1. You can also replace condition with the condition that must be met for the rows to be updated 1.

If this answer satisfies your question, kindly accept it and could you close the thread. Have a great day! 🙂

0 Kudos
1,181

Hi Yogananda,

Thank you for the answer. Normally for standard sap tables we use bapi to create, delete or update records. So using update query directly on standard is recommended?

Former Member
1,181

Hi Raj P, no using UPDATE keyword directly on standard table is not recommended... Prefer BAPI. And for your question I think you have to loop on the BAPI and update records one by one.

1,181

WCOCOH is the condition contract table. Tables like that must not be updated directly!

VXLozano
Active Contributor
1,181

I'm not sorry this time. I cannot understand how a SAP employee can give that sort of answer. To mess with a standard SAP table having alternatives (like the LOOP used by the OP) is not just dangerous, it's not just not recommended, it's against the basic foundations of SAP workbench. Or it should be.

The answer is "right", but to give that answer is not "correct", so I downvoted it.

I will, maybe, de-downvote it if the answer begins with a neon sign advicing AGAINST itself.

DominikTylczyn
Active Contributor
1,181

Why don't you just call BAPI_CONDITION_CONTRACT_CHANGE several times to update all the contracts that you need?

1,181

Hi Dominik, I am calling this Bapi in loop and updating data of WCOCOH table. But I just wanted to know if there is any way to update multiple records at a time. Thanks

DominikTylczyn
Active Contributor
1,181

pankaj_p I don't think there is a function to update several contracts in one go. It would be very difficult to keep the update transactional.

0 Kudos
1,181

Hi all, Thank you for your replies. I have created parallel processing approach for this requirement. Closing this now.