Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem with SUBMIT in Background

0 Likes
571

I have requirement to update a data base table in background job. As per my requirement i cannot use update task. to achieve this i have created one report and in that report i wrote code to update my table. in foreground program i am submitting background job program. If i will execute background submitted program individually it's working fine but if i will submit program via background same record appending two times in data base table. i wrote the code like below. Please help me on this issue

** Open job without dialog
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = lv_jobname
IMPORTING
jobcount = lv_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc IS NOT INITIAL.
RAISE job_not_scheduled.

ELSE.

*-- Submit the program
SUBMIT /zupdate/c_pp_pplist_snapshot USER lv_uname
VIA JOB lv_jobname NUMBER lv_jobcount
AND RETURN.

ENDIF.

*-- Job close.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = lv_jobcount
jobname = lv_jobname
strtimmed = abap_true
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
IF sy-subrc <> 0.
RAISE job_not_scheduled.
ENDIF.

1 REPLY 1
Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
443

Use some logging mechanism, e.g. logpoints, to see what happens.

You even might place some temporary WRITE statements around the update and check the list output in the job overview.