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
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 -
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 JorgI'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. -
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 -
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. -
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 -
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
-
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 -
Problem in Submit via selection screen statement
Dear Experts,
I have designed selection screen and a dialog screen 100. I am passing the selection screen values to dialog screen using Selection screen via selection screen statement. When i tried to change the values in dialog screen, it is not allowing me to do so and the values are not refreshed.
I have searched the SDN Forum, but not able to find the suitable thread.
Regards,
Ramesh Manoharan
Edited by: ramesh.manoharan on Mar 17, 2010 1:03 PMHi,
I have used the below statement to pass values the values from selection screen to dialog screen (Created as an Executable program)
Submit <pgm> via selection screen
with ...... .
Dialog screen is created as an executable program where i have created two subscreen area and populating the Selection Screen as subscreen by using the below statement:
selection-screen begin of screen <subscreen no.> as subscreen.
selection-screen end of screen <subscreen no.>.
The problem i am facing is that the values of selection screen are getting populated in the dialog screen. But when i tried to change the input values in the dialog selection screen. I am unable to do that and it is not showing the new entered values. Only the previous values are shown (got from selection screen from Submit via selection screen statement).
Kindly let me know where i am going wrong ? Kindly help me to overcome the problem .
Regards,
Ramesh Manoharan -
Submit report background ------ problem
Hi Friends,
This is regarding submit program in background.
I am calling program like this..
SUBMIT ZXXXX
VIA JOB name NUMBER number
WITH P_MODE EQ 'N'
TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
AND RETURN.
With this Job is creating successfully and status showing finished. But it seems program was not executed. no action has performed. time taken is 0 seconds
the same code I tested in debug mode by commenting
* VIA JOB name NUMBER number
in the above statement.
it is working fine. could you pls help me I want submit my program in background.
for your information. Before submit I am using function module JOB_OPEN.
and after submit I am using JOB_CLOSE.
Pls help me. very urgent.
Thanks in advance.
RaghunathYou can check the job status in SM37. Here is a working example, see what's different in your code:
CONCATENATE 'Z' p_vkorg '_POST_RETURNS' INTO jobname.
CLEAR jobcount.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = jobname
IMPORTING
jobcount = jobcount.
IF sy-subrc <> 0.
ENDIF.
SUBMIT ...
WITH p...
VIA JOB jobname
NUMBER jobcount
USER user_name
AND RETURN.
* Close the job and run immediately
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = jobcount
jobname = jobname
strtimmed = 'X'. " Start immediately -
Submit batch job daynamically using batch user id
Hi,
I need to submit the background job dynamically from ABAP program with BATCH user id.
I have created new program. Users will execute program in foreground.
Had issue with USER id. If I give my user id then batch job successfully creating. If I give u2018BAICHu2019 id then it is giving the error.
Am I doing any thing wrong here?
Code:
Open Job
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = jobname
IMPORTING
jobcount = w_jobcount.
SUBMIT zrufilep WITH p_file1 = sourfile
WITH p_file2 = destfile
VIA JOB jobname NUMBER w_jobcount
USER 'BATCH_FI'
AND RETURN.
Schedule and close job.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = w_jobcount
jobname = jobname
sdlstrtdt = sy-datum
sdlstrttm = sy-uzeit.
ThanksCan any body tell me if that authorization is given to the user, can he submit any other job from front end?
As you can see if he can, it will conflict security issues of business. So If he is not permitted to execute these kind of statements in any other program, would he be confined to using diff user in this program only?
Or is there any other way-out to confine the user for getting this authorization for a single T-code or such? -
Submit background job for a report
Hai Friends,
I want to submit a report in background which should run on first monday of every month. otherthen SM36 and SM37. Because we cant give date and time like this.
If any coding required Pl give me the code.
regards,
vamsykrishna.This is the Basic code to Achieve that.
Call Function 'JOB_OPEN'
SUBMIT RSBDCBTC
via background Job <Job info>
With QIE = <QID Returned by BDC_OPEN_Group FM>
AND RETURN.
Call Function 'JOB_CLOSE'
2) Also go through this
DATA: lv_job_name LIKE tbtco-jobname,
lv_job_nr LIKE tbtco-jobcount,
lv_job_released TYPE c,
lv_job_start_sofort TYPE c,
lv_print_parameters TYPE pri_params.
lv_job_name = 'Z_BGPROGRAM'.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = lv_job_name
IMPORTING
jobcount = lv_job_nr
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF syst-subrc = 0.
" submit job with all the selection screen params...
SUBMIT (lv_job_name)
WITH applfile = applfile " these are the parameters of the background program
WITH p_lines = p_lines
USER syst-uname " you must use this
VIA JOB lv_job_name NUMBER lv_job_nr AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = lv_job_nr
jobname = lv_job_name
strtimmed = 'X'
IMPORTING
job_was_released = lv_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.
IF syst-subrc <> 0.
MESSAGE i162(00) WITH
'An error occured while closing the background job.'.
STOP.
ENDIF.
ENDIF.
ENDIF.
SKIP 1.
WRITE: / 'Background process', lv_job_name , 'called successfully' NO-GAP.
WRITE: / 'You can check the job in transaction SM37'.
Maybe you are looking for
-
How to hide date in calendar facet
Hi All, I have a requirement to hide the Dates on the calendar and widget has to show Sat, Sun , Mon without dates.Is there any way to customize calendar app to show only weekdays but not dates? Note:I am supporting only week mode in my app. Thanks
-
Hello I have recently been working on a small 10 minute Movie project. i was on the verge of completing it almost last night, until i tried to add a small sound effect, at which point iMovie froze completely. Now each time i try to go back to that Pr
-
Change a category name in numbers
I am trying to set up the personel budget and want to change or add category names. I cannot do this, would anyone know how? Some of the names there are of no use to me and do not fit my needs, thanks
-
Deskjet 3070A - Cannot print in Black
Hi I've read about ALL the threads about this problem and it seems that there is no real solution. I've noticed that Ciara sometimes help with sending a PM. Please Ciara help me as well. Many Thanks
-
Import playlists into iTunes 10.4.1.10
Hi everyone, I have been using iTunes and MusicIP Mixer together for years, with MusicIP Mixer generating my playlists. I like to do this because I have a large music collection & can generat a playlist of about 100 songs to listen to each day. Howev