‎2010 Apr 18 5:19 AM
Hi all
I had a problem over selection-screen programming..
Having 2 fields 'Run_ID' and 'Run_date' at selection-screen level, here there is one to many relation i.e. for a Run-id there will be more Run-dates but not vice-verca, i mean to say one Run-date cannot be have multiple Run-ids....
Please suggest me, how to handle this.....
TIA
Regards
Andhari
‎2010 Apr 18 6:11 AM
Hi,
I think you can handle this easily at-selection-screen event.
see how many elements are present in run_id .
data: lw_id type i.
describe table run_id lines lw_id.
if lw_id > 1.
Message 'No more than one run id' type 'E'.
Edited by: Suresh Dorai on Apr 18, 2010 7:12 AM
‎2010 Apr 18 6:11 AM
Hi,
I think you can handle this easily at-selection-screen event.
see how many elements are present in run_id .
data: lw_id type i.
describe table run_id lines lw_id.
if lw_id > 1.
Message 'No more than one run id' type 'E'.
Edited by: Suresh Dorai on Apr 18, 2010 7:12 AM
‎2010 Apr 18 6:46 AM
Suresh,
Thanks for your response.....
Here, i've to check Run ID against the field 'Run_date'...for example today 18.04.2010, if i run this program by giving values '01' for Run_ID and '18.04.2010' for Run_date at selection-screen and it's done for today, but if user again tries to execute this program on same day, it's supposed show error, But with same Run_id, we can run the program on any date except today.........hope you understand...
Pls do needful
‎2010 Apr 18 6:42 AM
Hi Surender ,
Design your selection screen this way :
Make 'Run_id' as a parameter field and keep Run_date as a select-option .
This way you can restrict Run_id to one parameter entry only and for that Run_id , you can have multiple Run_dates .
Regards,
Ranjita
‎2010 Apr 18 6:54 AM
Hi Ranjita
Here, after execution of the program the Run_id and Run_date wil be stored to a Z-table, so by next time execution of the program it shoud check the selection-screen values against the ztable entries to avoid duplicate values of 'Run_ID' for the same date 'Run_date', at the same time we can have the same Run_ID for different dates in the other way this program should run only once per day
Thanks
Andhari
‎2010 Apr 18 7:18 AM
Andhari ,
Then take both the fields run_id and run_date as parameters in the selection screen .
For this you have to code in the 'At selection-screen ' event .
Write the logic this way :
at selection-screen.
select single run_id run_date from the z-table into a workarea
where run_date = sy-datum .
if sy-subrc = 0 .
throw an error message like " This program runs only once iper day " .
endif .
Hope this solves your query .
regards,
Ranjita