07-21-2009 7:37 AM
Hi expert.
i have a question about select into syntax.
my problem is , i write zreport use data from mseg , mkpf table . i know if any transaction occur with these table in processing report , i never get a correct report. so, my solution is use "select * into table" retrieve data that meet with my condition into my other create table ( like : wa_mseg). and use data in this table only.
***declaration***
DATA: wa_mseg TYPE STANDARD TABLE OF mseg WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 100,
i_mseg TYPE mseg.
***select into***
select * into table wa_mseg from mseg where X = Y A = C.
***use***
loop at wa_mseg into i_mseg where X = Y
........
......
........
.....
but result still incorrect.
so i think , is possible that transaction occur with mseg table has effect with data i retreive into my table?
anyone please tell me?
Best Regards
Kittisak
Edited by: Kittisak B on Jul 21, 2009 8:38 AM
07-21-2009 8:11 AM
if there has long interval within retrieve data from mseg to end the report,
i think there has not good sultion to solve your issue.
07-21-2009 1:29 PM
Hello,
Once you select data from some table into internal table then it has nothing to do with what changes happens in
database table.
In your case may be you can put some more filter to make the data more specific so database response time will be less.
By the way what is the issue you are facing in the selected data?
Thanks,
Augustin.
07-22-2009 3:02 AM
By the way what is the issue you are facing in the selected data?
because in this report, i'm select data from mbew and mard table into my create table for calculate BF Qty. of Each material in each month. but result change every time when run this report. some material qty is correct , some not .
07-26-2009 4:31 PM
hi..
u proper clearing work area in loop endloop process??
regards,
Praveen
07-21-2009 2:32 PM
please read more in the helpportal or wikipedia about transactions, consistent data, locks etc.
You should always read the committed data at the point t when you start your program, and not at the point t + epsilon.
Siiegfried
07-26-2009 9:34 PM
what do you mean with CORECT,
either you are not able to do correct calculations
or you compare it with something, what is it waht you use for comparison?
07-27-2009 4:29 AM
u proper clearing work area in loop endloop process??
yes , i do.
what do you mean with CORECT,
either you are not able to do correct calculations
or you compare it with something, what is it waht you use for comparison?
i have a hard copy of material qty. result from checking stock in end of month to compare with report.
Edited by: Kittisak B on Jul 27, 2009 5:30 AM
Edited by: Kittisak B on Jul 27, 2009 5:30 AM
07-27-2009 10:18 AM
It does not help much, if you say the quantity if incorrect, you must find out, what is different.
Is the hardcopy created at a different time, or whatever. What is different, then you will find
out the reason.
The reason should not be the statement, but the way how it is used.
Siegfried
07-27-2009 11:54 AM
SAP ERP is based on real time data integration, the moment somebody posts a goods movement you have updated stock levels, and each time you run your program with data selections you might have a different result.
If you must work with fixed snapshots, use a BI/BW system or select by past posting or even better CPU dates, like MKPF-CPUDT.
SELECT * INTO TABLE ... has nothing to do with this.
Thomas
08-24-2009 10:54 PM
Hi Kittisak B ,
Try with SELECT FOR UPDATE * to lock the records that will be handled and prevent updates on the tables while running the report.
Additionally:
- Check the internal table structure because when using "select * into table" the internal table must be identical to the database table, all fields must exist in the same order, otherwise it will store data in fields that do not match and this could change the result.
- Do "CLEAR" and "REFRESH" of the internal table and the work area before populate.
Hope this information is help to you.
Regards,
José
08-25-2009 8:26 AM
DATA:
lt_mseg TYPE SORT TABLE OF mseg
WITH NON-UNIQUE KEY X,
wa_mseg TYPE mseg.
***select into***
select * into table lt_mseg from mseg where X = Y A = C.
***use***
loop at lt_mseg into wa_mseg
where X = Y
Please look again into the ABAP documentation, it is much better than you think
+ wa_ is a structure and not a table, you should not use widely used naming conventions in a different way,
+ the table is lt_
+ together with LOOP ... WHERE ... you should not use a standard table but a SORTED TABLE
+ and a default key is for lazy guys .... who are highly fault-tolerant, not really recommended
Siegfried