2007 Sep 03 12:45 PM
Hello,
Im looking for a way to define the
entry point
at theincremental read
using select clause like:Select * from {table} up to {m} rows
where key-field1 = field1
and key-field2 = field2
and key-fieldn = fieldn.I will read rows, after next rows and so on.
How can I determine the correct where-condition to do realize an
incremental read
?Thanks and best regards,
Kurt.
Hello,
Im looking for a way to define the
entry point
at theincremental read
using select clause like:Select * from {table} up to {m} rows
where key-field1 = field1
and key-field2 = field2
and key-fieldn = fieldn.I will read rows, after next rows and so on.
How can I determine the correct where-condition to do realize an
incremental read
?Thanks and best regards,
Kurt.
2007 Sep 03 12:47 PM
HI,
Why dont u use PACKAGE SIZE in the select query?
Thanks and Best Regards,
Vikas Bittera.
2007 Sep 03 1:08 PM
Hello Vikas Bittera,
Thank you for your reply.
Thats clear; I can use <b>package size</b> as well as <b>up to n rows</b>, but Im looking for the right way how to formulate the where-condition; if I have only one key, so I just can use <b>where key > key</b>. But if I have more key elements so I need a (complex) logical expression.
Do you have any idea?
Thanks and best regards,
Kurt
2007 Sep 03 1:12 PM
Hi,
you need not to do so, as the records will come sorted by the primary key when u will use package size..
Thanks and Best Regards,
Vikas Bittera.
2007 Sep 03 1:13 PM
2007 Sep 03 1:18 PM
Hi,
SELECT vbeln erdat
FROM vbak
INTO TABLE li_vbak PACKAGE SIZE 50.
SELECT posnr matnr meins
FROM vbap
INTO TABLE li_vbap
FOR ALL ENTRIES IN li_vbak
WHERE vbeln = li_vbak-vbeln.
IF sy-subrc = 0.
Now you have the two internal tables li_vbak and li_vbap filled
with data.
Do something with the data - remember to reinitialize internal
tables
ENDIF.
ENDSELECT.
Thanks and Best Regards,
Vikas Bittera.
2007 Sep 03 1:26 PM
Unfortunately I cannot use <b>select endselect</b>, because I need a set of data to process IDOCs and posting data, I guess I cannot perform commit while select endselect.
Is there another method to realize this?
Thanks and best regards,
Kurt
2007 Sep 03 2:10 PM
Hi,
You are absolutely correct!! in this case you cannot use package size..
you can do one thing... take one of the main key fields, and fetch the data for a range of this key field at a time and process...
suppose that i want to process the data for 1 to 100 comany codes, i will process 10 company codes at a time..
Thanks and Best Regards,
Vikas Bittera.
2007 Sep 03 1:35 PM
If you use Packet size, you do not need to specify number of rows or special keys - just give the full select and it returns a new packet of record each time it loops between the select and endselect statements.
Andrew
2007 Sep 03 1:43 PM
You should define a CURSOR and then read the data package via this cursor.
* Declare cursor
DATA s_cursor TYPE cursor.
* Open Cursor (select)
OPEN CURSOR WITH HOLD s_cursor FOR
Select * from {table}
where key-field1 = field1
and key-field2 = field2
and key-fieldn = fieldn.
* Then Fetch the data
DO.
FETCH NEXT CURSOR s_cursor
INTO TABLE t_data
PACKAGE SIZE package_size.
IF SY-SUBRC <> 0. " No more data
EXIT.
ELSE.
" Work with the data read
ENDIF.
ENDDO.
* When you have read all the data, close the cursor
CLOSE CURSOR s_cursor.Regards
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |