Application Development and Automation 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: 
Read only

Bapi_prices_conditions does not delete old condition properly

Former Member
0 Likes
3,474

Hi Guys,

I am using the FM: BAPI_PRICES_CONDITIONS to create / change conditions. The following conditions exist:

KOND_1

valid from: 01.06.2010

Valid to : 30.06.2010

KOND_2

valid from: 01.07.2010

Valid to : 31.12.2010

New condition to be created is

KOND_3

valid from: 06.06.2010

Valid to : 15.07.2010

To do this I have changed the old cond. and created new cond. as follows:

KOND_1

valid from: 01.06.2010

Valid to : 05.06.2010

KOND_2

valid from: 16.07.2010

Valid to : 31.12.2010

New condition to be created is

KOND_3

valid from: 06.06.2010

Valid to : 15.07.2010

This works fine and the entries in DB KONH and KONP are OK. Now the funny thing is that the database A006 still contains the old cond. and there is overlapping. So this give an error if I try ti vew using sap code vk13:

Internal error: T IVAKE F IVAKE_INSERT I MV130F0I

Message no. VK067

This is because of the ovelapp in the valid period in database A006

KOND_1

valid from: 01.06.2010

Valid to : 05.06.2010

KOND_1

valid from: 01.06.2010

Valid to : 30.06.2010

Question.

How can I get this solved using the bapi. OK, the work around would be to make a delete SQL statement where KNUMH = 'old cond Nr.' and then create the new cond. with new valid period accordingly, But I would like to use the bapi.

Please help.

Yours,

Blacky.

Hi Guys,

I am using the FM: BAPI_PRICES_CONDITIONS to create / change conditions. The following conditions exist:

KOND_1

valid from: 01.06.2010

Valid to : 30.06.2010

KOND_2

valid from: 01.07.2010

Valid to : 31.12.2010

New condition to be created is

KOND_3

valid from: 06.06.2010

Valid to : 15.07.2010

To do this I have changed the old cond. and created new cond. as follows:

KOND_1

valid from: 01.06.2010

Valid to : 05.06.2010

KOND_2

valid from: 16.07.2010

Valid to : 31.12.2010

New condition to be created is

KOND_3

valid from: 06.06.2010

Valid to : 15.07.2010

This works fine and the entries in DB KONH and KONP are OK. Now the funny thing is that the database A006 still contains the old cond. and there is overlapping. So this give an error if I try ti vew using sap code vk13:

Internal error: T IVAKE F IVAKE_INSERT I MV130F0I

Message no. VK067

This is because of the ovelapp in the valid period in database A006

KOND_1

valid from: 01.06.2010

Valid to : 05.06.2010

KOND_1

valid from: 01.06.2010

Valid to : 30.06.2010

Question.

How can I get this solved using the bapi. OK, the work around would be to make a delete SQL statement where KNUMH = 'old cond Nr.' and then create the new cond. with new valid period accordingly, But I would like to use the bapi.

Please help.

Yours,

Blacky.

7 REPLIES 7
Read only

former_member191735
Active Contributor
0 Likes
2,172

The conditions will be exist physically even if you delete them but the deletion indicator will be set to the conditions that are marked for deletion.

Are you using commit work (just to remind you) after the BAPI? What is the error you are are getting after BAPI run?

EDITED:

One more, you cannot have 2 active conditions for same period. So you need to deactivate/Delete or change the validity period before the next condition period active.

Edited by: Sampath Kumar on Nov 24, 2009 9:21 AM

Read only

0 Likes
2,172

Hi Sampath,

Yes, I have used commit work and I did not get any error message from bapi. I also change the period of the old condition before craeting the new. This is all OK in KONH and KONP. The problem is that the old condition is not deleted in Database A006.

Any ideas or simple coding?

Ys,

Blacky

Read only

0 Likes
2,172

it will not be deleted from database but the deletion indicator will be set in tables which means they are not accessible for anything.

So make sure that the deletion indicator is set or not in konp.

I think the field is lv**** some i forgot and i dont have system now.

let me know if you dont find it

Read only

0 Likes
2,172

Hi Sampath.

Thanks, Yes I know this and I have set the deletion flag. I have also solved the problem with this logic.

Step 1.

I deleted the old price condition.

Bapi

import parameter

PI_PHYSICAL_DELETION = 'X'

Structure

BAPICONDIT-INDIDELETE = 'X'

Step 2.

With the data structure of the old condition (still within the loop over KONP structure), I changed the valid period accordingly.

Step 3.

I then created a new price condition still using the old price but CHANGED valid period (updated in consideration of the new price condition to be created)

Step 4.

Lastly, I then created new price condition with new period.

This is how It worked.

Thanks and I have given points.

Blacky.

Read only

0 Likes
2,172

Hi SAP-Specialists,

sorry, for warming up this very old thread, but i have sleepless nights about the same problem

HOW CAN I DELETE Entries from table A018??

I tried to fill the structures of the BAPI_PRICES_CONDITIONS with the data from KONH / KONP (COND_NO = old KNUMH) with the operation 003 (delete) as descriped in thread from

Read only

Former Member
2,172

Hi Friends,

Problem solved!

Regards

Read only

0 Likes
2,172

Hi,Timo Stark,

     I have the same problem,Could you tell me how did you solve it?

Regards