‎2010 Aug 25 12:06 PM
Hi All,
I am facing a problem in splitting the Select options for my screen. What I have to do is I am expecting the User to enter around 5000 records in the Select Options. I have to use 2000 records at a time for processing, which means three set of records of 2000, 2000 and 500.
Can you please tell me how can this be achieved??
‎2010 Aug 25 12:13 PM
What do you mean by split? If you have to use 2000 records at a time, will the user enter those by copy and paste function in select-options additional screen? Or, are you getting all rows that match a particular selection criteria from a db tabe? If so, find the documentation (SAP HELP) and add
package sizeto your SELECT statement. This is simple and you can find MANY posts on this subject in the forums. Although I'm not a moderator (others give generously of their time for that), I would advise you to read forum posting rules and STF (Search the forums), as well as make use of your F1 help on ABAP Keywords in your editor.
‎2010 Aug 25 12:51 PM
Yes I am expecting the user to paste a total of around 5000 records. See what is actually happening is when the user enters 2000 records for the select option, the program seems to be working fine. But when the number of records increases to around 5000, it starts giving a dump.
One reason for this may be that the size limit for the SELECT statement that I am using may have reached when the number was 2000. As the number increases the database is unable to handle the size. That is why I wanted to use 2000 records at a time.
‎2010 Aug 25 1:10 PM
Hi,
If all the values are pasted in low value of the select options , then loop at this select option and populate an
internal table with these values.
Now write the select on the table you want using for all entries on the above table.
say s_pernr is your select option.
loop at s_pernr.
itab-pernr = s_pernr-low.
append itab.
endloop.
if not itab[] is initial.
select f1 f2 .... from <table> into <int_table>
for all entries in itab
where pernr = itab-pernr.
endif.
Regards,
Srini.
‎2010 Aug 26 6:56 AM
If you are sure that there are only single values in the select-options (cf. [SELECT_OPTIONS_RESTRICT|http://wiki.sdn.sap.com/wiki/display/Snippets/RestrictSelectOptions]) you can use a FOR ALL ENTRIES
SELECT (fields) INTO TABLE <itab> FROM <table>
FOR ALL ENTRIES IN <select_options>
WHERE <keyfield> EQ <select_options>-low.You don' need to build another internal table.
NB: When you got a dump from SQL in ST22, call transaction SM21, the system log may contain a more comprehensive error text from the SQL database.
Regards,
Raymond
‎2010 Aug 25 12:32 PM
Are you sure that even reducing the SELECT-OPTION to package of 2000 will be enough, in some database the system will raise an error related to a too large SQL statement.
Splitting an internal table (as SELECT-OPTIONS are) is very easy. (see bellow)
But be aware that some records may be exclusions, like :
- SIGN = 'E' and OPTION is one of the positive operator like EQ, BT or CP
- SIGN = 'I' and OPTION is one of the negative operator (every operator except the three previous)
Those records must be in every package of selection
so loop at select-options
- put the exclusion in a first internal table
loop once again at select-options excluding the records of the previous loop
- append to a temporary internal table
- when number of record equal maximal number allowed for a SQL SELECT minus the number of record in the first internal table, execute the SELECT, clear the temporary internal table
To bypass this problem
- don't use those record to build the partial select-options but delete records after select from database
- You could(should) consider restricting select-options allowed options ([SELECT_OPTIONS_RESTRICT|http://wiki.sdn.sap.com/wiki/display/Snippets/RestrictSelectOptions]) so you wont have to execute this and only have to split an internal table with statement like [APPEND|http://help.sap.com/abapdocu_70/en/ABAPAPPEND.htm] [LINES OF jtab [FROM idx1] [TO idx2] |http://help.sap.com/abapdocu_70/en/ABAPAPPEND_LINESPEC.htm#&ABAP_ALTERNATIVE_3@3@]
Regards,
Raymond