RFC to cancel background job
I need to cancel a background job from running by using a Remote Function Call. Can anyone provide an example of an RFC for this? Ideally, it would cancel all jobs owned by a certain user.
BAPI_XBP_JOB_ABORT wants the JOBCOUNT as well as the JOBNAME. How can I get the JOBCOUNT? I don't believe there is a way to capture the ID from the external application kicking off the SAP job.
Similar Messages
-
Trigger mail for cancelled background jobs scheduled using SM37
Dear Experts,
My requirement is to trigger email whenever a job gets cancelled in background.
For this I have already tried creating a workflow using BO BPJOB for event ABORTED.
But for some reason the event is never getting triggered.
I tested executing the workflow from tcode SWDD, it was running successfully, which means that there is no issue with my workflow.
Now I want to resolve the above issue OR
I want to raise the event manually from the program through some BADI or Exit.
But I didn't find any BADI or Exit for tcode SM37. Can anybody let me know if any.Hi,
Please refer the below links.
Workflow- Background job fail
Re: Send mail when job fails
Regards
GK.
Moderator message: please do not post just links without any further explanations.
Edited by: Thomas Zloch on Sep 20, 2010 11:53 AM -
I have a background job running that I want to cancel. I went to SM50 and Canceled With Core. I then went into sm37 and the job was still there running. So, I selected it and selected Cancel. Now, I get a message: "Job is not active - cancellation not possible." If I try to delete the job I get a message: "Job is active. The selected function cannot be performed." The job is still running with an active status in sm37. Does anyone know how to kill it?
Thanks in advance,
JasonI assume that it is NOT running in SM50, but showing as still active in SM37, right?
In SM37, check the checkbox next to the job in question, in the menu, click job, check status. This will sync it up. Now you should be able to delete.
Regards,
Rich HEilman -
How to restart canceled background job
Hi,
I scheduled a background job but because of database is down, When I hit SM37 it gives me list of canceled jobs.
What should I do to restart this jobs?
Regards,
RajeshHi Rajesh,
Click on the job and click menu Job - Repeat Scheduling.
You can't repeat all, your should do it one-by-one.
Regards,
Fendi Suyanto -
Retrieve cancelled background job and display it user on the selection scre
Hi all,
i am executing a background job and if successful it sends an email to the user .
if the job gets cancelled i want to display the job status to the user or email the user .
can anyone share your experiences on this .
thanks in advance.
regards,
RyU can use the FM 'BP_JOBLOG_READ' for the aborted jog to get their status log..then u can send this log to the user via mail.
pl. check this sample code..
REPORT ZEXAMPLE.
DATA: JOBLIST LIKE TBTCJOB OCCURS 0 WITH HEADER LINE,
JOBDETS LIKE BTCSELECT,
JOBLOG LIKE TBTC5 OCCURS 0 WITH HEADER LINE,
V_ANS.
PARAMETERS P_UNAME LIKE SY-UNAME DEFAULT SY-UNAME OBLIGATORY.
IF NOT P_UNAME IS INITIAL.
JOBDETS-JOBNAME = '*'.
JOBDETS-USERNAME = P_UNAME.
JOBDETS-FROM_DATE = SY-DATUM.
JOBDETS-TO_DATE = SY-DATUM.
JOBDETS-NO_DATE = 'X'.
JOBDETS-WITH_PRED = 'X'.
JOBDETS-PRELIM = 'X'.
JOBDETS-SCHEDUL = 'X'.
JOBDETS-READY = 'X'.
JOBDETS-RUNNING = 'X'.
JOBDETS-FINISHED = 'X'.
JOBDETS-ABORTED = 'X'.
ENDIF.
CALL FUNCTION 'BP_JOB_SELECT'
EXPORTING
JOBSELECT_DIALOG = 'Y'
JOBSEL_PARAM_IN = JOBDETS
TABLES
JOBSELECT_JOBLIST = JOBLIST
EXCEPTIONS
INVALID_DIALOG_TYPE = 1
JOBNAME_MISSING = 2
NO_JOBS_FOUND = 3
SELECTION_CANCELED = 4
USERNAME_MISSING = 5
OTHERS = 6.
IF SY-SUBRC EQ 0.
IF NOT JOBLIST[] IS INITIAL.
READ TABLE JOBLIST INDEX 1.
CALL FUNCTION 'BP_JOBLOG_READ'
EXPORTING
JOBCOUNT = JOBLIST-JOBCOUNT
JOBNAME = JOBLIST-JOBNAME
TABLES
JOBLOGTBL = JOBLOG
EXCEPTIONS
CANT_READ_JOBLOG = 1
JOBCOUNT_MISSING = 2
JOBLOG_DOES_NOT_EXIST = 3
JOBLOG_IS_EMPTY = 4
JOBLOG_NAME_MISSING = 5
JOBNAME_MISSING = 6
JOB_DOES_NOT_EXIST = 7
OTHERS = 8.
IF JOBLOG[] IS INITIAL.
WRITE:/ 'NO JOB LOG FOUND'.
ELSE.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = 'DELETE JOB LOGS'
TEXT_QUESTION = 'JOB LOGS FOUND. DELETE?'
POPUP_TYPE = 'W'
IMPORTING
ANSWER = V_ANS.
ENDIF.
IF V_ANS EQ '1'.
CALL FUNCTION 'BP_JOB_DELETE'
EXPORTING
JOBCOUNT = JOBLIST-JOBCOUNT
JOBNAME = JOBLIST-JOBNAME
EXCEPTIONS
CANT_DELETE_EVENT_ENTRY = 1
CANT_DELETE_JOB = 2
CANT_DELETE_JOBLOG = 3
CANT_DELETE_STEPS = 4
CANT_DELETE_TIME_ENTRY = 5
CANT_DERELEASE_SUCCESSOR = 6
CANT_ENQ_PREDECESSOR = 7
CANT_ENQ_SUCCESSOR = 8
CANT_ENQ_TBTCO_ENTRY = 9
CANT_UPDATE_PREDECESSOR = 10
CANT_UPDATE_SUCCESSOR = 11
COMMIT_FAILED = 12
JOBCOUNT_MISSING = 13
JOBNAME_MISSING = 14
JOB_DOES_NOT_EXIST = 15
JOB_IS_ALREADY_RUNNING = 16
NO_DELETE_AUTHORITY = 17
OTHERS = 18.
IF SY-SUBRC EQ 0.
WRITE:/ JOBLIST-JOBCOUNT, JOBLIST-JOBNAME, 'LOG DELETED'.
EXIT.
ELSE.
WRITE:/ JOBLIST-JOBCOUNT, JOBLIST-JOBNAME, 'LOG NOT DELETED'.
ENDIF.
ELSE.
CALL FUNCTION 'BP_JOBLOG_SHOW'
EXPORTING
JOBCOUNT = JOBLIST-JOBCOUNT
JOBNAME = JOBLIST-JOBNAME
EXCEPTIONS
ERROR_READING_JOBDATA = 1
ERROR_READING_JOBLOG_DATA = 2
JOBCOUNT_MISSING = 3
JOBLOG_DOES_NOT_EXIST = 4
JOBLOG_IS_EMPTY = 5
JOBLOG_SHOW_CANCELED = 6
JOBNAME_MISSING = 7
JOB_DOES_NOT_EXIST = 8
NO_JOBLOG_THERE_YET = 9
NO_SHOW_PRIVILEGE_GIVEN = 10
OTHERS = 11.
ENDIF.
ELSE.
WRITE:/ 'NO JOBS FOR', P_UNAME.
EXIT.
ENDIF.
ENDIF.
Regards,
Joy. -
Output of RFC FM in background job
Hello,
I have a report which call an RFC FM. The FM calls a class which write some output using write statement. How can this output
be captured in the spool request of job for my report? Is it possible?
Regards,
AhmedHi,
Take output data in one internal table and try below code
DATA: w_dest TYPE tsp01-rqdest,
w_handle TYPE sy-tabix,
w_spool_id TYPE tsp01-rqident,
w_name TYPE tsp01-rq0name,
w_titleline TYPE tsp01-rqtitle,
w_receiver TYPE tsp01-rqreceiver,
w_rc TYPE c,
w_errmsg(100) TYPE c,
w_text(70) TYPE c,
w_spool_nr TYPE tsp01-rqident.
CLEAR : w_name,
w_receiver,
w_titleline,
w_handle,
w_spool_nr,
w_rc,
w_errmsg.
* Set the name,title,receiver of the spool
w_name = 'ZTEST'.
w_titleline = 'ZTEST File Extraction'.
w_receiver = sy-uname.
* Open the spool request
CALL FUNCTION 'RSPO_OPEN_SPOOLREQUEST'
EXPORTING
dest = 'LOCL'
name = w_name
copies = 1
immediate_print = ' '
titleline = w_titleline
receiver = w_receiver
doctype = 'LIST'
IMPORTING
handle = w_handle
spoolid = w_spool_nr
rc = w_rc
errmessage = w_errmsg.
* Write the spool data
LOOP AT t_spool_data INTO e_spool_data.
CALL FUNCTION 'RSPO_WRITE_SPOOLREQUEST'
EXPORTING
handle = w_handle
text = e_spool_data-text
IMPORTING
rc = w_rc
errmessage = w_errmsg
EXCEPTIONS
handle_not_valid = 1
OTHERS = 2.
ENDLOOP.
* Close the spool request
CALL FUNCTION 'RSPO_CLOSE_SPOOLREQUEST'
EXPORTING
handle = w_handle
IMPORTING
rc = w_rc
errmessage = w_errmsg
EXCEPTIONS
handle_not_valid = 1
OTHERS = 2.
MESSAGE ID '8I' TYPE 'S' NUMBER '000' WITH
'File Extraction results sent to spool' w_spool_nr.
Above code will generate output.
Edited by: Thomas Zloch on Oct 12, 2010 1:44 PM - please use code tags -
Hi all,
I have a deletion job, SAP_BC_XMB_DELETE_888. I already have 400K messages in the DB. The problem is, the job is not running. It's always CANCELLED. Why is the behavior like that? Why is the deletion not running?
Thanks!Hi!
Why is the job cancelled resp. by whom? Is there anything in the job log and/or system log?
Did you configure the deletion of Integration Engine Messages using transaction SXMB_ADM?
To check if messages are to be deleted using your current settings you can run report RSXMB_SHOW_REORG_STATUS and/or RSXMB_SHOW_STATUS. for details also see SAP Notes 872388, 944727 and 1113757.
Hope this helps.
Regards, volker -
How do I run scheduled background job manually
I have a cancelled background job that is givingh dumps. I have implemented corrections and now i want to run it manullay to check it. How do i do that. Please suggest
Hi Bill,
You mentioned that you've applied some correction..If you applied some notes that might have modified the standard code.
In that case Go to SE38, Give the program name, choose "variant" > Display. Now select the variant (with which you got the message its not valid). Go to "Variant" > "Adjust".
Then try running the report with the variant. This should solve the variant issue.
Thanks,
Debasis.
Edited by: Debasis Sahoo on Sep 24, 2008 11:55 PM -
Regarding Background Job Abort using
Hi ,
I am using FM BP_JOB_ABORT to abort background jobs through program,but it taking longtime to cancel background jobs in SM37 after exectuing FM BP_JOB_ABORT in program..
will i have to write any statement in program after this FM BP_JOB_ABORT to cancel the background job immediately through program..
Awaiting for valuable suggestion..
Regards
AnilHi,
I looking for FM to cancel background jobs quikly through program..
Regards
Anil -
Custom Background Job Cancelling
Hi Folks,
I'm working on a custom development and I'm experiencing some trouble - I would greatly appreciate any help / effort from anyone in providing me with some ideas as to what the cause may be.
Basically my development is made up of two parts - Part 1) A custom RFC used to trigger a custom program in the background - here i'm using job_open / submit program / job_close. This works fine and a job is successfully created to run the custom program
Part 2) - The custom program, running in the background job tries to create a background job to trigger standard program (f.05) with a variant. Again using job_open / submit program / job_close. However on this occassion when the second background job starts it cancels immediately - stating "Make an entry in all required fields". . However the variant is fine and all the parameters for the standard program are filled. I can even trigger this program and variant seperately and it works.
Are there conflicts in creating a background job from a background job ? I'm confused as to why this is not working and i would appreciate any help or ideas anyone could give me on this.
Thanks alot for your time.
Regards
DK
Overview
RFC -> Create Background Job # 1 -> Background Job # 1 created successfully - Custom program running in Background Job # 1 tries to run standard program in backgroun - Background Job # 2 created successfully but immediately cancels - Job log message - "Make an entry in all required fields". Job cancelled after system exception ERROR_MESSAGE.Hi Guys,
Thanks for your answers. The job log does say "Make an entry in all required fields" - but all the required fields are specified under the variant. I can even run this program with the same variant with no problems. I'm wondering what would affect the submit to program to prevent it passing the variant correctly - here is my submit
SUBMIT sapf100 VIA JOB l_jobnam NUMBER l_jobcnt
USING SELECTION-SET l_vari
AND RETURN.
l_vari = Variant Name
l_jobname = job name
l_jobcnt = job count
here is the message from the job log. your help is appreciated - thanks
10.09.2009 14:22:18 Job started
10.09.2009 14:22:18 Step 001 started (program SAPF100, variant &0000000000018, user ID XXXX)
10.09.2009 14:22:18 Make an entry in all required fields
10.09.2009 14:22:18 Job cancelled after system exception ERROR_MESSAGE -
Background job E2E_HK_CONTROLLER cancelled
Hi,
We have solman 7.0 EHp1/Oracle on HP-UX.
The daily background job E2E_HK_CONTROLLER fails and the user is SMD_RFC.
The job log is:
Job started
Step 001 started (program E2E_HK_CONTROLLER, variant , user ID SMD_RFC)
Internal session terminated with a runtime error (see ST22)
Job cancelled
the ST22 says:
The current ABAP program "SAPLE2E_EFWK_HOUSEKEEPING" had to be terminated
because it has
come across a statement that unfortunately cannot be executed.
The error occurred during an RFC call to another system.
In the target system, a short dump has been written as well.
More detailed information on the error cause can be found there.
But i cant find which target system is being referred here.
Pls help
NandaHi,
Thanks for ur reply.
The error analysis is:
An error occurred when executing a REMOTE FUNCTION CALL
It was logged under the name "CREATE_DATA_UNKNOWN_TYPE"
on the called page.
and the How to correct error section is:
Please refer to the notes described in the
short dump. -
Handle submit program for background jobs in RFC FM to send email in ITS
Hi all
I am facing a problem in ITS, i.e. I have called a RFC Function Module on the page load event of one of the HTML template. In that FM I have used <b>submit program</b>. This RFC FM is working fine in background i.e. it is sending pdf as email to a particular email address
but in the frontend it is not responding.
I wanted to ask whether we can handle submit <program-name> in background job from ITS
<b>If you are unable to understand the problem i can share with you my code as well.</b>
Thanks
Ekta TuliHi Tobias
The Function Module <b>ZV_FUNC_CCK_EMAIL_PDF</b> is used to generate the email with pdf as attachement. it is generating email at backend but not in frontend.
thanks
ekta
please find the code below for the FM
FUNCTION zv_func_cck_email_pdf.
*"*"Local interface:
*" IMPORTING
*" VALUE(CONTRACT) LIKE VBAP-VBELN
*" VALUE(EMAIL) LIKE ADR6-SMTP_ADDR
*" EXPORTING
*" VALUE(RETURN) TYPE CHAR4
data: i_vbak like vbak .
DATA: v_cont(10) TYPE c.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = contract
IMPORTING
output = v_cont.
DATA: z_element(30) TYPE c.
DATA: gv_fb_addr_get_selection LIKE addr1_sel.
DATA: BEGIN OF mtab_contract OCCURS 0, "sap field
ordno(10), "vbeln (10)
terr(6),
vkorg LIKE vbak-vkorg,
vkgrp LIKE knvv-vkgrp,
repname(35),
repmailbox(10),
gueen(10), "expires dated -same as valid to
kunnr(10),
name1(35), "name1(35)
stras(35), "stras(35)
pstlz(10), "pstlz(10)
ort01(35), "ort01(35) city
regio(3), "regio(3)
kunnr2(10),
name2(35), "NUM?(35)
stras2(35), "stras(35)
pstlz2(10), "pstlz(10)
ort012(35), "ort01(35) city
regio2(3), "regio(3)
kit1 LIKE vbap-matnr, " currently 41315
kit1-qty(6), " like vbap-zmeng,
kit2 LIKE vbap-matnr, " currently 41316
kit2-qty(6), " like vbap-zmeng,
kit3 LIKE vbap-matnr, " currently 41317
kit3-qty(6), " like vbap-zmeng,
kit4 LIKE vbap-matnr, " currently 91869US
kit4-qty(6), " like vbap-zmeng,
med1 LIKE vbap-matnr, " currently 7408cp
med1-qty(6), " like vbap-zmeng,
med2 LIKE vbap-matnr, " currently 0211CP
med2-qty(6), " like vbap-zmeng,
med3 LIKE vbap-matnr, " currently 0578CP
med3-qty(6), " like vbap-zmeng,
med4 LIKE vbap-matnr, " currently 0068CP
med4-qty(6), " like vbap-zmeng,
med5 LIKE vbap-matnr, " currently 0069CP
med5-qty(6), " like vbap-zmeng,
med6 LIKE vbap-matnr, " currently other
dis6 LIKE makt-maktx, " currently other
med6-qty(6), " like vbap-zmeng,
med7 LIKE vbap-matnr, " currently other
dis7 LIKE makt-maktx, " currently other
med7-qty(6), " like vbap-zmeng,
med8 LIKE vbap-matnr, " currently other
dis8 LIKE makt-maktx, " currently other
med8-qty(6), " like vbap-zmeng,
med9 LIKE vbap-matnr, " currently other
dis9 LIKE makt-maktx, " currently other
med9-qty(6), " like vbap-zmeng,
med10 LIKE vbap-matnr, " currently other
dis10 LIKE makt-maktx, " currently other
med10-qty(6), " like vbap-zmeng,
END OF mtab_contract.
DATA: BEGIN OF mtab_material OCCURS 0,
ordno(10),
matnr LIKE vbap-matnr,
qty LIKE vbap-zmeng,
END OF mtab_material.
DATA: w-mm(4) VALUE ' MM '.
*SELECT-OPTIONS: s_vkorg FOR vbak-vkorg,
* s_vkgrp FOR knvv-vkgrp, "Sales Group
* s_terr FOR knvp-kunn2. "Territory Code
*PARAMETERS: p_parvw LIKE vbpa-parvw MEMORY ID par OBLIGATORY, "Partner ID
** DEFAULT 'Z1'.
* p_vbeln LIKE vbak-vbeln MEMORY ID aun,
* p_email LIKE adr6-smtp_addr MEMORY ID email. "Sales Document #
*SELECT-OPTIONS: "s_vbeln FOR vbak-vbeln MEMORY ID aun, "Sales Document #
* s_guebg FOR vbak-guebg, "Valid-From Date
* s_gueen FOR vbak-gueen, "Valid-To Date
* s_ship FOR vbpa-kunnr, "Ship-to customer
* s_bstzd FOR vbak-bstzd MEMORY ID bst ."DEFAULT 'CCK'. "P.O. # Supplement
DATA: i_otf TYPE STANDARD TABLE OF itcoo,
i_content_txt TYPE table of solisti1, "Content
i_content_bin TYPE solix_tab, "Content
i_content_bin1 TYPE solix_tab, "Content
i_objhead TYPE soli_tab,
w_pdf TYPE solisti1, "For PDF
w_res TYPE itcpp, "SAPscript output
w_otf TYPE itcoo, "For OTF
w_transfer_bin TYPE sx_boolean, "Content
prog(60).
data : t_obj_bin type standard table of solisti1.
DATA: w_arc_params LIKE arc_params,
w_pri_params LIKE pri_params.
*DATA: lcl_cls TYPE REF TO cl_gui_frontend_services.
CONSTANTS : c_x TYPE c VALUE 'X', "X
c_locl(4) TYPE c VALUE 'LOCL', "Local Printer
c_otf TYPE sx_format VALUE 'OTF', "OTF
c_pdf TYPE sx_format VALUE 'PDF', "PDF
c_printer TYPE sx_devtype VALUE 'PRINTER', "PRINTER
c_bin TYPE char10 VALUE 'BIN'. "BIN
DATA: v_name TYPE string ."Downloading File Name
DATA: v_len_in TYPE so_obj_len,
v_tempdir(50) TYPE c,
v_size TYPE i.
DATA : x_pdf_bag_tline TYPE rcl_bag_tline,
v_pdf_fsize TYPE i,
objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE,
doc_chng LIKE sodocchgi1,
tab_lines LIKE sy-tabix.
DATA : v_pnum LIKE usr21-persnumber,
v_anum LIKE usr21-addrnumber,
smtp_addr LIKE adr6-smtp_addr.
DATA: v_path TYPE string,
v_code TYPE i.
DATA : wa_obj_txt TYPE solisti1.
DATA : t_obj_txt TYPE STANDARD TABLE OF solisti1.
DATA : t_rec_list TYPE STANDARD TABLE OF somlreci1.
DATA : t_obj_pack TYPE STANDARD TABLE OF sopcklsti1.
DATA : wa_document_data TYPE sodocchgi1. "Mail data
DATA : wa_rec_list TYPE somlreci1.
DATA: reciever TYPE sadrud. "Email address of the receiver
DATA : wa_obj_pack TYPE sopcklsti1.
DATA: v_lines(10) TYPE n.
DATA: binfilesize TYPE i.
DATA : wa_obj_header TYPE solisti1.
DATA : t_obj_header TYPE STANDARD TABLE OF solisti1.
DATA : obj_id TYPE sofolenti1-object_id. "To send a file as attatchment
data: pdftab type table of tline with header line.
data : flag_sent_to_all type sonv-flag.
*START-OF-SELECTION.
* IF lcl_cls IS INITIAL.
* CREATE OBJECT lcl_cls.
* ENDIF.
CLEAR i_vbak.
SELECT * FROM vbak into i_vbak
WHERE
* guebg IN s_guebg AND "Valid-From Date
* gueen IN s_gueen AND "Valid-To Date
* vkorg IN s_vkorg AND
vbeln = v_cont AND
* AUART = 'LP ' AND "Converts to 'CO ' Scheduling A
auart = 'KM ' AND "Converts to 'CQ ' Qty contract
* VBTYP = 'E' AND "sales doc cat? JM
vbtyp = 'G' ."AND "sales doc cat "JM
* bstzd IN s_bstzd.
mtab_contract-kunnr = i_vbak-kunnr.
mtab_contract-ordno = i_vbak-vbeln.
mtab_contract-vkorg = i_vbak-vkorg.
WRITE i_vbak-gueen TO mtab_contract-gueen. "CHG014419
APPEND mtab_contract.
ENDSELECT.
LOOP AT mtab_contract.
* PERFORM get_contract. "CO sales orders line items
******Get Contract*********
* SELECT SINGLE kunnr "partner
* INTO vbpa-kunnr
* FROM vbpa
* WHERE vbeln EQ mtab_contract-ordno
* AND posnr EQ '000000'
* AND parvw EQ 'WE' "Ship-To's
* AND kunnr IN s_ship. "Ship-To ID added 04/01/99
* IF sy-subrc EQ 0 .
* MOVE vbpa-kunnr TO mtab_contract-kunnr2.
* MODIFY mtab_contract.
* ELSE.
* EXIT.
* ENDIF.
CLEAR knvp.
SELECT SINGLE kunn2 "territory
INTO knvp-kunn2
FROM knvp
WHERE kunnr EQ mtab_contract-kunnr2
AND vkorg EQ mtab_contract-vkorg
AND parvw EQ 'Z6'.
* AND kunn2 IN s_terr .
IF sy-subrc EQ 0 .
MOVE knvp-kunn2 TO mtab_contract-terr.
MODIFY mtab_contract.
ELSE.
EXIT.
ENDIF.
CLEAR kna1. "get rep name and mail box
SELECT SINGLE name2 FROM kna1 INTO (kna1-name2)
WHERE kunnr = knvp-kunn2.
IF sy-subrc EQ 0 .
SPLIT kna1-name2 AT w-mm INTO mtab_contract-repname
mtab_contract-repmailbox.
mtab_contract-repmailbox+3 = mtab_contract-repmailbox.
mtab_contract-repmailbox(3) = 'MM'.
MODIFY mtab_contract.
ENDIF.
CLEAR knvv.
SELECT SINGLE vkgrp
INTO knvv-vkgrp
FROM knvv
WHERE kunnr EQ knvp-kunn2
AND vkorg EQ mtab_contract-vkorg.
* AND vkgrp IN s_vkgrp.
IF sy-subrc EQ 0 .
MOVE knvv-vkgrp TO mtab_contract-vkgrp.
MODIFY mtab_contract.
ELSE.
EXIT.
ENDIF.
mtab_contract-med1-qty = '_______'.
mtab_contract-med2-qty = '_______'.
mtab_contract-med3-qty = '_______'.
mtab_contract-med4-qty = '_______'.
mtab_contract-med5-qty = '_______'.
mtab_contract-med6-qty = '_______'.
mtab_contract-med7-qty = '_______'.
mtab_contract-med8-qty = '_______'.
mtab_contract-med9-qty = '_______'.
mtab_contract-med10-qty = '_______'. "JM
mtab_contract-kit1-qty = '____'.
mtab_contract-kit2-qty = '____'.
mtab_contract-kit3-qty = '____'.
mtab_contract-kit4-qty = '____'.
mtab_contract-dis6 = 'OTHER _____________________'. "JM
mtab_contract-dis7 = 'OTHER _____________________'. "JM
mtab_contract-dis8 = 'OTHER _____________________'. "JM
mtab_contract-dis9 = 'OTHER _____________________'. "JM
mtab_contract-dis10 = 'OTHER _____________________'. "JM
* SELECT * FROM VBAP WHERE VBELN = MTAB_CONTRACT-ORDNO.
* IF VBAP-MATNR = '7408CP'.
* MTAB_CONTRACT-MED1 = VBAP-MATNR.
* ELSEIF VBAP-MATNR = '0211CP'.
* MTAB_CONTRACT-MED2 = VBAP-MATNR.
* ELSEIF VBAP-MATNR = '91865US'.
* MTAB_CONTRACT-MED3 = VBAP-MATNR.
* ELSEIF VBAP-MATNR = '0578CP'.
* MTAB_CONTRACT-MED4 = VBAP-MATNR.
* ELSEIF VBAP-MATNR = '0068CP'.
* MTAB_CONTRACT-MED5 = VBAP-MATNR.
* ELSEIF VBAP-MATNR = '0069CP'.
* MTAB_CONTRACT-MED6 = VBAP-MATNR.
* ELSEIF VBAP-MATNR = '92055CP'. "JM
* MTAB_CONTRACT-MED7 = VBAP-MATNR. "JM
* ELSEIF VBAP-MATNR = '90799CP'. "JM
* MTAB_CONTRACT-MED8 = VBAP-MATNR. "JM
* ELSEIF VBAP-MATNR = '41315'.
* MTAB_CONTRACT-KIT1 = VBAP-MATNR.
* ELSEIF VBAP-MATNR = '41316'.
* MTAB_CONTRACT-KIT2 = VBAP-MATNR.
* ELSEIF VBAP-MATNR = '41317'.
* MTAB_CONTRACT-KIT3 = VBAP-MATNR.
* ELSEIF VBAP-MATNR = '91869US'.
* MTAB_CONTRACT-KIT4 = VBAP-MATNR.
* ELSE.
* SELECT SINGLE MAKTX INTO MAKT-MAKTX
* FROM MAKT WHERE MATNR = VBAP-MATNR.
* ENDIF.
* MODIFY MTAB_CONTRACT.
* ENDSELECT.
MODIFY mtab_contract.
* IF.
** mtab_contract-terr IN s_terr AND
** mtab_contract-kunnr2 IN s_ship AND
** mtab_contract-vkgrp IN s_vkgrp.
** PERFORM get_address.
* ELSE.
* DELETE mtab_contract INDEX sy-tabix.
* ENDIF.
ENDLOOP.
SORT mtab_contract BY terr.
* PERFORM set_print_option.
* Print defaults should be immed and delete after print...
itcpo-tdimmed = ' '.
itcpo-tddelete = 'X'.
itcpo-tdnewid = 'X'.
itcpo-tdcopies = 1.
itcpo-tdnoprev = 'X'.
itcpo-tdgetotf = 'X'.
itcpo-tddest = 'LOCL'.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = 'LOCL'
no_dialog = 'X'
IMPORTING
out_archive_parameters = w_arc_params
out_parameters = w_pri_params.
*exit if cancel chosen*
IF sy-subrc NE 0.
EXIT.
ENDIF.
sadr-regio = 'CA'.
sadr-pstlz = '92620'.
LOOP AT mtab_contract.
* PERFORM check-for-values.
IF mtab_contract-ordno = space.
mtab_contract-ordno = '___________'.
ENDIF.
IF mtab_contract-terr = space.
mtab_contract-terr = '______'.
ENDIF.
IF mtab_contract-repname = space.
mtab_contract-repname = '___________________________________'.
ENDIF.
IF mtab_contract-repmailbox = space.
mtab_contract-repmailbox = '__________'.
ENDIF.
IF mtab_contract-kunnr = space.
mtab_contract-kunnr = '__________'.
ENDIF.
IF mtab_contract-name1 = space.
mtab_contract-name1 = '___________________________________'.
ENDIF.
IF mtab_contract-stras = space.
mtab_contract-stras = '___________________________________'.
ENDIF.
IF mtab_contract-pstlz = space.
mtab_contract-pstlz = '__________'.
ENDIF.
IF mtab_contract-ort01 = space.
mtab_contract-ort01 = '___________________________________'.
ENDIF.
IF mtab_contract-regio = space.
mtab_contract-regio = '___'.
ENDIF.
IF mtab_contract-kunnr2 = space.
mtab_contract-kunnr2 = '__________'.
ENDIF.
IF mtab_contract-name2 = space.
mtab_contract-name2 = '___________________________________'.
ENDIF.
IF mtab_contract-stras2 = space.
mtab_contract-stras2 = '___________________________________'.
ENDIF.
IF mtab_contract-pstlz2 = space.
mtab_contract-pstlz2 = '__________'.
ENDIF.
IF mtab_contract-ort012 = space.
mtab_contract-ort012 = '___________________________________'.
ENDIF.
IF mtab_contract-regio2 = space.
mtab_contract-regio2 = '___'.
ENDIF.
* PERFORM open_form.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
dialog = ' '
form = 'ZREV_CCK_AGREMT'
language = sy-langu
OPTIONS = itcpo
EXCEPTIONS
canceled = 1
device = 2
form = 3
OPTIONS = 4
unclosed = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE e000(zz) WITH 'Open Form Error. ' sy-subrc.
ENDIF.
z_element = 'MAIN'.
* PERFORM write_form.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = z_element
EXCEPTIONS
element = 1
function = 2
type = 3
unopened = 4
unstarted = 5
window = 6
OTHERS = 7.
* PERFORM close_form.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = w_res
TABLES
otfdata = i_otf
EXCEPTIONS
unopened = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e000(zz) WITH 'Close Form Error. ' sy-subrc.
ENDIF.
*&---Convert OTF data to PDF data.
call function 'CONVERT_OTF'
exporting
format = 'PDF'
importing
bin_filesize = binfilesize
tables
otf = i_otf
lines = pdftab[].
data : name LIKE RLGRAP-FILENAME.
CONCATENATE 'C:Temp' mtab_contract-ordno '.pdf' INTO v_name.
*CALL FUNCTION 'DOWNLOAD'
* EXPORTING
* bin_filesize = v_size
* filename = name
* filetype = 'BIN'
* TABLES
* data_tab = pdftab[].
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = v_name
FILETYPE = 'BIN'
tables
data_tab = pdftab[].
* Downloading the PDF File
* CALL METHOD lcl_cls->gui_download
* EXPORTING
* bin_filesize = v_size
* filename = v_name
* filetype = c_bin
* CHANGING
* data_tab = pdftab[].
CALL METHOD cl_gui_cfw=>flush.
**Send PDF as Email.
* wa_obj_txt-line = 'CCK Contract Agreement'.
APPEND wa_obj_txt TO t_obj_txt.
CLEAR wa_obj_txt.
wa_obj_txt-line = 'Please find attatched PDF document for Contract'.
APPEND wa_obj_txt TO t_obj_txt.
CLEAR wa_obj_txt.
DESCRIBE TABLE t_obj_txt LINES tab_lines.
**Prepare document data
wa_document_data-obj_name = 'CCK Contract Agreement'.
wa_document_data-obj_descr = 'CCK Contract Agreement'.
wa_document_data-obj_langu = sy-langu.
wa_document_data-proc_type = 'R'.
wa_document_data-proc_name = 'CCK'.
wa_document_data-priority = c_x.
wa_document_data-obj_prio = c_x.
**Receiving list
wa_rec_list-receiver = sy-uname.
wa_rec_list-rec_type = 'B'.
wa_rec_list-com_type = 'INT'.
wa_rec_list-notif_del = c_x.
APPEND wa_rec_list TO t_rec_list.
CLEAR wa_rec_list.
wa_rec_list-receiver = '[email protected]'."p_email.
reciever = wa_rec_list-receiver.
wa_rec_list-rec_type = 'U'.
wa_rec_list-com_type = 'INT'.
wa_rec_list-notif_del = c_x.
APPEND wa_rec_list TO t_rec_list.
CLEAR wa_rec_list.
*Object packet
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
line_width_src = 134
line_width_dst = 255
TABLES
content_in = pdftab[]
content_out = t_obj_bin
EXCEPTIONS
err_line_width_src_too_long = 1
err_line_width_dst_too_long = 2
err_conv_failed = 3
OTHERS = 4
IF sy-subrc <> 0.
ENDIF.
DESCRIBE TABLE t_obj_bin LINES v_lines.
CLEAR wa_obj_pack-transf_bin .
wa_obj_pack-head_start = 1.
wa_obj_pack-head_num = 0.
wa_obj_pack-body_start = 1.
wa_obj_pack-body_num = tab_lines.
wa_obj_pack-doc_type = 'RAW'.
wa_obj_pack-doc_size = tab_lines * 255.
APPEND wa_obj_pack TO t_obj_pack.
CLEAR wa_obj_pack.
wa_obj_pack-transf_bin = 'X'.
wa_obj_pack-head_start = 1.
wa_obj_pack-head_num = 0.
wa_obj_pack-body_start = 1.
wa_obj_pack-body_num = v_lines.
wa_obj_pack-doc_type = 'PDF'.
wa_obj_pack-obj_name = 'ATTATCHMENT'.
wa_obj_pack-obj_descr = mtab_contract-ordno.
wa_obj_pack-doc_size = binfilesize.
APPEND wa_obj_pack TO t_obj_pack .
CLEAR wa_obj_pack.
**Object header
wa_obj_header-line = 'PDF'.
APPEND wa_obj_header TO t_obj_header.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_document_data
put_in_outbox = c_x
commit_work = c_x
IMPORTING
sent_to_all = flag_sent_to_all
new_object_id = obj_id
TABLES
packing_list = t_obj_pack
object_header = t_obj_header
contents_bin = t_obj_bin
contents_txt = t_obj_txt
receivers = t_rec_list
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.
IF sy-subrc <> 0.
else.
return = 'true'.
ENDIF.
ENDFUNCTION.
<b> Flow Editor</b>
<flow>
<state name="Start">
<module name="<b>ZV_FUNC_CCK_EMAIL_PDF</b>" type="RFC" stateful="1">
<inputmapping source="Contract" target="CONTRACT"/>
<inputmapping source="email" target="EMAIL"/>
</module>
<module name="ZV_FUNC_CCK_VALIDATE_SHIPTO" type="RFC" stateful="1">
<inputmapping source="SHIP_TO" target="KUNNR"/>
<inputmapping source="USERNAME" target="USER"/>
<outputmapping source="CITY" target="CITY"/>
<outputmapping source="NAME" target="NAME"/>
<outputmapping source="POSTAL" target="POSTAL"/>
<outputmapping source="REGION" target="REGION"/>
<outputmapping source="RETURN" target="RETURN"/>
<outputmapping source="SD_CITY" target="SD_CITY"/>
<outputmapping source="SD_NAME" target="SD_NAME"/>
<outputmapping source="SD_POSTAL" target="SD_POSTAL"/>
<outputmapping source="SD_REGION" target="SD_REGION"/>
<outputmapping source="SD_STREET" target="SD_STREET"/>
<outputmapping source="SOLDTO" target="SOLDTO"/>
<outputmapping source="STREET" target="STREET"/>
</module>
</state>
<event name="onLoad" next_state="Start"/>
<event name="Check2" next_template="ZV_CCO_CONFIRMED_ORDER"/>
</flow> -
BWREMOTE background job canceled in sap r/3 system
Hi my friends,
Thanks for your help ahead.
Today I checked the background job in SAP R/3 created by BWREMOTE via SM37. It showed me some jobs had been canceled.
I displayed its log, the detail message is:
==========================================
Step 001 started (program SBIE0001, variant &0000000083494, user name BWREMOTE)
DATASOURCE = ZQM_NOT_SHFGRP
Call up of customer enhancement BW_BTE_CALL_BW204010_E (BTE) with 1,593 records
Result of customer enhancement: 1,593 records
Call up of customer enhancement EXIT_SAPLRSAP_001 (CMOD) with 1,593 records
ABAP/4 processor: SAPSQL_INVALID_FIELDNAME
Job cancelled
==========================================
Then I displayed the "Long Text" of the job log. It is
One of the field names in the SELECT clause was not recognized.
Error analysis
The SELECT clause was specified in an internal table at runtime.
It contains the field name "TPR00", but this does not occur in any of
the database tables listed in the FROM clause.
Information on where termination occurred
The termination occurred in the ABAP/4 program "SAPLXRSA " in
"EXIT_SAPLRSAP_001".
The main program was "SBIE0001 ".
Source code extract
008840 concatenate 'TPR'
008850 day_temp+6(2)
008860 ' = '
008870 ' ''' zshift '''' into
008880 cond .
008890 append cond to itab .
008900 select schkz into i_not_shfgrp-zzschkz from t552a
008910 where zeity = '2'
008920 and mofid = 'CN'
008930 and mosid = '28'
008940 and ( schkz = 'SFTA' or
008950 schkz = 'SFTB' or
008960 schkz = 'SFTC' or
008970 schkz = 'SFTD' )
008980 and kjahr = day_temp+0(4)
008990 and monat = day_temp+4(2)
> and (itab) .
009010 endselect.
I guess that there is not a field named TPR00 in table t552a.
Next, I opened the 'project management of sap enhancement' via CMOD, entering the project name and chosing 'Display'.
Then Double click the Components 'EXIT_SAPLRSAP_001', we can see the function module 'EXIT_SAPLRSAP_001'. In the source codes, there is an include program, it is 'INCLUDE ZXRSAU01.'.
Then, I double clicked the Include program and find the position program terminated. The source codes are:
ZQM_NOT_SHFGRP *
when 'ZQM_NOT_SHFGRP'.
loop at c_t_data into i_not_shfgrp .
l_tabix = sy-tabix .
clear :mbatch ,zshift,cond ,zfield, zcharg, day_temp .
refresh itab.
if i_not_shfgrp-ausvn is initial.
else.
aa = '080000'.
bb = '160000'.
cc = '235959'.
day_temp = i_not_shfgrp-ausvn.
if i_not_shfgrp-auztv ge aa and
i_not_shfgrp-auztv lt bb .
zshift = 'MSHF' .
elseif i_not_shfgrp-auztv ge bb and
i_not_shfgrp-auztv le cc .
zshift = 'LSHF'.
else .
zshift = 'NSHF'.
day_temp = i_not_shfgrp-ausvn - 1.
endif.
concatenate 'TPR'
day_temp+6(2)
' = '
' ''' zshift '''' into
cond .
append cond to itab .
select schkz into i_not_shfgrp-zzschkz from t552a
where zeity = '2'
and mofid = 'CN'
and mosid = '28'
and ( schkz = 'SFTA' or
schkz = 'SFTB' or
schkz = 'SFTC' or
schkz = 'SFTD' )
and kjahr = day_temp+0(4)
and monat = day_temp+4(2)
and (itab) .
endselect.
endif.
I found that we got a TPR00 during concatenation. In other words, day_temp+6(2) = 00. But I think it is impossible. I can not explain this.
Any ideas, my friends. Many thanks.select schkz into i_not_shfgrp-zzschkz from t552a
where zeity = '2'
and mofid = 'CN'
and mosid = '28'
and ( schkz = 'SFTA' or
schkz = 'SFTB' or
schkz = 'SFTC' or
schkz = 'SFTD' )
and kjahr = day_temp+0(4)
and monat = day_temp+4(2)
<b>and (itab) .</b> => doesn't make sense?!
endselect.
endif.
it seems something got deleted between 'and' and '(itab)'... so, you'll have to recheck the requirements for your select to fill the 'and' statement further.
so, it should look like
and monat = day_temp+4(2)
and <b><some kind of condition that needs to be fulfilled></b>.
endselect.
<b><some logic to fill a line in your internal table></b>.
append cond to itab.
endif.
obviously <some kind of condition that needs to be fulfilled> needs to be replaced by a real condition
and <some logic to fill a line in your internal table> needs to be replaced by some kind of formula
I assume something like (otherwise it would be really weird to select that field):
cond = i_not_shfgrp-zzschkz.
or a formula using the i_not_shfgrp-zzschkz field.
It would also be a lot better to replace your select ... endselect by a select single as you'll be selecting 1 record only anyways.
Message was edited by:
RafB -
HRALXSYNC Background job is cancelled
Hi,
I scheduled HRALXSYNC report in background but it is executed for some time and then it is Canceled and the job type is execute immediately.
Here am pasting the details of scheduled job.
Date Time Message text
08/30/2011 07:09:52 Job started
08/30/2011 07:09:52 Step 001 started (program HRALXSYNC, variant SAP&DEFAULT, user ID SHAIKSJ)
08/30/2011 07:17:34 Enter at least one number for the business partner
08/30/2011 07:17:34 Job cancelled after system exception ERROR_MESSAGE
Note: Here this background job run as "changes since".
Can any suggest me how to solve this issue.
Thanks in advance
SaleemHi Saleem,
Not sure if you already solved your issue.
But I have one remark regarding the value of "Changes Since":
The program HRALXSYNC stores the date of last successful runtime in table T77ZZ (REPID=HRALXSYNC).
"01.01.1900" is the inital default date. Please start HRALXSYNC in dialog mode and select "Changes Since" and execute the program. Then select all lines of the result list and press on the 'Repair' button. Errors in the result need to be investigated.
I am actually as well 'fighting' in the area of HR data Integration into CRM.
Kind Regards,
Bjoern -
Background job getting CANCELLED
hello,
i have a background job scheduled for a report program.it is getting cancelled and giving the following error:
"TABLE_ILLEGAL_STATEMENT"
You attempted to change, delete or create a line in the
internal table "???", but no valid cursor exists
for the table.
Possible reasons:
1. The relevent ABAP/4 statement does not include the addition
"...INDEX...", although the statement is not
inside a "LOOP...ENDLOOP" loop processing this table.
2. The relevent ABAP/4 statement was called from within a
"LOOP...ENDLOOP" loop after a DELETE "???".
what could be the reason?it is also giving following error message:
Caution: Program has changed
Caution: At time of termination, Active source code no longer available and after above two statements its giving sign "?" before every statement in below manner:
024300 ? lit_ekpo_dummy1[] = it_ekpo[].
024310 ? DELETE lit_ekpo_dummy1 WHERE ebeln NE tab1-ebeln.
024320 ? DESCRIBE TABLE lit_ekpo_dummy1 LINES count01.
024330 ?
024340 ? REFRESH lit_ematn_dummy[].
024350 ? lit_ematn_dummy[] = lit_ematn[].
Maybe you are looking for
-
HT4437 My appletv has got a locked symbol on my I tunes on my computer so can't get it to work
Can't get AirPlay to work on apple tv or file sharing on iTunes apple tv has a locked symbol on my iTunes on my laptop please help
-
RTTI vs Compiler Type Identification (Casting?)
Given: Class Super and two subclasses of Super, SubOne and SubTwo. Super has one method, doBeDooBeDoo() SubOne has one method, doThis() SubTwo has one method, doThat() Super a = null; if(foo) { a = new SubOne(); a.doThis(); } else if(bar) {
-
How remove embedded font from PDF
When I print to PDF on Mac OS 10.6.8 by default embed fonts to PDF-file. It add unnecessary bites to PDF-file (the file is huge size). How to remove this option of fonts embedding? Or how remove embedded font from PDF file?
-
I have a little problem with recursion.
I have a HashMap, and I've written a method to fill it up recursively. The map size is 20. void fillMap(HashMap map) if(map.size()==20) return; //Code to fill up map System.out.println("Map size = " + map.size() ); fillMap(); }Output is like: Map
-
Need help with flash player installation please !!!!
Hello, I need help with my flash player installation because every time I access a movie this is the message I receive. This content on Xfinity TV is not available for viewing with Chrome's "Incognito" mode. To play this video using Chrome, please v