2013 Jun 27 9:05 AM
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.
2013 Jun 27 9:46 AM
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!
2013 Jun 27 12:17 PM
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
2013 Jun 27 9:53 AM
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
.
2013 Jun 27 10:53 AM
Hi Abhinab,
thats what the confusion is. where you had specified the internal table that contains the dynpro and field values while submitting ?
Thanks
2013 Jun 27 1:13 PM
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
2013 Jun 27 10:11 AM
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
2013 Jun 27 10:56 AM
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
2013 Jul 01 5:37 PM
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
2013 Jul 01 3:08 PM
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
2013 Jul 01 4:43 PM
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
2013 Jul 01 5:41 PM
It is simplest to create a Zreport that calls what ever you have. How did you create your BDC?
Neal
2013 Jul 04 11:47 AM
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.
2013 Jul 04 1:50 PM
Job_Open exports job count. You need to Job_Open before you can Job_close.
Neal
2013 Jul 05 12:59 PM
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
2013 Jul 05 4:38 PM
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
2013 Jul 08 8:27 AM
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.
2013 Jul 08 12:09 PM
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
2013 Jul 08 12:35 PM
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
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |