06-09-2005 1:09 PM
Hello all,
i am working on creating PO's by reading data from a text file. I need to implement fail safe logic in it, which is to make sure this program uploads all the records in the text file successfully. For example, i have 1000 records in my text file and while running the upload program if the program times out while creating the 500th PO or if SAP is down at that time, then we have 499 PO's created and 501 yet to be created. But if we run the same program again, we will generate duplicate PO's for 499 again. I want to avoid this kind of problem.
How do i implement this idea?
Kindly guide me on this.
Thanks.
06-09-2005 4:21 PM
You can use BAPI_PO_CREATE to create the PO and then choose one of the two options.
1. Commit work if all the PO's are successfully created or else Rollback work.
2. Commit successfull POs one by one and write / download an error file ( in same structure as original file but with only error records ) for error cases.
Further you correct the generated error file and process it again ( not the original file ).
Thanks,
Ram
06-09-2005 1:22 PM
06-09-2005 4:21 PM
You can use BAPI_PO_CREATE to create the PO and then choose one of the two options.
1. Commit work if all the PO's are successfully created or else Rollback work.
2. Commit successfull POs one by one and write / download an error file ( in same structure as original file but with only error records ) for error cases.
Further you correct the generated error file and process it again ( not the original file ).
Thanks,
Ram
06-10-2005 7:52 PM
Hello,
Thanks for the information.
I am doing commit work as and when the PO's are getting created.
And i am ok if the Data has error the user will change the error and do me21n manually as i will report out what all the records that has error with the error messages.
My concern is, what should i do when my program times out or sap is down or power goes off...etc while doing the upload. for example if i have to upload 100 records and while uploding the 50th record , something goes wrong so i need to restart the upload again, but at this time i will be creating duplicate POs , any idea on this.
Thanks.
Karan
06-10-2005 8:05 PM
Ok ..
Then I would suggest you use Application Log to keep the success and error messages of PO processing.
You can check trsnaction SLG0 and create your own application log object.
Then you need to use FMs BAL_LOG_* to crate and add messages to it.
This way you will have a facility to check as which of your records are converted to PO for a run.
In case SAP gets down in between , still you can find the details using Xn SLG1 and then accordingly remove the records from your file which are already converted to PO.
Thanks,
Ram