2012 Mar 29 3:50 PM
Hi Experts,
I am working on a custom report and we have acount number field on selecton screen.Initially we had hardcoded the range on selection screen as :
S_RACCT-LOW = '0050000000'.
S_RACCT-SIGN = 'E'.
S_RACCT-OPTION = 'LT'.
APPEND S_RACCT.
S_RACCT-LOW = '0059999999'.
S_RACCT-SIGN = 'E'.
S_RACCT-OPTION = 'GT'.
APPEND S_RACCT.
So when we select on above range we get data which is in range 0050000000 and 0059999999.
Now we are removing this hardcoding and instead selecting account no. from a table ITAB so i changed it like this:
DELETE ITAB WHERE accountno. NOT IN S_RACCT.
S_RACCT-SIGN = 'I'.
S_RACCT-OPTION = 'EQ'.
S_RACCT-HIGH = ''.
Loop at itab
S_RACCT-low = itab-field
append S_RACCT.
But the probelm is even if user gives account no on selection screen which doesnt belong to data in itab i am getting incorrect data.
Any pointers on this ? How should i go about it so that only 5 series account no. are selected.
2012 Mar 29 4:03 PM
At this risk of answering a post that will be locked for basic question....
Please read the available and well done ABAP help (F1) on the subject. Doing so will often result in the answer you need and will result in no need to post a basic question.
2012 Mar 29 4:04 PM
Which event is used to fill internal table ITAB ? I hope you are filling ITAB somewhere
and under which event is this code written ? It Should be in Initilisation !
2012 Mar 29 4:07 PM
Hi,
You can add validation for your selection screen. i.e. you can check if S_RACCT-low+0(3) EQ 5 if not you can throw an error message thus enforcing the user to enter your desired 5 number series
2012 Mar 29 4:12 PM
But if the user gives in selection screen something like a/c no NE 12345
that is also valid right
2012 Mar 29 4:17 PM
no that wont be valid,
on the event AT-SELECTION SCREEN.
you put your condition/check , this will ensure that the user enters what you expect him to enter on the selection screen and if user does not enter you directly throw an error message.
2012 Mar 29 6:02 PM
hi,
It looks that you are not clearing Table S_RACCT. before appending entery from ITAB.
one more thing in you select statement which table you are using S_racct or Itab.
Raj
2012 Mar 29 7:06 PM
BM .
1)It seems that code which you are trying to do may not be stable in future. Not select option has a memory limit when used in select statement. For our system it starts giving dump if a select option has around 10k lines .
2)where do you get the itab filled? Does it has all the 5* account number? if yes then simply put the validation at selection screen like the below. I am assuming the ITAB is getting filled in the INITIALIZATION event and
AT SELECTION-SCREEN ON S_RACCT.
L_ITAB[] = ITAB[]
DELETE L_ITAB WHERE FIELD NE S_RACCT.
IF L_ITAB IS INITIAL.
MESSAGE EXYZ. " INVALID ACCOUNT NUMBER.
ENDIF.
* FINALY GET THE FINAL ITAB in START-OF-SELECTION and use it in select
START-OF-SELECTION.
DELETE ITAB WHERE FIELD NE S_RACCT. " nOW USE ITAB in further selection