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: 

deleting a record in LFA1

Former Member
0 Kudos

Hi all,

I'm a newbie in ABAP and I'm working on open sql.

I've tried to write a simple program about deleting a record in a table: LFA1

After execution I was surprised about result: it works!

But LFA1 has references on LFB1, LFBK, and so I have an inconsistency situation of records without reference on LFA1

I was ready for a warning or an error message but... nothing

Could you help me to understand?

5 REPLIES 5

Former Member
0 Kudos

But you do understand now.

You'll never do it again.

Actually, it's worse than you have said. Even if you went through the transactions and marked a vendor for deletion, the system would not actually do the delete at that time. It is only when you do archiving that vendors will be deleted. And then the system will do some further checking to ensure that there are no outstanding invoices or POs.

I'm afraid that there is no straightforward way to recover the deleted entry other than doing a direct table insert. But you should leave this to someone who knows what trouble that doing this might cause as well.

Where did this happen - test or development?

Rob

Edited by: Rob Burbank on Sep 10, 2010 6:03 PM

0 Kudos

Rob:

Fortunately I'm working on a "tutorial" tier, nothing important on it about data. And I choose a useless vendor for deleting.

Marking the vendor for deletion through FK01 or XK01 is not possible in my system, no authorization for that.

Monday I'll try to look for all tables where that record still exists and I'll delete them. No invoices or PO exsisting.

Now I have new doubts:

Did I phisically deleted that record on LFA1 or only deleted that on a logic level?

Edited by: pilloso on Sep 11, 2010 11:36 PM

Edited by: pilloso on Sep 11, 2010 11:37 PM

Edited by: pilloso on Sep 12, 2010 11:35 PM

kesavadas_thekkillath
Active Contributor
0 Kudos

Hi ,

There is a method maintain_bapi of class vmd_ei_api.

Use this method to do the update/Create operations to the vendor master . Instead of delting it directly sap sets a deltion indicator LVORM to true in each tables.

Donot do it directly as you did . Check the consequences and problems that Rob as mentioned.

0 Kudos

Keshav:

I'm a complete beginner about abap, I dont know bapi. My main interest now is to understand how to do right things in sap development and I have to understand how system works about some problems.

I'm working on ecc6 and db is oracle. I'm also a sql programmer and every time I tried to delete a record with ref with TOAD or similar sw directly on db, sw warns and stops me due to avoid tragical conseguences.

Now how is it possible such a deletion?

I executed an abap program with open sql inside, work process translated in native sql, it gives that to oracle... then? I dont think oracle is happy about my operation. No warning message? Why does oracle make it without a moan?

Edited by: pilloso on Sep 11, 2010 11:52 PM

0 Kudos

Deleting rows from any application table is forbidden - not technically though. You should use standard functionality. You may call a BAPI (this is a function module) called BAPI_VENDOR_DELETE but this calls merely transaction XK06. This will mark your vendor for deletion, however it will perform authorisation checks.

There is a way to do it, though. But you are probably not experienced enough, I think.

The solution:

1. Record a transaction XK06 up to the point of saving using SHDB.

2. Write a function module which would call transaction XK06 with the recorded content:

statement CALL TRANSACTION 'XK06' USING bdc_data > bdc_data contains the recording from SHDB.

3. Call this function module with DESTINATION addition and use WORKFLOW_LOCAL_xxx RFC destination. This

destination should exist in the system. xxx is a client number. It uses WF-BATCH system user which may have super rights and will be able to execute XK06 but you need to check it.

Regards,