Submit via job without popups
Hello everyone,
I have a problem with the submit statement. I am submitting a report in the background so it won't show popup messages. The problem is that the popup messages are still displayed. When I debug, the report gets executed immediately at the submit statement, and possibly also afterwards in the background.
There are a few similar threads here, but none seem to have a solution. Here is my code:
CONCATENATE 'Create_material_' i_stockid INTO v_jobname .
CALL FUNCTION 'JOB_OPEN'
EXPORTING
DELANFREP = ' '
JOBGROUP = ' '
jobname = v_jobname
SDLSTRTDT = NO_DATE
SDLSTRTTM = NO_TIME
JOBCLASS =
IMPORTING
jobcount = v_jobcount
CHANGING
RET =
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SUBMIT zfl046_mm_flex_stock_matact AND RETURN
USER sy-uname
WITH pa_stid = i_stockid
VIA JOB v_jobname
NUMBER v_jobcount
TO SAP-SPOOL KEEP IN SPOOL 'X'
WITHOUT SPOOL DYNPRO.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobname = v_jobname
jobcount = v_jobcount
strtimmed = 'X'
IMPORTING
job_was_released = v_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 = 99.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Any ideas why the popups still show, or why it executes the submit in the foreground?
Thanks for everything that might help
Message was edited by: Vandersteen Jorg
Message was edited by: Vandersteen Jorg
I've tried your suggestions, but it does not seem to help.
This is my code now:
DATA: v_jobcount TYPE tbtcjob-jobcount,
v_jobname TYPE tbtcjob-jobname,
v_job_released TYPE btch0000-char1,
g_print_params LIKE pri_params,
g_valid_flag.
CONCATENATE 'Create_material_' i_stockid INTO v_jobname .
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
archive_mode = '1'
mode = 'BATCH'
report = 'ZFL046_MM_FLEX_STOCK_MATACT'
no_dialog = 'X'
IMPORTING
out_parameters = g_print_params
valid = g_valid_flag.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
DELANFREP = ' '
JOBGROUP = ' '
jobname = v_jobname
SDLSTRTDT = NO_DATE
SDLSTRTTM = NO_TIME
JOBCLASS =
IMPORTING
jobcount = v_jobcount
CHANGING
RET =
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SUBMIT ZFL046_MM_FLEX_STOCK_MATACT
TO SAP-SPOOL SPOOL PARAMETERS g_print_params
WITHOUT SPOOL DYNPRO
USER sy-uname
WITH pa_stid = i_stockid
VIA JOB v_jobname
NUMBER v_jobcount
AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobname = v_jobname
jobcount = v_jobcount
strtimmed = 'X'
IMPORTING
job_was_released = v_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 = 99.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Similar Messages
-
Problem Submit Via Job in BADI
Hello All
I am using SUBMIT VIA JOB in BADI "work order update" and but no job is created....also sy-subrc is 0.
Here is the code
call function 'JOB_OPEN'
exporting
jobname = name
importing
jobcount = number
exceptions
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
others = 4.
if sy-subrc = 0.
submit z_idoc_create_process_order and return
via job name number number
with p_aufnr = it_header1-aufnr
with p_werks = it_header1-werks
with p_autyp = c_autyp
with p_auart = it_header1-auart
with p_dispo = it_header1-dispo
with p_opt = c_opt
with p_mestyp = c_mestyp.
if sy-subrc = 0.
call function 'JOB_CLOSE'
exporting
jobcount = number
jobname = name
strtimmed = 'X'
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.
endif.
Any reason why job is not created?
Thanks in advance.
regads
VInitHi guys,
I tried this
SUBMIT z_idoc_create_process_order USER creator using selection-set lv_variant TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
WITH p_aufnr EQ it_header1-aufnr
WITH p_werks EQ it_header1-werks
WITH p_autyp EQ c_autyp
WITH p_auart EQ it_header1-auart
WITH p_dispo EQ it_header1-dispo
WITH p_opt EQ c_opt
WITH p_mestyp EQ c_mestyp
VIA JOB name NUMBER number
AND RETURN.
Now the job is getting created but my Variant has no values
How to pass values to variant? below values are not getting tranferred.
WITH p_aufnr EQ it_header1-aufnr
WITH p_werks EQ it_header1-werks
WITH p_autyp EQ c_autyp
WITH p_auart EQ it_header1-auart
WITH p_dispo EQ it_header1-dispo
WITH p_opt EQ c_opt
WITH p_mestyp EQ c_mestyp -
Submit via email without an email program
I want to submit via email without an email program like in windows using the maildoc() it uses outlook but i want to make it more universal(for use on computers where outlook, iMail, or some sort of program set up to send and multi-OS) where it will login to my own SMTP server to send the whole pdf as an attachment. I am using Acrobat X Pro
You can't set up a form to do that, but you can set it up so that it submits to a web server, which can do the job of forwarding it along in an email. You just need to program the web server to do so.
-
Submit via Job- problem in code
I need to convert the PR to PO automatically, we can do this by me59n, so iam scheduling the job for the me59n program. here iam using Badi's, iam getting the PR, plant, vendor from IM_Eban from the method of Badi, reading this in internal table, zeban. now when the execute the transaction(va01) and saving, PR shouls be converted to PO. i would like to have guys look into the code, and pl correct this.
method IF_EX_ME_REQ_POSTED~POSTED .
DATA: ACTUAL_JOBNAME type tbtcjob-JOBNAME value 'Z_TEST2',
JOBCOUNT type tbtcjob-JOBCOUNT,
MSG(60) TYPE C,
STIME TYPE SY-UZEIT.
DATA: ZEBAN TYPE UEBAN.
DATA: P_BANFN(10) TYPE N.
read table IM_EBAN into Zeban index 1.
*Open the Job
CALL FUNCTION 'JOB_OPEN' " OPENING JOB
EXPORTING
JOBNAME = ACTUAL_JOBNAME " JOB NAME
IMPORTING
JOBCOUNT = JOBCOUNT.
DATA SELTAB type table of RSPARAMS.
data : sel_wa type rsparams.
Populate internal table.
MOVE: 'S_EKGRP' TO SEL_wa-SELNAME,
'I' TO SEL_WA-SIGN,
'EQ' TO SEL_WA-OPTION,
'S' TO SEL_wa-KIND,
Zeban-ekgrp TO sel_wa-LOW.
APPEND sel_wa to SELTAB.
CLEAR SEL_WA.
MOVE: 'S_FLIEF' TO SEL_wa-SELNAME,
'I' TO SEL_WA-SIGN,
'EQ' TO SEL_WA-OPTION,
'S' TO SEL_wa-KIND,
Zeban-flief TO sel_wa-LOW.
APPEND sel_wa to SELTAB.
CLEAR SEL_WA.
MOVE: 'S_WERKS' TO SEL_wa-SELNAME,
'I' TO SEL_WA-SIGN,
'EQ' TO SEL_WA-OPTION,
'S' TO SEL_wa-KIND,
Zeban-werks TO sel_wa-LOW.
APPEND sel_wa to SELTAB.
CLEAR SEL_WA.
MOVE: 'P_GBANFN' TO SEL_WA-SELNAME,
'P' TO SEL_WA-KIND,
'X' TO SEL_WA-LOW.
APPEND SEL_WA TO SELTAB.
CLEAR SEL_WA.
MOVE: ZEBAN-BANFN TO P_BANFN.
MOVE: 'S_BANFN' TO SEL_WA-SELNAME,
'I' TO SEL_WA-SIGN,
'EQ' TO SEL_WA-OPTION,
'S' TO SEL_WA-KIND,
P_BanfN TO SEL_WA-LOW,
SPACE TO SEL_WA-HIGH.
APPEND SEL_WA TO SELTAB.
CLEAR SEL_WA.
MOVE: 'P_VRTYPK' TO SEL_WA-SELNAME,
'P' TO SEL_WA-KIND,
'X' TO SEL_WA-LOW.
APPEND SEL_WA TO SELTAB.
SUBMIT RM06BB30 VIA JOB ACTUAL_JOBNAME
NUMBER JOBCOUNT
TO SAP-SPOOL DESTINATION 'NULL'
WITHOUT SPOOL DYNPRO
WITH SELECTION-TABLE SELTAB
AND RETURN.
STIME = SY-UZEIT + 900.
*Schedule the job after 15 min and Close the job.
CALL FUNCTION 'JOB_CLOSE' " CLOSING JOB
EXPORTING
JOBNAME = ACTUAL_JOBNAME
JOBCOUNT = JOBCOUNT
STRTIMMED = 'X'
TARGETSYSTEM = SY-HOST.
LASTSTRTTM = STIME.
endmethod.Hi,
Could you please let us know, what is the error you are getting.
Best regards,
Prashant -
I have an ABAP wrapper program that generates a job with multiple steps using JOB_OPEN, SUBMIT...VIA JOB and JOB_CLOSE. The generated job will have multiple steps and each step can have an error message. How do I code SUBMIT statement to allow processing of subsequent steps even if error or do I have to use JOB_SUBMIT and then what setting would I then use for that scenario?
I think it will not be possible to continue to the next step in a multi-step job if the previous one has ended in error.
If you need this, you shall probably define these as independent jobs. -
SUBMIT VIA JOB MESSAGE TYPE 'E'
Hi!
Please help me, I can't use submit via background job, because he can't handle message errors of type 'E'. When this kind of message occurs, all background processing stops and I get a report screen with this message in the status bar.
Is there any solution?Let me understand this. You have a program A from which you submit a program B in the background and if in program B an error is raised, your program A execution stops. Is this true?
Did you do a job close in your code. Here is a sample program ZTEST1 that submits another program ZTEST2 in the background. If there is an error message thrown out in ZTEST2, the job submitted is cancelled, with the job log showing the error message. The processing of ZTEST1 continues even after that.
I don't know why yours is not. Please let us know.
<u>Program ZTEST1</u>
REPORT ztest1 .
PARAMETERS: p_matnr1 LIKE mara-matnr.
DATA: v_jobcount LIKE tbtcjob-jobcount,
v_jobname LIKE tbtcjob-jobname.
START-OF-SELECTION.
v_jobname = 'TESTJOB'.
*-- open the job
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = v_jobname
IMPORTING
jobcount = v_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*-- submit the report
SUBMIT ztest2 WITH p_matnr2 = p_matnr1
USER sy-uname VIA JOB v_jobname
NUMBER v_jobcount AND RETURN.
*-- close the job
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = v_jobcount
jobname = v_jobname
strtimmed = 'X'
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.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
WRITE:/ 'Job submitted successfully.'.
<u>Program ZTEST2</u>
REPORT ztest2 MESSAGE-ID zz.
PARAMETERS: p_matnr2 LIKE mara-matnr.
DATA: itab LIKE mara OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.
SELECT * INTO TABLE itab FROM mara
WHERE matnr = p_matnr2.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'Invalid material number'.
ENDIF.
LOOP AT itab.
WRITE:/ itab-matnr.
ENDLOOP. -
Hello all
I m creating a program to delete old entries from tables.This can be done
1. Foreground
2. Background
I have created 2 reports
Report A - MAin report
Report B -has the following stmts
REPORT b.
DATA: i_JOBCOUNT LIKE TBTCJOB-JOBCOUNT,
i _JOBNAME LIKE TBTCJOB-JOBNAME .
SUBMIT A AND RETURN
USER SY-UNAME
VIA JOB I_JOBNAME NUMBER I_JOBCOUNT
In the background option of report A I have used
job_open with jobname as Report A.
Submit B
user sy-uname
via jobname jobnumber
and return.
Job_close
with jobname, jobnumbr and start immediately = 'x'.
Now when I execute this pgm with foreground option,
I get the records deleted from the table
but the same does not happen in background option.
kindly guide me.
Thanks
TharaniHi
Why don't you run the report A directly in background mode?
Anyway your report should be:
va_jobname = <REPORT B>
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = VA_JOBNAME
IMPORTING
JOBCOUNT = VN_JOBCOUNT
EXCEPTIONS
CANT_CREATE_JOB = 1
INVALID_JOB_DATA = 2
JOBNAME_MISSING = 3
OTHERS = 4.
IF SY-SUBRC = 0.
SUBMIT <REPORT A> USER SY-UNAME
VIA JOB VA_JOBNAME NUMBER VN_JOBCOUNT
AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = VN_JOBCOUNT
JOBNAME = VA_JOBNAME
STRTIMMED = 'X'
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 NE 0.
MESSAGE E999 WITH TEXT-E05.
ENDIF.
ENDIF.
Max -
SUBMIT program VIA JOB and SET/GET parameter
Hi All
I need to pass the content of a variable from the program 'A' to program 'B'.
Program A uses JOB_OPEN , SUBMIT program VIA JOB jobname NUMBER jobnumber AND return, JOB_CLOSE.
I tried to use import/export memory but it didn't work. Then I am trying to use set/get parameters but it also did not work.
Program A is going to run in any server and program B will run in the central instance (it is determined in the FM JOB_CLOSE, parameter target_server).
Program does not have selection-screen.
Is it possible use set/get parameter with submit via job?
Could you please advise?
Thanks in advance.
João GaiaHere a simple code
*Submit report as job(i.e. in background)
data: jobname like tbtcjob-jobname value
'TRANSFER DATA'.
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 value 'X'.
* 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.
Then... for import/export of a variable, you can use Import Memory and Export Memory function.
Like this:
REPORT A:
IF NOT it_dlist_out IS INITIAL.
EXPORT it_dlist_out TO MEMORY ID 'TEST1234'.
ELSE.
* Clearing memory
FREE MEMORY ID 'TEST1234'.
ENDIF.
REPORT B:
IMPORT it_dlist_out TO lt_dlist_out FROM MEMORY ID 'TEST1234'.
Edited by: spantaleoni on Jan 11, 2011 3:21 PM
Edited by: spantaleoni on Jan 11, 2011 3:23 PM -
Problem in submiting standard program via job
Hi Experts ,
I have developed programs for creating and posting return lots and payment lots for multiple incoming files. For this i have submited standard program of FPB3 and FPB5 transaction . What happened is , if the child program fails due to some reason for one file , it is not coming back to the mother program and as a result other files remain unprocessed . So for this i tried with submiting the child program Via job so that if child program fails , only that job will fail and the mother program will not fail , so rest files will be processed .
But the problem is the child program (standard program of FPB3/FPB5 ) is not working by this i.e. the lots are not getting created adn.
Awaiting for any respone .Hi,
If you are using Submit via Job, you need to use JOB_OPEN and JOB_CLOSE FM's.
JOB_OPEN : Create a new job and return you the job number which you use in Submit
JOB_CLOSE: Will set the release conditions of the job.
Example:
DATA: number TYPE tbtcjob-jobcount,
name TYPE tbtcjob-jobname VALUE 'JOB_TEST',
print_parameters TYPE pri_params.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = name
IMPORTING
jobcount = number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SUBMIT submitable TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB name NUMBER number
AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = number
jobname = name
strtimmed = 'X'
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.
ENDIF.
ENDIF.
ENDIF.
Regards,
Jovito -
Problem submitting RFEBKA00 via Job
Hi experts
I have a requirement to create a Z program to upload 3 different files by using RFEBKA00.
For this purpouse, I have created a Z program which creates 3 Z jobs (ZA, ZB, ZC one per file) using JOB_OPEN / SUBMIT program VIA JOB / JOB_CLOSE.
Once every job is finished, I need to read logs using BP_JOBLOG_READ,and if there are no errors, move files to other folder.
My questions are:
1.- When using JOB_OPEN and SUBMIT VIA JOB name NUMBER n, as far as I know n is the number returned by jobcount parameter from JOB_OPEN and should be the same for both jobs (the Zjob created by JOB_OPEN and the one created by program RFEBKA00).When I debbug the program, it is OK, but when accessing table TBTCO sometimes there are 2 different jobcounts. Seems that jobcount is created based on sy-uzeit and sometimes there is some delay between JOB_OPEN and SUBMIT. Is there any way to ensure both jobs have the same jobcount?.
2.- As I need to read the log for each file, and because of the fact that the job created by submitting RFEBKA00 has always the same name, if the answer to my first question is NO, how can I link each of my Z jobs with its corresponding RFEBKA00 job?.
Many thanks in advance for your answers.
BR,
Carlos.Hi Thomas
Thanks for your answer.
For your first question, there is not BD key problem beacuse of my job is ZJOB and the one created when doing submit via job is RFEBKA00-EXTR.CTA.EL. (standard job) have different names.
But job number should be the same, because I'm using JOB_OPEN (which return the job number in parameter jobcount) and SUBMIT VIA JOB .
For the second question, and based on SAP documentation about SUBMIT , when submitting a program vía job, the submitted program is executed as a background task, which means creating a new job, so the answers is yes, the standard program schedules a new job. -
We run a Job in a 10g (10g Enterprise Edition Release 10.2.0.4.0) DB using this code in SQL*Plus.
SQL> EDIT
Wrote file afiedt.buf
1 DECLARE
2 v_JobNum NUMBER;
3 BEGIN
4 DBMS_JOB.SUBMIT(v_JobNum,'chs_job_test;',sysdate, NULL);
5 DBMS_OUTPUT.PUT_LINE('Job # = ' || v_jobnum);
6 commit;
7* END;
8 /
PL/SQL procedure successfully completed.
SQL> set serverout on
SQL> /
Job # = 462Job runs successfully. i.e. the procedure chs_job_test is executed OK. Problem is when we query the USER_JOBS view, we don't see any record for Job 462??
Why is this??
Where can we get information of the jobs submitted???
If an error occured when running job, from where, which DD View we can get this?If you submit a job without specifying the NEXT_DATE and INTERVAL, Oracle treats it as a "single execution" job. It is removed from the job queue once it is completed.
Hemant K Chitale -
JOB_OPEN, SUBMIT REPORT VIA JOB, JOB_CLOSE, How to get result?
Hi Friends,
I am calling reports using jobs as calling job_open, submit report via job.., and job_close. But I want to the output/result of the report. How can I do this?
Thanks.Hello nkara,
Welcome to SDN!!!
Check this thread:
background grid
REgards,
Vasanth -
Submit a transaction O4B1 via job and the result as an attachment Excel
Hi, I'm executing a program in background via job to get back the result of a report as an attachment XLS on mail. the result of my program give me just title of Excel columns , but when i execute it manually , the result is perfect.
my code is : ******************************FORM MAIL******************************* FORM mail. CONCATENATE 'Expédition' 'TExp' 'PtOT' 'Crée' 'Crée le' 'St.' 'Déb. chargt' 'Désignation' 'Div.' 'Doc. vente' 'Réceptionnaire' 'Nom1' 'Nom2' 'Volume' 'UQ' INTO it_mess_att SEPARATED BY con_tab. CONCATENATE con_cret it_mess_att INTO it_mess_att. APPEND it_mess_att. CONCATENATE SPACE SPACE INTO it_mess_att SEPARATED BY con_tab. CONCATENATE con_cret it_mess_att INTO it_mess_att. APPEND it_mess_att. *CLEAR it_mess_att. LOOP AT it_tab into wa_tab. *VAL = it_tab-ZQTEMAX. CONCATENATE wa_tab-SHNUMBER wa_tab-SHTYPE wa_tab-TPLST wa_tab-CRE_NAME wa_tab-CRE_DATE wa_tab-OIG_SSTSF wa_tab-LOAD_STDTA wa_tab-VMODE_TEXT wa_tab-WERKS wa_tab-VBELN wa_tab-KUNNR wa_tab-NAME1 wa_tab-CARRIER_DE wa_tab-WGT_UOM INTO it_mess_att SEPARATED BY con_tab. CONCATENATE con_cret it_mess_att INTO it_mess_att. APPEND it_mess_att. *CLEAR it_mess_att. ENDLOOP. ENDFORM. *************************FORM SEND_MAIL******************************* FORM send_mail . DATA: send_request TYPE REF TO cl_bcs, document TYPE REF TO cl_document_bcs, recipient TYPE REF TO cl_cam_address_bcs, bcs_exception TYPE REF TO cx_bcs, sent_to_all TYPE os_boolean, lt_fields TYPE TABLE OF w3fields, lt_html TYPE TABLE OF w3html. DATA: ld_error TYPE sy-subrc, ld_reciever TYPE sy-subrc, ld_mtitle LIKE sodocchgi1-obj_descr, ld_email LIKE somlreci1-receiver, ld_format TYPE so_obj_tp , ld_attdescription TYPE sopcklsti1-obj_descr, ld_attfilename TYPE so_obj_des , ld_sender_address LIKE soextreci1-receiver, ld_sender_address_type LIKE soextreci1-adr_typ, ld_receiver LIKE sy-subrc. DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE, t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE, t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE, t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE, t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE, w_cnt TYPE i, w_sent_all(1) TYPE c, w_doc_data LIKE sodocchgi1. *MOVE p_email TO mailid. ***************ADD ADRESS MAIL************** p_email1-RECEIVER = mail . append p_email1. ********************************************* ld_email = mail. ld_mtitle = gd_attachment_desc. ld_format = 'XLS'. * ld_attdescription = gd_attachment_desc. ld_attdescription = 'Liste expéditions PN'. CONCATENATE ld_attdescription '.XLS' INTO ld_attfilename. * ld_attfilename = p_filename. ld_sender_address = w_sender. ld_sender_address_type = 'INT'. * Fill the document data. w_doc_data-doc_size = 1. * Populate the subject/generic message attributes w_doc_data-obj_langu = sy-langu. w_doc_data-obj_name = 'SAPRPT'. w_doc_data-obj_descr = ld_mtitle . w_doc_data-sensitivty = 'F'. * Fill the document data and get size of attachment CLEAR w_doc_data. READ TABLE it_mess_att INDEX 1. w_doc_data-doc_size = ( w_cnt - 1 ) * 255 + STRLEN( it_mess_att ). w_doc_data-obj_langu = sy-langu. w_doc_data-obj_name = 'SAPRPT'. w_doc_data-obj_descr = gd_attachment_desc. w_doc_data-sensitivty = 'F'. CLEAR t_attachment. REFRESH t_attachment. * t_attachment[] = it_attach[] . * Describe the body of the message clear t_packing_list. REFRESH t_packing_list. t_packing_list-transf_bin = space. t_packing_list-head_start = 1. t_packing_list-head_num = 0. t_packing_list-body_start = 1. DESCRIBE TABLE it_mess_bod LINES t_packing_list-body_num. t_packing_list-doc_type = 'RAW'. APPEND t_packing_list. * Create attachment notification t_packing_list-transf_bin = 'X'. t_packing_list-head_start = 1. t_packing_list-head_num = 1. t_packing_list-body_start = 1. DESCRIBE TABLE it_mess_att LINES t_packing_list-body_num. t_packing_list-doc_type = ld_format. t_packing_list-obj_descr = ld_attdescription. t_packing_list-obj_name = ld_attfilename. t_packing_list-doc_size = t_packing_list-body_num * 255. APPEND t_packing_list. * Add the recipients email address CLEAR t_receivers. REFRESH t_receivers. loop at p_email1. t_receivers-receiver = p_email1-receiver. t_receivers-rec_type = 'U'. t_receivers-com_type = 'INT'. t_receivers-notif_del = 'X'. t_receivers-notif_ndel = 'X'. APPEND t_receivers. endloop. CALL FUNCTION 'SO_DOCUMENT_SEND_API1' EXPORTING document_data = w_doc_data put_in_outbox = 'X' sender_address = ld_sender_address sender_address_type = ld_sender_address_type commit_work = 'X' IMPORTING sent_to_all = w_sent_all TABLES packing_list = t_packing_list contents_bin = it_mess_att contents_txt = it_mess_bod receivers = t_receivers EXCEPTIONS too_many_receivers = 1 document_not_sent = 2 document_type_not_exist = 3 operation_no_authorization = 4 parameter_error = 5 x_error = 6 enqueue_error = 7 OTHERS = 8. * Populate zerror return code ld_error = sy-subrc. * Populate zreceiver return code LOOP AT t_receivers. ld_receiver = t_receivers-retrn_code. ENDLOOP. WAIT UP TO 5 SECONDS. SUBMIT rsconn01 WITH mode = 'INT' WITH output = 'X' AND RETURN. ENDFORM. " send_mailgood answer
-
SPOOL Not generated in SUBMIT background job
Hi All,
I am submiting a report program using SUBMIT keyword. I required SPOOL. But its not generating. Can anyone kindly let me know whts wrong in my code?
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
LAYOUT = 'X_65_132'
LINE_COUNT = 65
LINE_SIZE = 132
IMPORTING
OUT_PARAMETERS = print_parameters
OUT_ARCHIVE_PARAMETERS = ARCPAR
VALID = VAL
EXCEPTIONS
ARCHIVE_INFO_NOT_FOUND = 1
INVALID_PRINT_PARAMS = 2
INVALID_ARCHIVE_PARAMS = 3
OTHERS = 4.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = name
IMPORTING
jobcount = number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SUBMIT saprck60
TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
WITH FREE SELECTIONS texpr
VIA SELECTION-SCREEN
WITH ck_matnr = 'Z*' SIGN 'E'
WITH ck_werks = p_werks
WITH kalaid = wa_default-kalaid
WITH kaladat = sy-datum
WITH backgr = 'X'
VIA JOB name NUMBER number
AND RETURN .Hi,
Try this code
data : l_jobname TYPE tbtcjob-jobname,
l_jobcount TYPE tbtcjob-jobcount,
l_dest TYPE pri_params-pdest VALUE 'LOCL',
l_linsz TYPE pri_params-linsz VALUE '999999',
l_jobstatus TYPE tbtco-status,
l_rqident TYPE tsp01-rqident.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = l_jobname
IMPORTING
jobcount = l_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc EQ 0.
* Set default print parameters for Spool
CALL FUNCTION 'SET_PRINT_PARAMETERS'
EXPORTING
destination = l_dest
line_size = l_linsz.
SUBMIT saprck60
TO SAP-SPOOL DESTINATION l_dest
LINE-SIZE l_linsz
IMMEDIATELY 'X'
KEEP IN SPOOL 'X'
USER sy-uname VIA JOB l_jobname NUMBER l_jobcount
WITHOUT SPOOL DYNPRO
WITH SELECTION-TABLE p_sel_opts
AND RETURN.
IF sy-subrc EQ 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_jobcount
jobname = l_jobname
strtimmed = 'X'
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.
ENDIF.
ENDIF.
* Check the Job status
DO.
CALL FUNCTION 'BDL_READ_JOB_STATUS'
EXPORTING
jobname = l_jobname
jobnumber = l_jobcount
IMPORTING
jobstatus = l_jobstatus
EXCEPTIONS
job_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF l_jobstatus EQ 'F'.
EXIT.
ENDIF.
ENDDO.
Regards,
Nagaraj -
Hi all,
I am confused in one scenario while using submit statement..
In my requirement i have two report programs say "X" and "Y".
X calls the report Y with some inputs .......and X is scheduled as a job.
Y calls a standard SAP program with some inputs and that output is what actually needed....
so my doubt is if i schedule X as job will the outpur from srandard sap program will be available in spool or should i schedule a job for Y also.
If i need to schedule a job for both x and y shud i use the same job name.
Please help!!!Hi people,
Thanks for your reply.
But i checked it is not working .i mean i am not getting the spool output .
for your reference i will give sample code
<b>ZCALLMARK</b>
DATA: jobname LIKE tbtcjob-jobname VALUE 'hemajob4',
jobcount LIKE tbtcjob-jobcount VALUE 1,
start_time LIKE sy-uzeit,
params LIKE pri_params,
w_prog(30),
v_commit TYPE c,
variant_name(14) type c,
stringlen type i value 0,
temp_string(18) type c,
msg_string(50) type c.
move 'ZCTE0010_MARK' to w_prog.
perform open_job using jobname.
perform submit_job.
perform job_close.
Form open_job
FORM open_job using jobname.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = jobname
IMPORTING
jobcount = jobcount
EXCEPTIONS
others = 8.
IF sy-subrc NE 0.
WRITE: /1 'Error Opening Job ', jobname.
ENDIF.
ENDFORM. " open_job
Form submit_job
FORM submit_job.
SUBMIT (w_prog) TO SAP-SPOOL
WITH crun = 'TEST4000'
WITH cdate = '20070701'
WITH rb1 = 'X'
SPOOL PARAMETERS params
WITHOUT SPOOL DYNPRO
USER sy-uname VIA JOB jobname NUMBER jobcount
AND RETURN.
if sy-subrc > 4.
WRITE: /1 'Error Submitting Job ', jobname.
endif.
ENDFORM. " submit_job
Form job_close
FORM job_close.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = jobcount
jobname = jobname
strtimmed = 'X' "start immediately
EXCEPTIONS
cant_start_immediate = 1.
<b>ZCTE0010_MARK</b>
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
PARAMETERS : crun TYPE kala-kalaid OBLIGATORY,
cdate TYPE kala-kaladat OBLIGATORY.
PARAMETERS : rb1 RADIOBUTTON GROUP rb USER-COMMAND rbut,
rb2 RADIOBUTTON GROUP rb .
SELECTION-SCREEN END OF BLOCK b1.
SUBMIT saprck23
USING SELECTION-SET 'SAP&15'
WITH p_buper = '10'
WITH p_gjahr = '2007'
WITH kaladat = cdate
WITH kalaid = crun
WITH p_ckvo = 'X'
WITH p_test = ' '
WITH p_listau = 'X'
WITH p_batch = ' '.
Please refer this and tell me where i am going wrong!!!
Maybe you are looking for
-
How can I grab a specific integer value from iTunes Current Album?
Currently I'm working with these two bits of code: This returns the "album" value from the track current playing in iTunes. on run set info to "" tell application "System Events" set num to count (every process whose name is "iTunes")
-
I am attempting to set up my printer to operate wirelessly. I have the computer and printer connected via USB for the setup. I have : PRINTER : HP All In One Photosmart C4385 ROUTER : Linksys wireless B (WPA security) COMPUTER : Macbook Mac OS
-
Iam using iPlanet 6.0SP6 in NT 4.0. I would like to make the session cookie JSESSIONID to be transfer only on secure connection. Then, I make the change to web-apps.xml as below <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE vs PUBLIC "-//Sun Micro
-
Is there a way to go move a project from IDVD back to IMOVIE?
This is clearly a newbie question: I know how to share from Imovie to IDVD and I made my IDVD project, but now I don't know if I still have the IMovie I originally transferred. Is there a way to move a project from IDVD back to IMOVIE?
-
Toggling btwn panels -help w setup
I'm trying to avoid using the mouse as much as I do, and was wondering if anyone knows how to avoid that when I have to click in each of my three open panels to edit code. I know Shift/Tab covers toggling btwn docs. I looked at the cs5 keyboard short