10-10-2008 5:47 PM
Hi Experts,
i ve developd a HR-ABAP report in that Some part of code will Mon-Fri, Excluding Public holidays and sat & sundays...( i.e no public holidays and no sat & sundays)
and some part of should Run on 1st of everymonth.... but 2 parts of code should be in same report..
How can set the logic to run the report respective times....
Thanks in Advance....
sudeer.
10-10-2008 6:09 PM
Hi,
Try this way,
Give a PARAMETER with date field, default that value to sy-datum.
1 Radiobuttons along with PUSHBUTTONS.
In INITILIAZATION event default the date field to sy-datum.
In AT SELECTION-SCREEN ON FIELD date.
get the Factory calendar ( you have many FMs which can give you working days of a company).
Compare the day
According to the day make corresponding RADIOBUTTON active or inactive.
If holiday or Sat or Sunday stop processing.
Do the coding for each RADIOBUTTON to execute corresponding code only in START-OF-SELECTION.
1 for Mon - Fri
2 for 1st of every month.
Now schedule your program to run daily.
Regards
Bala Krishna
10-10-2008 6:02 PM
I suppose you could add radio buttons to the selection screen for each day of the week.
Create variants for each one and schedule a background job setting the period value to weekly.
In your program use IF statements to determine which block of code to run.
10-10-2008 6:05 PM
If you maintain Holiday Calendars in System, this can be achieved through Job Scheduling SM36. Ask your basis guy if this is possible.
-Aman
10-10-2008 6:09 PM
Hi,
Try this way,
Give a PARAMETER with date field, default that value to sy-datum.
1 Radiobuttons along with PUSHBUTTONS.
In INITILIAZATION event default the date field to sy-datum.
In AT SELECTION-SCREEN ON FIELD date.
get the Factory calendar ( you have many FMs which can give you working days of a company).
Compare the day
According to the day make corresponding RADIOBUTTON active or inactive.
If holiday or Sat or Sunday stop processing.
Do the coding for each RADIOBUTTON to execute corresponding code only in START-OF-SELECTION.
1 for Mon - Fri
2 for 1st of every month.
Now schedule your program to run daily.
Regards
Bala Krishna
10-10-2008 6:31 PM
Hello Bala Krishna, Thank u for ur replay..i got some idia on ur info..
but am not sure that howmany radio buttons is required.. how can i code for them..
could u give some more idia on that for creating selection screen...
in my code i ve 2 Perform Statements.. 1 should execute for M-Fri and 2nd should execute on 1st everymonth.
Thanks in Advance,
sudeer.
10-10-2008 6:59 PM
Hi,
Instead of radio buttons u can use check box also,
TABLES : sscrfields.
PARAMETERS : date type sy-datum.
PARAMETERS check AS CHECKBOX USER-COMMAND ABCD.
PARAMETERS check1 AS CHECKBOX USER-COMMAND DCBA.
INITIALIZATION.
date = sy-datum.
AT SELECTION-SCREEN ON date.
condition
START-OF-SELECTION.
CASE SY-UCOMM.
WHEN 'ABCD'.
PERFORM 1
WHEN 'DCBA'
PERFORM 2
ENDCASE.
Not sure, just try like this you might get any idea.
Regards
Bala Krishna.
10-10-2008 6:13 PM
10-10-2008 7:53 PM
you can code this but need some good expertise on fm's , date handling techniques and subroutine call coding.
1.
to make the code run only on 1st of every month
capture the rundate of ur prog .. take value of sy-datum
ex.. 01.xx.yyyy
or date std will be yyyymmdd so check for dd = 01 ..
so per logic first two chars show that its first of any month in any year ..
if yes
execute the logic for the first of every month ..
endif.
2.
where the code needs to be run on mon-fri and not on public holidays / sun / sat ..
first fetch the day based on date .. like mon or tue or wed .. except sat and sun..
second check whether if m-t-w-th-fr if any of them is a holiday or not
u need to check the date in the calender list like tholi thoc and .. to check whether that is a holiday or not ..
coming to sat and sundays .. u need to check the day for date using function modules and build the logic ...
br,
vijay..