‎2008 Jun 23 12:23 PM
Hi experts,
I have a selection screen where I need to specify the upload file name which has the input details and a check box which I check for the file validation. After this the program is executed. If the validation is successful a message is displayed that the file validation is successful. After this when the program is executed again then the file is uploaded to the database.
This all is working fine.
However I also need to run this program in background. This should be done after the file validation is complete. But the problem is that after file validation the option of background button is gone. I need the submit button to be enabled after file validation.
I tried using SUMBIT command but that its not working. Please help me out to solve this problem.
Thanks in advance,
Abhishek
‎2008 Jun 23 12:35 PM
Hi,
After file validation why donot u ask the user to run the prog. in background using FM POPUP_TO_CONFIRM? If the answer is yes then u can upload the file in background as shown below:
data: jobname like tbtcjob-jobname value
' TRANSFER TRANSLATION'.
data: jobcount like tbtcjob-jobcount,
host like msxxlist-host.
data: begin of starttime.
include structure tbtcstrt.
data: end of starttime.
data: starttimeimmediate like btch0000-char1.
Job open
call function 'JOB_OPEN'
exporting
delanfrep = ' '
jobgroup = ' '
jobname = jobname
sdlstrtdt = sy-datum
sdlstrttm = sy-uzeit
importing
jobcount = jobcount
exceptions
cant_create_job = 01
invalid_job_data = 02
jobname_missing = 03.
if sy-subrc ne 0.
"error processing
endif.
Insert process into job
SUBMIT zreport and return
with p_param1 = 'value'
with p_param2 = 'value'
user sy-uname
via job jobname
number jobcount.
if sy-subrc > 0.
"error processing
endif.
Close job
starttime-sdlstrtdt = sy-datum + 1.
starttime-sdlstrttm = '220000'.
call function 'JOB_CLOSE'
exporting
event_id = starttime-eventid
event_param = starttime-eventparm
event_periodic = starttime-periodic
jobcount = jobcount
jobname = jobname
laststrtdt = starttime-laststrtdt
laststrttm = starttime-laststrttm
prddays = 1
prdhours = 0
prdmins = 0
prdmonths = 0
prdweeks = 0
sdlstrtdt = starttime-sdlstrtdt
sdlstrttm = starttime-sdlstrttm
strtimmed = starttimeimmediate
targetsystem = host
exceptions
cant_start_immediate = 01
invalid_startdate = 02
jobname_missing = 03
job_close_failed = 04
job_nosteps = 05
job_notex = 06
lock_failed = 07
others = 99.
if sy-subrc eq 0.
"error processing
endif.
‎2008 Jun 23 12:31 PM
Hi Abhishek,
Try the below options.
Check the program is running in background or foreground.
at selection-screen.
if sy-batch = space.
do your validation.
endif.
in this case if the validation completed, execute the program directly in background.
hope it will helpful for your requiement.
Regards,
SB
‎2008 Jun 23 12:32 PM
you have to pass values of selection screen using submit command
‎2008 Jun 23 12:32 PM
Hi,
i think you have not activated the submit icon in the layout or you may forget to write code for it. just chk once. cool
regards
karthik
‎2008 Jun 23 12:35 PM
Hi,
You could do it this way.
Write another short program using JOB_OPEN,JOB_SUBMIT and JOB_CLOSE FM's.
After the file validation is over, submit the new program from the current one passing the report id.The new program will then be executed to schedule the current program in background.
Hope it helps,
Thanks,
Sandeep.
‎2008 Jun 23 12:35 PM
Hi,
After file validation why donot u ask the user to run the prog. in background using FM POPUP_TO_CONFIRM? If the answer is yes then u can upload the file in background as shown below:
data: jobname like tbtcjob-jobname value
' TRANSFER TRANSLATION'.
data: jobcount like tbtcjob-jobcount,
host like msxxlist-host.
data: begin of starttime.
include structure tbtcstrt.
data: end of starttime.
data: starttimeimmediate like btch0000-char1.
Job open
call function 'JOB_OPEN'
exporting
delanfrep = ' '
jobgroup = ' '
jobname = jobname
sdlstrtdt = sy-datum
sdlstrttm = sy-uzeit
importing
jobcount = jobcount
exceptions
cant_create_job = 01
invalid_job_data = 02
jobname_missing = 03.
if sy-subrc ne 0.
"error processing
endif.
Insert process into job
SUBMIT zreport and return
with p_param1 = 'value'
with p_param2 = 'value'
user sy-uname
via job jobname
number jobcount.
if sy-subrc > 0.
"error processing
endif.
Close job
starttime-sdlstrtdt = sy-datum + 1.
starttime-sdlstrttm = '220000'.
call function 'JOB_CLOSE'
exporting
event_id = starttime-eventid
event_param = starttime-eventparm
event_periodic = starttime-periodic
jobcount = jobcount
jobname = jobname
laststrtdt = starttime-laststrtdt
laststrttm = starttime-laststrttm
prddays = 1
prdhours = 0
prdmins = 0
prdmonths = 0
prdweeks = 0
sdlstrtdt = starttime-sdlstrtdt
sdlstrttm = starttime-sdlstrttm
strtimmed = starttimeimmediate
targetsystem = host
exceptions
cant_start_immediate = 01
invalid_startdate = 02
jobname_missing = 03
job_close_failed = 04
job_nosteps = 05
job_notex = 06
lock_failed = 07
others = 99.
if sy-subrc eq 0.
"error processing
endif.