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

submit job specific time ?

Former Member
0 Likes
3,812

Dear All,

I have a requirement of submitting the job at specific time. There is a Ztransaction whose recording i had obtained through sm35 and now i need to create a job for a mass change of this recording and that should be done only in the evening.

my doubt is within the abap program once i had created the internal table with all the recording values how can i use the filled internal table to create and execute the job. there is a following code available on internet to submit the job. but where i can specify the internal table prepared with values.

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.

Dear All,

I have a requirement of submitting the job at specific time. There is a Ztransaction whose recording i had obtained through sm35 and now i need to create a job for a mass change of this recording and that should be done only in the evening.

my doubt is within the abap program once i had created the internal table with all the recording values how can i use the filled internal table to create and execute the job. there is a following code available on internet to submit the job. but where i can specify the internal table prepared with values.

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.

18 REPLIES 18
Read only

Dasig
Participant
0 Likes
3,176

Hello,

can you give more details plz?

Are you trying to submit a report o do  "bdc" for your registred  Ztransaction?

These are 2 completely different things!

Read only

Former Member
0 Likes
3,176

Hi saad,

i am tryig to create a program for the user using which the user can do some changes to the material. This change we normally do with a ztransaction. user have to only upload the excel file with material numbers and the new value that is to be changed of a particular field.

earlier i thgt to do the recording and create a job in sm36 and from the program creating a session and somehow executing the session using event through the program. but there is no option to specify the session execution time.

so what you suggest, how can i achieve that .

Thanks

Read only

Former Member
0 Likes
3,176

Follow the steps below -

1 - Create a job using FM JOB_OPEN

 

CALL FUNCTION  'JOB_OPEN'
EXPORTING
jobname
= jobname
IMPORTING
jobcount
= jobnumber
EXCEPTIONS
cant_create_job
= 1
invalid_job_data
= 2
jobname_missing
= 3
OTHERS = 4.

2 - Submit the Program

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.

3 - Finally close the job

 

CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount
= jobnumber
jobname
= jobname
strtimmed
= 'X'
IMPORTING
job_was_released
= job_released
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

The Steps above should use the internal table you created / populated in the program used in Step 2.

Cheers!

Abhinab

.

Read only

0 Likes
3,176

Hi Abhinab,

thats what the confusion is. where you had specified the internal table that contains the dynpro and field values while submitting ?

Thanks

Read only

0 Likes
3,176

You don't explicitly specify the internal tables while creating or executing a job.

You create a job using program name and variant, the internal tables in the program are populated according to the variant maintained in the job.

So in your case, the WITH parameters of SUBMIT zprogram will populate the internal tables automatically.  With the "WITH" parameters you specify the selection screen field name and the corresponding value. Which in turn will populate your internal table.

For more information, Check the link below

http://help.sap.com/saphelp_nw70/helpdata/en/9f/db9dd035c111d1829f0000e829fbfe/content.htm

Hope this clarifies your confusion.

Cheers!

Abhinab

Read only

arindam_m
Active Contributor
0 Likes
3,176

Hi,

Bit confused on the point of recording Z-Transaction using SM35. But yes JOB_OPEN , SUBMIT and JOB_CLOSE are the options and the data in internal table will have to be passed as SELECTION SCREEN input to the in the SUBMIT step.

The submit step is similar to giving the input on screen and executing the program.

Help links:

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba51a35c111d1829f0000e829fbfe/content.htm

And in job close you do get the options to schedule at a later time. Check the link below for input parameters in Job Close.

http://help.sap.com/saphelp_40b/helpdata/EN/fa/096d8e543b11d1898e0000e8322d00/content.htm

Cheers,

Arindam

Read only

Former Member
0 Likes
3,176

Hi Arindam,

mite be i am doing it in a wrong way. Please suggest if i have to read a list of materials from excel file and change something of these materials using a ztransaction as a background job then how should i proceed.

Thanks

Read only

Former Member
0 Likes
3,176

One problem is that you don't want to try to read an excel in the background.  It is more trouble than it is worth.  You should convert it to a delimited format.  That is easy to read in the background.  Also you must not have the file on the presentation server.  It must be on the application server.

Neal

Read only

Former Member
0 Likes
3,176

Hallo,

what could be the solution for this dump.

You attempted to start the ABAP/4 program "ZXXXXX" with SUBMIT, but the

attributes specify this program as type "M" instead of "1". You can

only start programs of type 1 with SUBMIT.

does that mean i should first create a zprogram for the functionality that i want to execute as the job and then call this zprogram with submit ?

Thanks

Read only

0 Likes
3,176

Hi,

Your Ztransaction must be a Module Pool(M) program, The SUBMIT statement can only be used for a Executable(1)  programs.

Sessions created can be scheduled with a program 'RSBDCSUB'.

First Create Session .

You can get the Created session details in the table APQI.

Read the session details and pass to the RSBDCSUB program.

Create a Executable program and in that use SUBMIT RSBDCSUB ..... to execute the session created.

Just see the parameters to be passed with that program.

Thanks & Regards

Bala Krishna

Read only

0 Likes
3,176

It is simplest to create a Zreport that calls what ever you have.  How did you create your BDC?

Neal

Read only

Former Member
0 Likes
3,176

Hi,

Now i had created the job using the bdc recording and copen close group methods. and i want to start this job from the program using submit  rsbdcbtc because i want to specify the time of starting of job while calling function job_close.

But the problem is that i have the qid but not the jobcount which is a mandatory parametr for job_close FB. Is there anyway i can get the jobcount from qid or what could be the possibility ?

Thanks.

Read only

0 Likes
3,176

Job_Open exports job count.  You need to Job_Open before you can Job_close.

Neal

Read only

Former Member
0 Likes
3,176

Thanks all. I could achieve what i wanted to. was not clear with few concepts.

Following is what i did. Have one problem now , explained at te end.

1) bdc recording for the transaction obtaoined

2) created a session using open group , close group, bdc field and bdc dynpro methods.

3)obtained qid of the session created

4) CALL FUNCTION 'JOB_OPEN'

5) CALL FUNCTION 'SET_PRINT_PARAMETERS'

6)SUBMIT reportname   WITH queue_id = lv_qid
        TO SAP-SPOOL  DESTINATION l_dest
        LINE-SIZE   l_linsz
        IMMEDIATELY 'X'
        KEEP IN SPOOL 'X'
        USER sy-uname
        VIA JOB jobname

        NUMBER lv_jobnumb
        WITHOUT SPOOL DYNPRO
        AND RETURN

7)CALL FUNCTION 'JOB_CLOSE' with startdate and starttime.

and it worked.

The last problem i am having is that the job is created as aperiodic job that i dont want.

i had checked other import parameters of the job_close Function module but could not find how i can set the job not to be created as periodic job.

Thanks

Read only

0 Likes
3,176

Can you show us the full job related code.  I'm afraid that without that I'm not seeing why you are creating a periodic job.

Neal

Read only

0 Likes
3,176

Hi Neal,

Here is the code.

   CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
*           AT_OPMODE                         = ' '
*           AT_OPMODE_PERIODIC                = ' '
*           CALENDAR_ID                       = ' '
*           EVENT_ID                          = ' '
*           EVENT_PARAM                       = ' '
*           EVENT_PERIODIC                    = ' '
            jobcount                          = lv_jobnumb
            jobname                           = 'lv_jobname'
*           LASTSTRTDT                        = NO_DATE
*           laststrttm                        = '220000'
*           PRDDAYS                           = 0
*           PRDHOURS                          = 0
*           PRDMINS                           = 0
*           PRDMONTHS                         = 0
*           PRDWEEKS                          = 0
*           PREDJOB_CHECKSTAT                 = ' '
*           PRED_JOBCOUNT                     = ' '
*           PRED_JOBNAME                      = ' '
            sdlstrtdt                         = sy-datum
            sdlstrttm                          = '163000'
*           STARTDATE_RESTRICTION             = BTC_PROCESS_ALWAYS
*           STRTIMMED                         = ' '
*           TARGETSYSTEM                      =
*           START_ON_WORKDAY_NOT_BEFORE       = SY-DATUM
*           START_ON_WORKDAY_NR               = 0
*           WORKDAY_COUNT_DIRECTION           = 0
*           RECIPIENT_OBJ                     =
           TARGETSERVER                      = 'dev_00'

*           DONT_RELEASE                      = ' '
*           TARGETGROUP                       = ' '
*           DIRECT_START                      =
*         IMPORTING
*           JOB_WAS_RELEASED                  =
*         CHANGING
*           RET                               =
*         EXCEPTIONS
*           CANT_START_IMMEDIATE              = 1
*           INVALID_STARTDATE                 = 2
*           JOBNAME_MISSING                   = 3
*           JOB_CLOSE_FAILED                  = 4
*           JOB_NOSTEPS                       = 5
*           JOB_NOTEX                         = 6
*           LOCK_FAILED                       = 7
*           INVALID_TARGET                    = 8
*           OTHERS                            = 9
                  .

Any ideas.

Read only

0 Likes
3,176

Linda,

You should have a CALL FUNCTION  'JOB_OPEN', to start.  I would need to see everything from there thru CALL FUNCTION 'JOB_CLOSE'.

It might not do too much good but that's what I think is the first step.

Neal

Read only

0 Likes
3,176

Honestly, at this point, I'm betting on a PID that needs to be cleared.  But that's just not the next step (as outlined above).

Neal