2005 Aug 08 11:54 AM
Hi,
I have two questions.
i) How can I delete a record based on some condition in the recordx in the file that is present in the application server?
ii) How can I lock the users whiel one user is accessing the file on the application server?
Thanks in advance.
Suvan
2005 Aug 08 12:28 PM
try to study the material which i have given its mattter 30 minutes.I hope it will help you
2005 Aug 08 12:03 PM
hi,
There is no statement to delete records from an application file. Check the below logic to solve your problem.
(1) Assume FILE1 contains the actual data.
(2) Copy the contents of FILE1 to FILE2.
(3) Delete FILE1 from the application server ( optional)
(4) Read the records from FILE2 except those you want to delete
(5) Write these records into FILE1.
When the file is already opened, SAP triggers an exception of the type CX_SY_FILE_OPEN.
Best Regards,
Vijay
2005 Aug 08 12:12 PM
Hi,
If u want a frequent deletion this approach to delete a record from a file will havee unnecesary copy of records from one file to another and deletion of one file and renaming activities.
Instead what u can do is Add and field del_flag to ur record structure.
If u want to delete the record from a file just mark this del_flag as 'X'.
While processing u can have a loop like
loop at it_XXX where del_flag <> 'X'.
endloop.
This will logically delete the record.
When u r to finish the application at that time only perform this copying / deleting / and renaing activity
Hope this helps.
Cheers,
Nitin
2005 Aug 08 12:17 PM
Hi Vijay,
Thanks for your suggestion. I have a solution of downloading the entire data into internal table and again writing the file with filtered data. But why I am asking is if the contents of the file is very big, then performance will be degraded. Any way thanks for your suggestion.
Do you have any idea of locking the file as in presentation server(if one user opens a file others cant modify the same).
Thanks,
Suvan
2005 Aug 08 12:04 PM
[Removed by the moderator.]
in this book he has explained clearly about your problem.i didn't remember. so sorry for not explaining to u .with in day 7 u will get the topic which u have stated above how to block the buffer etc....
2005 Aug 08 12:28 PM
try to study the material which i have given its mattter 30 minutes.I hope it will help you
2005 Aug 08 3:24 PM
Whay not convert the file to a table? Then you can load and manipulate any record you want. You can also use standard SAP locking functionality.
Rob
2005 Aug 08 4:37 PM
Hi Rob,
I wanted to know that fecility of locking. Could you be more specific please. (Lock objects are not meant for this, if I am not wrong).
2005 Aug 08 4:57 PM
If the file is conveted to a table, use the enqueue/dequeue functions; otherwise, I suppose you could create a dummy table and lock/unlock it when the file is being manipulated.
Rob
2005 Aug 09 5:53 AM