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: 

Error records from S912 ( Purchasing ) table never get deleted.........

Former Member
0 Kudos

Hello,

We loaded Purchase Orders using BAPI_PO_CREATE1. There were a couple of records with blank Statistical Delivery date, had used a Conv routine to convert the date to internal format, so value <b>/ /</b> was passed to the BAPI. The BAPI created the PO's but with the Statistical Delivery date as <b>/ /</b> .

Correspondingly records were created in table S912 with SPMON field as <b>/ /</b> and other relevant PO details like Material/Plant/Material Grp/Vendor/Quantity etc. Now we need to delete the records with bad S912-SPMON data.

<b><i>Our Case :</i></b>

If we change the faulty dates or delete the PO’s; new records will be created with correct SPMON after changing and purchasing details like Qty, Invoiced Qty for existing entries are blanked in case of delete, but the existing records with bad SPMON will remain in the table.

It seems that SAP never tried to do any error handling, before any data is updated on S912 table or while <b>/ /</b> was passed to the BAPI ( I totally agree that it was a developer mistake in first place to pass <b>/ /</b>) ..

Has anybody encountered this issue before or has a solution for this..

Thanks

Arun

4 REPLIES 4

former_member404244
Active Contributor
0 Kudos

hI,

U can achieve the functionality either by modifying the dbtable or by using BDC..

Do a BDC in change mode and record the SMON field.Now pass the values to it..FIRST select the data from the table with the two BAD SMON fields and then modify the internal table with ur values and pass to BDC.it will update ur db table and also the transaction...I hope u got my point..

Reward if helpful.

Regards,

Nagaraj

0 Kudos

Hello,

SAP never recommends modifying Standard SAP tables..

ME21N ( Purchasing) is a enjoy transaction; BDC cannot be used moreover SPMON field is not present in the transaction..

Arun

0 Kudos

hI,

Yes you are correct its not recomendable to go for modify for SAP standard tables,in ur case its only two records,thats why i suggested.For enjoy transactions we can't USE BDC ,becoz its not compatible..Then u have to for BAPI..another method is if u know the table and field,u can edit the table and can change the value of SMON field.I hopu u know this..after u dispaly the record type /H in command box and then press on edit button,Now in the CODE the SY-UCOMM IS 'EDIT',whenit reahes thre press F8 and the entry will be in edit mode,change and save..But to be frank we should never do like this.....

Regards,

Nagaraj

0 Kudos

Hi Nagarj,

S912-SPMON is a key field, it cannot be changed using the debugging and code = 'EDIT'..

Arun